From a98f0af9e26b916fde5e305a10cb30615a1fe5b2 Mon Sep 17 00:00:00 2001 From: Arnaud Joset Date: Fri, 7 Feb 2020 07:44:55 +0000 Subject: [PATCH] [FIX] mail: _finalize_tracking was not properly flushed Before this commit, no recompulation were performed at the end of the tracking procedure. This is because the main flush() occurred before the tracking of values. The absence of flushing is problematic in the case where the tracking is used to create/update records. closes odoo/odoo#44851 X-original-commit: c60da49a1d81fa73b60135185d5b706eec771475 Signed-off-by: Raphael Collet (rco) --- addons/mail/models/mail_thread.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index b36a866ca5f..55b1c12aeef 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -467,6 +467,9 @@ class MailThread(models.AbstractModel): for record in records: changes, tracking_value_ids = tracking.get(record.id, (None, None)) record._message_track_post_template(changes) + # this method is called after the main flush() and just before commit(); + # we have to flush() again in case we triggered some recomputations + self.flush() def with_lang(self): if not self._context.get("lang"):