From 7b6704413fecdf6d80bb93ce82257d1eda460ff1 Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Thu, 24 Aug 2023 10:23:19 +0200 Subject: [PATCH] [IMP] mail: avoid getting field description MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When calling track_prepare, an important part of the logic is getting description in fields_get. We actually don't need the description, fields_get is mainly use here to check for groups, but the dictionnary is immediately transformed to a set making values irrelevant. The same optimisation is done in _message_track, usefull to avoid an additionnal query in test_recurring_order_creation_perf, because of a value not in cache. closes odoo/odoo#134689 X-original-commit: a7e7f90531a21af99a4c95abb829f8f6de94f68a Signed-off-by: Xavier Dollé (xdo) --- addons/mail/models/mail_thread.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index 991f5bdb956..73c3e6f8c8b 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -542,7 +542,7 @@ class MailThread(models.AbstractModel): if getattr(field, 'tracking', None) or getattr(field, 'track_visibility', None) } - return model_fields and set(self.fields_get(model_fields)) + return model_fields and set(self.fields_get(model_fields, attributes=())) def _track_subtype(self, initial_values): """ Give the subtypes triggered by the changes on the record according @@ -571,7 +571,7 @@ class MailThread(models.AbstractModel): if not fields_iter: return {} - tracked_fields = self.fields_get(fields_iter) + tracked_fields = self.fields_get(fields_iter, attributes=('string', 'type', 'selection', 'currency_field')) tracking = dict() for record in self: try: