[FIX] Fixed load() in action controller. Was not calling clean_action()

bzr revid: fme@openerp.com-20110531195202-6z6veclumppp1mlr
This commit is contained in:
Fabien Meghazi 2011-05-31 21:52:02 +02:00
parent e38e5f735d
commit 4705e30d0b
1 changed files with 9 additions and 5 deletions

View File

@ -241,7 +241,10 @@ def clean_action(action, session):
action['domain'],
session.evaluation_context(
action['context'])) or []
fix_view_modes(action)
if not action.has_key('flags'):
# Set empty flags dictionary for web client.
action['flags'] = dict()
return fix_view_modes(action)
def fix_view_modes(action):
""" For historical reasons, OpenERP has weird dealings in relation to
@ -271,6 +274,7 @@ def fix_view_modes(action):
[id, mode if mode != 'tree' else 'list']
for id, mode in action['views']
]
return action
class Menu(openerpweb.Controller):
_cp_path = "/base/menu"
@ -707,12 +711,12 @@ class Action(openerpweb.Controller):
_cp_path = "/base/action"
@openerpweb.jsonrequest
def load(self, req, action_id, context={}):
def load(self, req, action_id):
Actions = req.session.model('ir.actions.actions')
value = False
action_type = Actions.read([action_id], ['type'], context)
action_type = Actions.read([action_id], ['type'], req.session.context)
if action_type:
action = req.session.model(action_type[0]['type']).read([action_id], False, context)
action = req.session.model(action_type[0]['type']).read([action_id], False, req.session.context)
if action:
value = action[0]
value = clean_action(action[0], req.session)
return {'result': value}