From ef0f9556f8d29502bb4794e44aec01b86e290047 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Sat, 22 Sep 2018 21:02:28 +0000 Subject: [PATCH] [FIX] base: action - fix on_change on new record Before this commit, if you create an automated action with trigger 'on_change' it was not called because the run() function don't have active_id. Now if we have onchange_self in the context but not active id, we call the function nevertheless. (withtout active_id in context!) closes odoo/odoo#27167 --- odoo/addons/base/ir/ir_actions.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/odoo/addons/base/ir/ir_actions.py b/odoo/addons/base/ir/ir_actions.py index bacca6d78d3..81febad8e38 100644 --- a/odoo/addons/base/ir/ir_actions.py +++ b/odoo/addons/base/ir/ir_actions.py @@ -557,6 +557,9 @@ class IrActionsServer(models.Model): active_id = self._context.get('active_id') if not active_id and self._context.get('onchange_self'): active_id = self._context['onchange_self']._origin.id + if not active_id: # onchange on new record + func = getattr(self, 'run_action_%s' % action.state) + res = func(action, eval_context=eval_context) active_ids = self._context.get('active_ids', [active_id] if active_id else []) for active_id in active_ids: # run context dedicated to a particular active_id