[FIX] web: action translation (menuitems & more menu)

This rev. reverts partially 1d76586a1b
This rev. is related to #3462

Regarding addons/web/controllers/main.py
---
name of model ir.actions.actions is not translated
it's the name of server actions, client actions and window actions
that are translated.
Meaning the name of the ir.actions.actions will always be in English,
even when passing the user language within the context.

Regarding addons/web/static/src/js/views.js
---
There is no reason to pass the field values within the context
of the /web/action/load call: The read methods of actions are
not overidden to use the field values. Besides, it pollutes
the context of the action, leading to unwanted behavior, such
as the translation of the action name within the lang available in the
fields of the form view (e.g. the partner form).

Initially, the field values added in the context has been added
within the rev. 542928adde
Indeed, sidebar_context (or sidebar_eval_context nowadays), contains
the field values, and the additional_context passed to /web/action/load
is an extension of this sidebar_context.
We are not sure the reasons why the sidebar_context was passed to the
/web/action/load, but we believe it was to pass the session/user context
containing the lang, timezone, and so on, not to pass the fields values.
This commit is contained in:
Denis Ledoux 2015-02-20 15:24:18 +01:00
parent 7f5bc3fdf0
commit 27a48f8026
2 changed files with 4 additions and 3 deletions

View File

@ -1422,7 +1422,7 @@ class Action(openerpweb.Controller):
except Exception:
action_id = 0 # force failed read
base_action = Actions.read([action_id], ['name', 'type'], req.session.get_context())
base_action = Actions.read([action_id], ['type'], req.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, dict(action[0], **base_action[0]))
value = clean_action(req, action[0])
return value
@openerpweb.jsonrequest

View File

@ -1220,7 +1220,8 @@ instance.web.Sidebar = instance.web.Widget.extend({
sidebar_eval_context, active_ids_context));
self.rpc("/web/action/load", {
action_id: item.action.id,
context: c
context: new instance.web.CompoundContext(
self.dataset.get_context(), active_ids_context).eval()
}).done(function(result) {
result.context = new instance.web.CompoundContext(
result.context || {}, active_ids_context)