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>
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