[IMP]: board: Add new field menu_id: many2one (ir.ui.menu) in dashboard.

bzr revid: atp@tinyerp.co.in-20100513151810-pe2jtw3dyay6iqt6
This commit is contained in:
atp (Open ERP)
2010-05-13 20:48:10 +05:30
parent ea1054ec45
commit 55d7925b31
4 changed files with 22 additions and 15 deletions
+2 -1
View File
@@ -143,7 +143,8 @@ class board_board(osv.osv):
_columns = {
'name': fields.char('Dashboard', size=64, required=True),
'view_id': fields.many2one('ir.ui.view', 'Board View'),
'line_ids': fields.one2many('board.board.line', 'board_id', 'Action Views')
'line_ids': fields.one2many('board.board.line', 'board_id', 'Action Views'),
'menu_id':fields.many2one('ir.ui.menu', 'Menu', required=False),
}
# the following lines added to let the button on dashboard work.
+8 -5
View File
@@ -66,11 +66,14 @@
<field eval="1" name="priority"/>
<field name="arch" type="xml">
<form string="Dashboard">
<field name="name" select="1"/>
<button colspan="2"
name="%(action_board_menu_create)d"
string="Create Menu" type="action"
icon="gtk-justify-fill" />
<group col="6" colspan="4">
<field name="name" select="1" />
<field name="menu_id" colspan="2"/>
<button
name="%(action_board_menu_create)d"
string="Create Menu" type="action"
icon="gtk-justify-fill" attrs="{'invisible':[('menu_id','!=',False)]}"/>
</group>
<field colspan="4" name="line_ids" nolabel="1">
<tree string="Dashboard View">
<field name="name"/>
+9 -6
View File
@@ -69,14 +69,17 @@ class board_menu_create(osv.osv_memory):
'view_id': board.view_id.id,
})
obj_menu = self.pool.get('ir.ui.menu')
obj_board = self.pool.get('board.board')
#start Loop
for data in self.read(cr, uid, ids):
obj_menu.create(cr, uid, {
'name': data.get('menu_name'),
'parent_id': data.get('menu_parent_id'),
'icon': 'STOCK_SELECT_COLOR',
'action': 'ir.actions.act_window,' + str(action_id)
}, context=context)
id = obj_menu.create(cr, uid, {
'name': data.get('menu_name'),
'parent_id': data.get('menu_parent_id'),
'icon': 'STOCK_SELECT_COLOR',
'action': 'ir.actions.act_window,' + str(action_id)
}, context=context)
obj_board.write(cr, uid, [context_id], { "menu_id": id})
#End Loop
return {}
@@ -18,9 +18,9 @@
<separator string="" colspan="4" />
<group colspan="4" col="6">
<label string=" " colspan="2"/>
<button icon="gtk-cancel" special="cancel"
string="Cancel" />
<button icon="gtk-save" string="Create Menu"
<button icon="gtk-close" special="cancel"
string="Close" />
<button icon="gtk-ok" string="Create"
name="board_menu_create" type="object" />
</group>
</form>