summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2017-06-26 08:42:08 +0200
committerAaron Bohy <aab@odoo.com>2017-06-27 14:12:31 +0200
commit816a3cd2c1edeff2ffa2e90c0f8a25795804f84d (patch)
tree26503a6eb7f268fea401d1254be909510efd3f08 /addons
parent4881f942cb7cad51b8472425830c8444cfe09d1a (diff)
[FIX] web: ViewManager: filter out some keys from context
A traceback occured when trying to create a BOM by going to Inventory > Master Data > Products, on a product form view clicking on the BOM stat button, and then on 'Create'. This was a context problem: the context of the 'Products' action was passed to the 'BOM' action without removing action specific keys like 'default_*' or 'search_default_*'. For instance, it contained a 'default_type' key, and as type is also a field of the mrp.bom model, the python tried to interpret it, except that the given value wasn't a correct value for mrp.bom. When a button is clicked, we mix contexts coming from different places to execute the new action. For some of them, we already filtered out those action specific keys. This fix is simply to make the piece of context adding the problematic keys pass though the filter as well.
Diffstat (limited to 'addons')
-rw-r--r--addons/web/static/src/js/chrome/view_manager.js3
1 files changed, 1 insertions, 2 deletions
diff --git a/addons/web/static/src/js/chrome/view_manager.js b/addons/web/static/src/js/chrome/view_manager.js
index a51fc911a99..3909a7bfeaa 100644
--- a/addons/web/static/src/js/chrome/view_manager.js
+++ b/addons/web/static/src/js/chrome/view_manager.js
@@ -567,11 +567,10 @@ var ViewManager = Widget.extend(ControlPanelMixin, {
// 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 Context(
- _.object(_.reject(_.pairs(self.env.context), function(pair) {
+ _.object(_.reject(_.pairs(_.extend({}, action_data.context, self.env.context)), function(pair) {
return pair[0].match('^(?:(?:default_|search_default_|show_).+|.+_view_ref|group_by|group_by_no_leaf|active_id|active_ids)$') !== null;
}))
);
- ncontext.add(action_data.context || {});
ncontext.add({active_model: self.env.modelName});
if (res_ids) {
ncontext.add({