[FIX] base_action_rule: Make sure model exists before trying to wrap hooks
In certain cases, before running an update unregistered models will try to register hooks. Trying to wrap create and write on these will cause AttributeError on model_obj which would be None Signed-off-by: Sandy Carter <sandy.carter@savoirfairelinux.com>
This commit is contained in:
parent
2b2ec07435
commit
1661cf53e9
|
@ -199,7 +199,7 @@ class base_action_rule(osv.osv):
|
|||
for action_rule in self.browse(cr, SUPERUSER_ID, ids):
|
||||
model = action_rule.model_id.model
|
||||
model_obj = self.pool.get(model)
|
||||
if not hasattr(model_obj, 'base_action_ruled'):
|
||||
if model_obj and not hasattr(model_obj, 'base_action_ruled'):
|
||||
model_obj.create = self._wrap_create(model_obj.create, model)
|
||||
model_obj.write = self._wrap_write(model_obj.write, model)
|
||||
model_obj.base_action_ruled = True
|
||||
|
|
Loading…
Reference in New Issue