From 1d76586a1b0fff766581871cd277332bbfec030a Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 9 Feb 2015 17:42:37 +0100 Subject: [PATCH] [FIX] web: context lang & active* in action buttons This reverts rev. 9f9e7ef0e1ca1d2f5fc5e0a166499c95359dbbf3 As explained in 9f9e7ef0e1ca1d2f5fc5e0a166499c95359dbbf3, if a field "lang" is present in the view, clicking in any action item in the more menu leaded for the action title to be translated in the lang value of the form, such as in the partner form. 9f9e7ef0e1ca1d2f5fc5e0a166499c95359dbbf3 fixed the issue, but has as side-effect to not update correctly the active* keys. So, if "active_id" was used in the context of the action button, and the active_id was set in the dataset context, for example because you come from another form, trough another action button (For instance, Customers > Opportunities > Logged Calls), the active_id was not updated with the current id of the record. opw-620293 opw-617321 fixes #3462 --- addons/web/controllers/main.py | 4 ++-- addons/web/static/src/js/view_form.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index b3acbbe5119..f5c31b2d1bf 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1422,7 +1422,7 @@ class Action(openerpweb.Controller): except Exception: action_id = 0 # force failed read - base_action = Actions.read([action_id], ['type'], req.context) + base_action = Actions.read([action_id], ['name', 'type'], req.session.get_context()) if base_action: ctx = {} action_type = base_action[0]['type'] @@ -1431,7 +1431,7 @@ class Action(openerpweb.Controller): ctx.update(req.context) action = req.session.model(action_type).read([action_id], False, ctx) if action: - value = clean_action(req, action[0]) + value = clean_action(req, dict(action[0], **base_action[0])) return value @openerpweb.jsonrequest diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index d4cf85a59f2..201f472b800 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1165,7 +1165,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM }, build_eval_context: function() { var a_dataset = this.dataset; - return new instance.web.CompoundContext(this._build_view_fields_values(), a_dataset.get_context()); + return new instance.web.CompoundContext(a_dataset.get_context(), this._build_view_fields_values()); }, });