From 5da3a758fc33dcbca17de1a38a3bebf578b58f8d Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Wed, 18 Nov 2015 09:24:17 +0100 Subject: [PATCH] [IMP] base_action_rule: add `old_values=None` in context of actions done on create In particular, when an automated action is defined on "create or update", setting `old_values` to `None` allows to distinguish between a create and an update. Note that not setting `old_values` at all may be confusing: on a create, it may be present because of an outer update... --- 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 7d229ce5bca..3201d9b9381 100644 --- a/addons/base_action_rule/base_action_rule.py +++ b/addons/base_action_rule/base_action_rule.py @@ -226,7 +226,7 @@ class base_action_rule(osv.osv): record = create.origin(self.with_env(actions.env), vals) # check postconditions, and execute actions on the records that satisfy them - for action in actions: + for action in actions.with_context(old_values=None): action._process(action._filter_post(record)) return record.with_env(self.env)