From 33f70eaac2fe626038036b798de29daf1bb551ef Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Wed, 20 Apr 2011 16:58:10 +0200 Subject: [PATCH] [IMP] move method create_menu_action() to where it is used bzr revid: rco@openerp.com-20110420145810-2tdtnrkf6z7nkzgy --- addons/portal/portal.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/addons/portal/portal.py b/addons/portal/portal.py index b8843c71a3b..5775a9b9bc3 100644 --- a/addons/portal/portal.py +++ b/addons/portal/portal.py @@ -90,25 +90,6 @@ class portal(osv.osv): return True - def create_menu_action(self, cr, uid, id, context=None): - """ create, if necessary, a menu action that opens the menu items below - parent_menu_id """ - p = self.browse(cr, uid, id, context) - if not p.menu_action_id: - actions_obj = self.pool.get('ir.actions.act_window') - parent_id = p.parent_menu_id.id if p.parent_menu_id else False - action_values = { - 'name': p.name + ' Menu', - 'type': 'ir.actions.act_window', - 'usage': 'menu', - 'res_model': 'ir.ui.menu', - 'view_type': 'tree', - 'view_id': self._res_xml_id(cr, uid, 'base', 'view_menu'), - 'domain': [('parent_id', '=', parent_id)], - } - action_id = actions_obj.create(cr, uid, action_values, context) - self.write(cr, uid, [id], {'menu_action_id': action_id}, context) - def do_create_menu(self, cr, uid, ids, context=None): """ create a parent menu for the given portals """ menu_obj = self.pool.get('ir.ui.menu') @@ -178,6 +159,25 @@ class portal_override_menu(osv.osv): else: self.write(cr, uid, [id], {'menu_action_id': False}, context) + def create_menu_action(self, cr, uid, id, context=None): + """ create, if necessary, a menu action that opens the menu items below + parent_menu_id """ + p = self.browse(cr, uid, id, context) + if not p.menu_action_id: + actions_obj = self.pool.get('ir.actions.act_window') + parent_id = p.parent_menu_id.id if p.parent_menu_id else False + action_values = { + 'name': p.name + ' Menu', + 'type': 'ir.actions.act_window', + 'usage': 'menu', + 'res_model': 'ir.ui.menu', + 'view_type': 'tree', + 'view_id': self._res_xml_id(cr, uid, 'base', 'view_menu'), + 'domain': [('parent_id', '=', parent_id)], + } + action_id = actions_obj.create(cr, uid, action_values, context) + self.write(cr, uid, [id], {'menu_action_id': action_id}, context) + _columns = { 'override_menu': fields.function( _get_override_menu, fnct_inv=_set_override_menu,