Xavier ALT (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-client-web/6.0-opw-51150-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-51150-xal/+merge/104623

Hi,

When activating buttons, changing search criteria on 'search view', parent 
context are not preserved. This MP fix that problem.

Regards,
Xavier
-- 
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-51150-xal/+merge/104623
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-client-web/6.0-opw-51150-xal.
=== modified file 'addons/openerp/controllers/search.py'
--- addons/openerp/controllers/search.py	2012-03-20 15:41:47 +0000
+++ addons/openerp/controllers/search.py	2012-05-03 20:57:21 +0000
@@ -118,7 +118,12 @@
         context = params.context or {}
         parent_context = dict(params.parent_context or {},
                               **rpc.session.context)
-        parent_context = self.context_get(params.parent_context) or {}
+
+        # filter out default_* and search_default_* from context,
+        # but not when doing a search from the 'search view' (we have to keep parent context)
+        if params.search_mode != 'true':
+            parent_context = self.context_get(params.parent_context) or {}
+
         if 'group_by' in parent_context:
             if isinstance(params.group_by, str):
                 parent_context['group_by'] = cleanup_group_by(params.group_by).split(',')
@@ -140,11 +145,12 @@
             prefix = prefix.rsplit('/', 1)[0]
             pctx = pctx.chain_get(prefix)
 
-        #update active_id in context for links
-        parent_context.update(
-            active_id=params.active_id or False,
-            active_ids=params.active_ids or [])
-
+        # update active_id in context for links
+        # but not when doing a search from the 'search view' (we have to keep parent context)
+        if params.search_mode != 'true':
+            parent_context.update(
+                active_id=params.active_id or False,
+                active_ids=params.active_ids or [])
         ctx.update(
             parent=pctx,
             context=parent_context,

=== modified file 'addons/openerp/static/javascript/form.js'
--- addons/openerp/static/javascript/form.js	2012-01-19 14:30:04 +0000
+++ addons/openerp/static/javascript/form.js	2012-05-03 20:57:21 +0000
@@ -741,6 +741,9 @@
         '_terp_active_id': openobject.dom.get(prefix.concat('_terp_id').join('/')).value,
         '_terp_active_ids': openobject.dom.get(prefix.concat('_terp_ids').join('/')).value
     });
+    if (options.from_search_mode) {
+        params['_terp_search_mode'] = 'true';
+    }
 
     if (options.group_by_ctx && options.group_by_ctx.length > 0)
         params['_terp_group_by'] = options.group_by_ctx;

=== modified file 'addons/openerp/static/javascript/search.js'
--- addons/openerp/static/javascript/search.js	2012-03-20 15:41:47 +0000
+++ addons/openerp/static/javascript/search.js	2012-05-03 20:57:21 +0000
@@ -717,7 +717,8 @@
                     source: '_terp_list',
                     domain: obj.domain,
                     context: obj.context,
-                    group_by_ctx: group_by_ctx
+                    group_by_ctx: group_by_ctx,
+                    from_search_mode: true,
                 });
 
                 in_req.addCallback(function(in_obj){

_______________________________________________
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