Skip to content

Commit

Permalink
[ADD]mail_chatter_company_tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
adasatorres committed Dec 6, 2024
1 parent e880169 commit eb208f3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
16 changes: 4 additions & 12 deletions mail_chatter_company_tracking/models/mail_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -27,5 +20,4 @@ def _message_format(self, fnames):
),
}
)
vals_list[pos]["tracking_value_ids"] = tracking_value_ids
return vals_list
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-name="Message" t-inherit="mail.Message" t-inherit-mode="extension" owl="1">
<xpath expr="//div[hasclass('o_Message_trackingValueFieldName')]" position="before">
<t t-log="value" />
<div
<t t-name="Message" t-inherit="mail.Message" t-inherit-mode="extension" owl="1">
<xpath
expr="//div[hasclass('o_Message_trackingValueFieldName')]"
position="before"
>
<t t-log="value" />
<div
t-if="value.company_name"
class="o_Message_trackingValueFieldCompanyName o_Message_trackingValueItem"
>
<span style="font-weight:bold;">
(
<span t-esc="value.company_name" />)
</span>
</div>
</xpath>
</t>
<span style="font-weight:bold;">
<!-- prettier-ignore-start -->
(<span t-esc="value.company_name"/>)
<!-- prettier-ignore-end -->
</span>
</div>
</xpath>
</t>
</templates>

0 comments on commit eb208f3

Please sign in to comment.