[IMP] mail: avoid getting field description

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) <xdo@odoo.com>
This commit is contained in:
Xavier-Do
2023-09-11 19:13:58 +00:00
parent 0903ef7bb2
commit 7b6704413f
+2 -2
View File
@@ -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: