diff options
| author | Fabien Pinckaers <fp@tinyerp.com> | 2007-12-18 21:58:15 +0000 |
|---|---|---|
| committer | Fabien Pinckaers <fp@tinyerp.com> | 2007-12-18 21:58:15 +0000 |
| commit | 645247af6f4cf1aeb80dd1102f8df88e3f7feddf (patch) | |
| tree | 7395983be4ab6384249f89728c27cc7070c70a89 /addons | |
| parent | cf526372c0cb7c8219e837223d01b3e6b7067983 (diff) | |
Adding Wizard to create new Dashboard Menu
bzr revid: fp@tinyerp.com-deaad809ab5ac750e348462b09356f29dfa875db
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/board/__init__.py | 1 | ||||
| -rw-r--r-- | addons/board/board_view.xml | 7 | ||||
| -rw-r--r-- | addons/board/wizard/__init__.py | 29 | ||||
| -rw-r--r-- | addons/board/wizard/board_wizard.py | 79 |
4 files changed, 116 insertions, 0 deletions
diff --git a/addons/board/__init__.py b/addons/board/__init__.py index ec2e9105012..adcce93eaa0 100644 --- a/addons/board/__init__.py +++ b/addons/board/__init__.py @@ -27,3 +27,4 @@ ############################################################################## import board +import wizard diff --git a/addons/board/board_view.xml b/addons/board/board_view.xml index 3a38d32f15a..7cb139dd6e0 100644 --- a/addons/board/board_view.xml +++ b/addons/board/board_view.xml @@ -40,6 +40,12 @@ sequence="100" id="menu_view_board_note_form"/> + <wizard + string="Create Board Menu" + model="board.board" + name="board.board.menu.create" + id="wizard_board_create_menu"/> + <record model="ir.ui.view" id="view_board_tree"> <field name="name">board.board.tree</field> @@ -59,6 +65,7 @@ <field name="arch" type="xml"> <form string="Dashboard"> <field name="name" select="1"/> + <button string="Create Menu" name="%(wizard_board_create_menu)d" type="action" colspan="2"/> <field name="line_ids" colspan="4"> <tree string="Dashboard View"> <field name="name"/> diff --git a/addons/board/wizard/__init__.py b/addons/board/wizard/__init__.py new file mode 100644 index 00000000000..f13e5ba15dd --- /dev/null +++ b/addons/board/wizard/__init__.py @@ -0,0 +1,29 @@ +############################################################################## +# +# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved. +# Fabien Pinckaers <fp@tiny.Be> +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +import board_wizard diff --git a/addons/board/wizard/board_wizard.py b/addons/board/wizard/board_wizard.py new file mode 100644 index 00000000000..28a3b80da07 --- /dev/null +++ b/addons/board/wizard/board_wizard.py @@ -0,0 +1,79 @@ +############################################################################## +# +# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved. +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + + +import time +import wizard +import osv +import pooler + +section_form = '''<?xml version="1.0"?> +<form string="Create Menu For Dashboard"> + <separator string="Menu Information" colspan="4"/> + <field name="menu_name"/> + <field name="menu_parent_id"/> +</form>''' + +section_fields = { + 'menu_name': {'string':'Menu Name', 'type':'char', 'required':True, 'size':64}, + 'menu_parent_id': {'string':'Parent Menu', 'type':'many2one', 'relation':'ir.ui.menu', 'required':True}, +} + +def board_menu_create(self, cr, uid, data, context): + pool = pooler.get_pool(cr.dbname) + board = pool.get('board.board').browse(cr, uid, data['id']) + action_id = pool.get('ir.actions.act_window').create(cr, uid, { + 'name': board.name, + 'view_type':'form', + 'view_mode':'form', + 'context': "{'view':%d}" % (board.id,), + 'res_model': 'board.board' + }) + pool.get('ir.ui.menu').create(cr, uid, { + 'name': data['form']['menu_name'], + 'parent_id': data['form']['menu_parent_id'], + 'icon': 'STOCK_SELECT_COLOR', + 'action': 'ir.actions.act_window,'+str(action_id) + }, context) + return {} + +class wizard_section_menu_create(wizard.interface): + states = { + 'init': { + 'actions': [], + 'result': {'type':'form', 'arch':section_form, 'fields':section_fields, 'state':[('end','Cancel'),('create_menu','Create Menu')]} + }, + 'create_menu': { + 'actions': [board_menu_create], + 'result': { + 'type':'state', + 'state':'end' + } + } + } +wizard_section_menu_create('board.board.menu.create') + |
