From 4705e30d0bfb3753b242b627a3d4188d847686a2 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 31 May 2011 21:52:02 +0200 Subject: [PATCH] [FIX] Fixed load() in action controller. Was not calling clean_action() bzr revid: fme@openerp.com-20110531195202-6z6veclumppp1mlr --- addons/base/controllers/main.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/addons/base/controllers/main.py b/addons/base/controllers/main.py index 70feda44bc0..35289e487af 100644 --- a/addons/base/controllers/main.py +++ b/addons/base/controllers/main.py @@ -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}