[IMP] cleanup toolbar actions

bzr revid: xmo@openerp.com-20110907150257-ewan3jhboq0xe710
This commit is contained in:
Xavier Morel 2011-09-07 17:02:57 +02:00
parent bc4485ef96
commit ffa4549555
1 changed files with 13 additions and 0 deletions

View File

@ -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')