From eb208f3dbfea44026e90106979c8d40d8e33af4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adasat=20Torres=20de=20Le=C3=B3n?= Date: Fri, 6 Dec 2024 17:08:47 +0000 Subject: [PATCH] [ADD]mail_chatter_company_tracking --- .../models/mail_message.py | 16 +++--------- .../static/src/components/message/message.xml | 26 +++++++++++-------- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/mail_chatter_company_tracking/models/mail_message.py b/mail_chatter_company_tracking/models/mail_message.py index 137574f0d5..c9028233a1 100644 --- a/mail_chatter_company_tracking/models/mail_message.py +++ b/mail_chatter_company_tracking/models/mail_message.py @@ -6,18 +6,11 @@ class Message(models.Model): def _message_format(self, fnames): vals_list = super()._message_format(fnames) - for pos, vals in enumerate(vals_list): - tracking_ids = map(lambda x: x.get("id"), vals["tracking_value_ids"]) - trackings = self.env["mail.tracking.value"].browse(tracking_ids) - tracking_value_ids = [] - for tracking in trackings: - tracking_value_ids.append( + for vals in vals_list: + for tracking_value in vals["tracking_value_ids"]: + tracking = self.env["mail.tracking.value"].browse(tracking_value["id"]) + tracking_value.update( { - "id": tracking.id, - "changed_field": tracking.field_desc, - "old_value": tracking.get_old_display_value()[0], - "new_value": tracking.get_new_display_value()[0], - "field_type": tracking.field_type, "company_name": ( tracking.company_id.name if self.env[tracking.field.model] @@ -27,5 +20,4 @@ def _message_format(self, fnames): ), } ) - vals_list[pos]["tracking_value_ids"] = tracking_value_ids return vals_list diff --git a/mail_chatter_company_tracking/static/src/components/message/message.xml b/mail_chatter_company_tracking/static/src/components/message/message.xml index c08dc8f7c1..8ca7d3a6e9 100644 --- a/mail_chatter_company_tracking/static/src/components/message/message.xml +++ b/mail_chatter_company_tracking/static/src/components/message/message.xml @@ -1,17 +1,21 @@ - - - -
+ + +
- - ( - ) - -
-
- + + + () + + +
+
+