Xavier ALT (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-client-web/6.0-opw-575690-xal into 
lp:openobject-client-web.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-575690-xal/+merge/109384

Hi,

This fix a problem when clicking on a button on "unsaved record" and that 
button record a new action which should open in a new tab.

Steps:
- Create a Wiki page "Test1" without any "Wiki Group set"
- Create a new wiki group page, choose "Test1" page a "Home Page"
- Click on button "Open Wiki Page"

Current: open a new tab (ok), old tab shown warning about unsave modifications 
and show empty record if we click "ok"
Expected: open new tab tab, reload old tab with just created record.

Regards,
Xavier
-- 
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-575690-xal/+merge/109384
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-client-web/6.0-opw-575690-xal.
=== modified file 'addons/openerp/controllers/actions.py'
--- addons/openerp/controllers/actions.py	2012-05-04 13:21:50 +0000
+++ addons/openerp/controllers/actions.py	2012-06-08 15:24:19 +0000
@@ -342,6 +342,14 @@
     # then used back as a URL
     action.pop('search_view', None)
 
+    # when perform any button action on unsaved-record which returns 'ir.action.act_window'
+    # which pop-up new window but 'appcontent' is not reloaded
+    # for that passing active_id in headers, to get it in openAction
+    if getattr(cherrypy.request, 'params', []):
+        if getattr(cherrypy.request.params, 'context', {}):
+            cherrypy.response.headers['active_id'] = cherrypy.request.params.get('_terp_id')\
+            or cherrypy.request.params.context.get('active_id')
+
     # Add 'opened' mark to indicate we're now within the popup and can
     # continue on during the second round of execution
     payload = str({

=== modified file 'addons/openerp/static/javascript/openerp/openerp.base.js'
--- addons/openerp/static/javascript/openerp/openerp.base.js	2012-05-04 13:21:50 +0000
+++ addons/openerp/static/javascript/openerp/openerp.base.js	2012-06-08 15:24:19 +0000
@@ -186,12 +186,17 @@
             break;
         case 'popup':
             window.open(action_url);
-            if (terp_id) {
+            if (terp_id && window.isEmpty($dialogs)) {
+                // reload base model with the record specified by 'terp_id',
+                // but only when we're not in a dialog - in that case the
+                // 'terp_id' is related to the model from that dialog, not the
+                // base model
             	window.top.editRecord(terp_id);
             }
             else {
-                // no terp_id specified, simply reload the current view
-                jQuery(".active", "#view-selector").click();
+                // no terp_id specified, or within a dialog: simply reload the
+                // current view on base model
+                jQuery("#view-selector .active").click();
             }
             break;
         case 'iframe':

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to