From 1661cf53e9b30dabaa5658906b68b3a1d25599b7 Mon Sep 17 00:00:00 2001 From: Sandy Carter Date: Thu, 23 Oct 2014 17:45:55 -0400 Subject: [PATCH] [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 --- addons/base_action_rule/base_action_rule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/base_action_rule/base_action_rule.py b/addons/base_action_rule/base_action_rule.py index 98d533b3b6d..398bf00286a 100644 --- a/addons/base_action_rule/base_action_rule.py +++ b/addons/base_action_rule/base_action_rule.py @@ -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