diff --git a/addons/base_automation/models/base_automation.py b/addons/base_automation/models/base_automation.py index 0d1e5604f88..77be0ddc76d 100644 --- a/addons/base_automation/models/base_automation.py +++ b/addons/base_automation/models/base_automation.py @@ -304,6 +304,8 @@ class BaseAutomation(models.Model): def create(self, vals_list, **kw): # retrieve the action rules to possibly execute actions = self.env['base.automation']._get_actions(self, ['on_create', 'on_create_or_write']) + if not actions: + return create.origin(self, vals_list, **kw) # call original method records = create.origin(self.with_env(actions.env), vals_list, **kw) # check postconditions, and execute actions on the records that satisfy them @@ -318,6 +320,8 @@ class BaseAutomation(models.Model): def write(self, vals, **kw): # retrieve the action rules to possibly execute actions = self.env['base.automation']._get_actions(self, ['on_write', 'on_create_or_write']) + if not (actions and self): + return write.origin(self, vals, **kw) records = self.with_env(actions.env) # check preconditions on records pre = {action: action._filter_pre(records) for action in actions} @@ -349,6 +353,9 @@ class BaseAutomation(models.Model): # retrieve the action rules to possibly execute actions = self.env['base.automation']._get_actions(self, ['on_write', 'on_create_or_write']) records = self.filtered('id').with_env(actions.env) + if not (actions and records): + _compute_field_value.origin(self, field) + return True # check preconditions on records pre = {action: action._filter_pre(records) for action in actions} # read old values before the update