Browse Source

mail_digest: display mail tracking values

Prior to this change we could have digest messages w/ no content.
Now we display mail tracking values if any.
pull/273/head
Simone Orsi 7 years ago
parent
commit
ef91aafbfb
  1. 6
      mail_digest/controllers/digest_layout_preview.py
  2. 12
      mail_digest/templates/digest_default.xml

6
mail_digest/controllers/digest_layout_preview.py

@ -92,7 +92,6 @@ class DigestPreview(http.Controller):
msg.subtype_id = subtype
subject, body = self._fake_content(subtype, i, x)
msg.subject = subject
msg.body = body
msg.message_type = random.choice(
('email', 'comment', 'notification'))
msg.email_from = 'random@user%d.com' % i
@ -101,6 +100,11 @@ class DigestPreview(http.Controller):
# relate a document
msg.model = records._name
msg.res_id = random.choice(records.ids)
# simulate messages w/ no body but tracking values
if x == random.choice([1, 2]):
msg.tracking_value_ids = self._fake_tracking_vals()
else:
msg.body = body
messages += msg
return messages

12
mail_digest/templates/digest_default.xml

@ -43,6 +43,18 @@
<div class="message-wrapper"
t-attf-style="margin:0 10px;padding:5px 10px;#{not msg_first and 'border-top:1px solid #ccc'}">
<t t-raw="digest.message_body(msg)" />
<t t-if="msg.tracking_value_ids">
<h4>Changed values</h4>
<ul class="tracking-values">
<t t-foreach="msg.tracking_value_ids" t-as="tracked">
<li>
<strong class="fname"><span t-field="tracked.field_desc" />:</strong>
<span class="fvalue-old" t-esc="tracked.get_old_display_value()[0]" /> &#8594;
<span class="fvalue-new" t-esc="tracked.get_new_display_value()[0]" />
</li>
</t>
</ul>
</t>
</div>
</t>
</div>

Loading…
Cancel
Save