From 5350c6576a48c81af5ebd1d3c274871a2b45879a Mon Sep 17 00:00:00 2001 From: "Antoine Vandevenne (anv)" Date: Tue, 24 Sep 2019 10:20:58 +0000 Subject: [PATCH] [FIX] base_automation: prevent automations from triggering on new records MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, automations triggering on new records caused onchanges to break out-of-context record rules, hence preventing to create the record. This commit filters out new records from the list of records matched by the domain of an automation. task-1998636 closes odoo/odoo#37360 Signed-off-by: Damien Bouvy (dbo) Co-authored-by: Raphaƫl Collet --- addons/base_automation/models/base_automation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/base_automation/models/base_automation.py b/addons/base_automation/models/base_automation.py index 77bd9386d0e..a84966906ae 100644 --- a/addons/base_automation/models/base_automation.py +++ b/addons/base_automation/models/base_automation.py @@ -290,7 +290,7 @@ class BaseAutomation(models.Model): if not field.store: return _compute_field_value.origin(self, field) actions = self.env['base.automation']._get_actions(self, ['on_write', 'on_create_or_write']) - records = self.with_env(actions.env) + records = self.filtered('id').with_env(actions.env) # check preconditions on records pre = {action: action._filter_pre(records) for action in actions} # read old values before the update