From ffa4549555f6697e22fc72c2fa9efa8cdb340eb2 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 7 Sep 2011 17:02:57 +0200 Subject: [PATCH] [IMP] cleanup toolbar actions bzr revid: xmo@openerp.com-20110907150257-ewan3jhboq0xe710 --- addons/web/controllers/main.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 225e55c0591..489445deb29 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -762,6 +762,8 @@ class View(openerpweb.Controller): fvg = Model.fields_view_get(view_id, view_type, context, toolbar, submenu) # todo fme?: check that we should pass the evaluated context here self.process_view(req.session, fvg, context, transform) + if toolbar and transform: + self.process_toolbar(req, fvg['toolbar']) return fvg def process_view(self, session, fvg, context, transform): @@ -793,6 +795,17 @@ class View(openerpweb.Controller): if field.get('context'): field["context"] = self.parse_context(field["context"], session) + def process_toolbar(self, req, toolbar): + """ + The toolbar is a mapping of section_key: [action_descriptor] + + We need to clean all those actions in order to ensure correct + round-tripping + """ + for section in toolbar.keys(): + toolbar[section] = [clean_action(req, action) + for action in toolbar[section]] + @openerpweb.jsonrequest def add_custom(self, req, view_id, arch): CustomView = req.session.model('ir.ui.view.custom')