diff --git a/openerp/addons/base/__openerp__.py b/openerp/addons/base/__openerp__.py index 173c6adcbc4..69552a61f72 100644 --- a/openerp/addons/base/__openerp__.py +++ b/openerp/addons/base/__openerp__.py @@ -42,6 +42,7 @@ The kernel of OpenERP, needed for all installation. 'res/res_security.xml', 'res/res_config.xml', 'data/res.country.state.csv', + 'ir/wizard/wizard_menu_view.xml', 'ir/ir.xml', 'ir/ir_translation_view.xml', 'ir/ir_filters.xml', diff --git a/openerp/addons/base/ir/__init__.py b/openerp/addons/base/ir/__init__.py index c296042e3b2..bc4f3eecfbf 100644 --- a/openerp/addons/base/ir/__init__.py +++ b/openerp/addons/base/ir/__init__.py @@ -36,6 +36,7 @@ import ir_translation import ir_exports import workflow import ir_rule +import wizard import ir_config_parameter import osv_memory_autovacuum import ir_mail_server diff --git a/openerp/addons/base/ir/wizard/__init__.py b/openerp/addons/base/ir/wizard/__init__.py new file mode 100644 index 00000000000..23cc77e8c15 --- /dev/null +++ b/openerp/addons/base/ir/wizard/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +import wizard_menu +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/openerp/addons/base/ir/wizard/wizard_menu.py b/openerp/addons/base/ir/wizard/wizard_menu.py new file mode 100644 index 00000000000..17f0fc13f1d --- /dev/null +++ b/openerp/addons/base/ir/wizard/wizard_menu.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +from osv import fields,osv + +class wizard_model_menu(osv.osv_memory): + _name = 'wizard.ir.model.menu.create' + _columns = { + 'menu_id': fields.many2one('ir.ui.menu', 'Parent Menu', required=True), + 'name': fields.char('Menu Name', size=64, required=True), + } + + def menu_create(self, cr, uid, ids, context=None): + if not context: + context = {} + model_pool = self.pool.get('ir.model') + for menu in self.browse(cr, uid, ids, context): + model = model_pool.browse(cr, uid, context.get('model_id'), context=context) + val = { + 'name': menu.name, + 'res_model': model.model, + 'view_type': 'form', + 'view_mode': 'tree,form' + } + action_id = self.pool.get('ir.actions.act_window').create(cr, uid, val) + self.pool.get('ir.ui.menu').create(cr, uid, { + 'name': menu.name, + 'parent_id': menu.menu_id.id, + 'action': 'ir.actions.act_window,%d' % (action_id,), + 'icon': 'STOCK_INDENT' + }, context) + return {'type':'ir.actions.act_window_close'} + + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/openerp/addons/base/ir/wizard/wizard_menu_view.xml b/openerp/addons/base/ir/wizard/wizard_menu_view.xml new file mode 100644 index 00000000000..7fd32b256e2 --- /dev/null +++ b/openerp/addons/base/ir/wizard/wizard_menu_view.xml @@ -0,0 +1,23 @@ + + + + + Create Menu + wizard.ir.model.menu.create + +
+ + + + +
+
+
+
+
+ +
+