[FIX] ir_attachment: ignore if model uninstalled
authorDenis Ledoux <dle@odoo.com>
Mon, 8 Sep 2014 08:49:56 +0000 (10:49 +0200)
committerDenis Ledoux <dle@odoo.com>
Mon, 8 Sep 2014 08:51:46 +0000 (10:51 +0200)
if the model of an attachement no longer exists (the according module have been uninstalled, for instance), ignore the security check

openerp/addons/base/ir/ir_attachment.py

index 2c0af45..19c6663 100644 (file)
@@ -205,6 +205,8 @@ class ir_attachment(osv.osv):
         for model, mids in res_ids.items():
             # ignore attachments that are not attached to a resource anymore when checking access rights
             # (resource was deleted but attachment was not)
+            if not self.pool.get(model):
+                continue
             mids = self.pool.get(model).exists(cr, uid, mids)
             ima.check(cr, uid, model, mode)
             self.pool.get(model).check_access_rule(cr, uid, mids, mode, context=context)