From 920ba459353d13946c2bde804fb64c8e146b15cf Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 11 Dec 2013 17:18:10 +0100 Subject: [FIX] filter the context keys only on the result action of the button bzr revid: chs@openerp.com-20131211161810-hetgizet5mv3xkys --- addons/web/static/src/js/views.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'addons/web/static/src/js') diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 1ee89238e7d..517a6ced723 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -1355,20 +1355,19 @@ instance.web.View = instance.web.Widget.extend({ return self.getParent().on_action_executed.apply(null, arguments); } }; - var context = dataset.get_context(); - if (action_data.model !== dataset.model) { - // filter out context keys that are specific to the action model. - // Wrong default_ and search_default values will no give the expected views - // Wrong group_by values will simply fail and forbid rendering of the destination view - context = _.object(_.reject(_.pairs(context.eval()), function(pair) { - return pair[0].match('^(?:(?:default_|search_default_).+|group_by|group_by_no_leaf)$') !== null; - })); - } + var context = new instance.web.CompoundContext(dataset.get_context(), action_data.context || {}); - context = new instance.web.CompoundContext(context, action_data.context || {}); + // response handler var handler = function (action) { if (action && action.constructor == Object) { - var ncontext = new instance.web.CompoundContext(context); + // filter out context keys that are specific to the current action. + // Wrong default_* and search_default_* values will no give the expected result + // Wrong group_by values will simply fail and forbid rendering of the destination view + var ncontext = new instance.web.CompoundContext( + _.object(_.reject(_.pairs(context.eval()), function(pair) { + return pair[0].match('^(?:(?:default_|search_default_).+|group_by|group_by_no_leaf)$') !== null; + })) + ); if (record_id) { ncontext.add({ active_id: record_id, -- cgit v1.2.3 From 9241d5f6993a662c1bc194f828cf39f4c04efb7a Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 11 Dec 2013 17:36:09 +0100 Subject: [FIX] when executing action received from a button call, set active_id and active_ids if there is one, remove existing if not; always set active_model bzr revid: chs@openerp.com-20131211163609-i3s2mlncf5n91uda --- addons/web/static/src/js/views.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'addons/web/static/src/js') diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 517a6ced723..1d7ed406378 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -1365,14 +1365,14 @@ instance.web.View = instance.web.Widget.extend({ // Wrong group_by values will simply fail and forbid rendering of the destination view var ncontext = new instance.web.CompoundContext( _.object(_.reject(_.pairs(context.eval()), function(pair) { - return pair[0].match('^(?:(?:default_|search_default_).+|group_by|group_by_no_leaf)$') !== null; + return pair[0].match('^(?:(?:default_|search_default_).+|group_by|group_by_no_leaf|active_id|active_ids)$') !== null; })) ); + ncontext.add({active_model: dataset.model}); if (record_id) { ncontext.add({ active_id: record_id, active_ids: [record_id], - active_model: dataset.model }); } ncontext.add(action.context || {}); -- cgit v1.2.3 From cb0074ab15efd5e98ca0472ec66a8a89fef42719 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 18 Dec 2013 12:24:16 +0100 Subject: [FIX] web: context propagation was broken on buttons of action and object type. The context on the button must be propagated to the resulting action bzr revid: dle@openerp.com-20131218112416-2vtaq442qo8opq4u --- addons/web/static/src/js/views.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src/js') diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 1d7ed406378..c9584002472 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -1364,10 +1364,11 @@ instance.web.View = instance.web.Widget.extend({ // Wrong default_* and search_default_* values will no give the expected result // Wrong group_by values will simply fail and forbid rendering of the destination view var ncontext = new instance.web.CompoundContext( - _.object(_.reject(_.pairs(context.eval()), function(pair) { + _.object(_.reject(_.pairs(dataset.get_context().eval()), function(pair) { return pair[0].match('^(?:(?:default_|search_default_).+|group_by|group_by_no_leaf|active_id|active_ids)$') !== null; })) ); + ncontext.add(action_data.context || {}); ncontext.add({active_model: dataset.model}); if (record_id) { ncontext.add({ -- cgit v1.2.3