[FIX] base_automation: impossible to execute an action with unlink
- Create two record with state == 'one' and with activities - Create an automated action if state == 'two' then record.sudo().activity_ids.action_done() - Set state == 'two' in same time of two record In the loop line 261, for the first record self.action_record_id is in cache, but for the second record it is not in cache because of the unlink made by action_done(). When the orm raise during put in cache because he have no access to self. closes odoo/odoo#82574 X-original-commit: 2207d8adbd37c6758f350cced68f285f8960c3aa Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com> Signed-off-by: Raphael Collet <rco@odoo.com>
This commit is contained in:
committed by
GitHub
parent
90f411ea03
commit
29b1ecb416
@@ -256,7 +256,8 @@ class BaseAutomation(models.Model):
|
||||
records.write(values)
|
||||
|
||||
# execute server actions
|
||||
if self.action_server_id:
|
||||
action_server = self.action_server_id
|
||||
if action_server:
|
||||
for record in records:
|
||||
# we process the action if any watched field has been modified
|
||||
if self._check_trigger_fields(record):
|
||||
@@ -267,7 +268,7 @@ class BaseAutomation(models.Model):
|
||||
'domain_post': domain_post,
|
||||
}
|
||||
try:
|
||||
self.action_server_id.sudo().with_context(**ctx).run()
|
||||
action_server.sudo().with_context(**ctx).run()
|
||||
except Exception as e:
|
||||
self._add_postmortem_action(e)
|
||||
raise e
|
||||
|
||||
Reference in New Issue
Block a user