improvements
authorFabien Pinckaers <fp@tinyerp.com>
Mon, 16 Mar 2009 17:49:01 +0000 (18:49 +0100)
committerFabien Pinckaers <fp@tinyerp.com>
Mon, 16 Mar 2009 17:49:01 +0000 (18:49 +0100)
bzr revid: fp@tinyerp.com-20090316174901-45kppmfz1lz3b8fi

bin/addons/__init__.py
bin/addons/base/ir/ir_actions.py

index ca53964..ce8117f 100644 (file)
@@ -677,7 +677,8 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
 
             modobj = pool.get('ir.module.module')
             logger.notifyChannel('init', netsvc.LOG_INFO, 'updating modules list')
-            modobj.update_list(cr, 1)
+            if ('base' in tools.config['init']) or ('base' in tools.config['update']):
+                modobj.update_list(cr, 1)
 
             mods = [k for k in tools.config['init'] if tools.config['init'][k]]
             if mods:
index 312bd2d..64d0487 100644 (file)
@@ -140,26 +140,16 @@ class act_window(osv.osv):
     _name = 'ir.actions.act_window'
     _table = 'ir_act_window'
     _sequence = 'ir_actions_id_seq'
-
-#    def search(self, cr, uid, args, offset=0, limit=2000, order=None,
-#            context=None, count=False):
-#        if context is None:
-#            context = {}
-#        ids = osv.orm.orm.search(self, cr, uid, args, offset, limit, order,
-#                context=context)
-#        if uid==1:
-#            return ids
-#        user_groups = self.pool.get('res.users').read(cr, uid, [uid])[0]['groups_id']
-#        result = []
-#        for act in self.browse(cr, uid, ids):
-#            if not len(act.groups_id):
-#                result.append(act.id)
-#                continue
-#            for g in act.groups_id:
-#                if g.id in user_groups:
-#                    result.append(act.id)
-#                    break
-#        return result
+    def _check_model(self, cr, uid, ids, context={}):
+        for action in self.browse(cr, uid, ids, context):
+            if not self.pool.get(action.res_model):
+                return False
+            if action.src_model and not self.pool.get(action.src_model):
+                return False
+        return True
+    _constraints = [
+        (_check_model, 'Invalid model name in the action definition.', ['res_model','src_model'])
+    ]
 
     def _views_get_fnc(self, cr, uid, ids, name, arg, context={}):
         res={}