[FIX] web: context lang & active* in action buttons
This reverts rev.9f9e7ef0e1
As explained in9f9e7ef0e1
, 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.9f9e7ef0e1
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
This commit is contained in:
parent
318f254761
commit
1d76586a1b
|
@ -1422,7 +1422,7 @@ class Action(openerpweb.Controller):
|
||||||
except Exception:
|
except Exception:
|
||||||
action_id = 0 # force failed read
|
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:
|
if base_action:
|
||||||
ctx = {}
|
ctx = {}
|
||||||
action_type = base_action[0]['type']
|
action_type = base_action[0]['type']
|
||||||
|
@ -1431,7 +1431,7 @@ class Action(openerpweb.Controller):
|
||||||
ctx.update(req.context)
|
ctx.update(req.context)
|
||||||
action = req.session.model(action_type).read([action_id], False, ctx)
|
action = req.session.model(action_type).read([action_id], False, ctx)
|
||||||
if action:
|
if action:
|
||||||
value = clean_action(req, action[0])
|
value = clean_action(req, dict(action[0], **base_action[0]))
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@openerpweb.jsonrequest
|
@openerpweb.jsonrequest
|
||||||
|
|
|
@ -1165,7 +1165,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
|
||||||
},
|
},
|
||||||
build_eval_context: function() {
|
build_eval_context: function() {
|
||||||
var a_dataset = this.dataset;
|
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());
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue