[correction]Behaviour of create menu wizard of dashboard
authorJay (Open ERP) <jvo@tinyerp.com>
Thu, 1 Jan 2009 09:57:06 +0000 (15:27 +0530)
committerJay (Open ERP) <jvo@tinyerp.com>
Thu, 1 Jan 2009 09:57:06 +0000 (15:27 +0530)
bzr revid: jvo@tinyerp.com-20090101095706-z7kxzeqnq83l1lpm

addons/board/wizard/board_wizard.py

index c65ad7e..191cb3f 100644 (file)
@@ -38,9 +38,17 @@ section_fields = {
     'menu_parent_id': {'string':'Parent Menu', 'type':'many2one', 'relation':'ir.ui.menu', 'required':True},
 }
 
+def check_views(self, cr, uid, data, context):
+    pool = pooler.get_pool(cr.dbname)
+    board = pool.get('board.board').browse(cr, uid, data['id'])
+    if not board.line_ids:
+        raise wizard.except_wizard('User Error!',"Please Insert Dashboard View(s) !")    
+    return data['form']
+
 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',
@@ -54,12 +62,13 @@ def board_menu_create(self, cr, uid, data, context):
         'icon': 'STOCK_SELECT_COLOR',
         'action': 'ir.actions.act_window,'+str(action_id)
     }, context)
+        
     return {}
 
 class wizard_section_menu_create(wizard.interface):
     states = {
         'init': {
-            'actions': [], 
+            'actions': [check_views], 
             'result': {'type':'form', 'arch':section_form, 'fields':section_fields, 'state':[('end','Cancel'),('create_menu','Create Menu')]}
         },
         'create_menu': {