summaryrefslogtreecommitdiff
path: root/addons/snailmail/static/src/xml/thread.xml
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2020-04-17 09:53:05 +0000
committerSébastien Theys <seb@odoo.com>2020-04-17 12:17:57 +0000
commitdea52493b819939ae16391d8b19c2f404c7ec143 (patch)
treeda5729bab3ff9bc36825480f54c838b17fced580 /addons/snailmail/static/src/xml/thread.xml
parent69b51ce05e855b2b95e75919ac97996a1ff5e136 (diff)
[IMP] mail, sms, snailmail, test_mail_full: adapt mail.notification
The purpose is to have more common code for failure and notifications, with less override in `sms` and `snailmail`. task-2176017 closes odoo/odoo#44170 Related: odoo/enterprise#9140 Related: odoo/upgrade#918 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/snailmail/static/src/xml/thread.xml')
-rw-r--r--addons/snailmail/static/src/xml/thread.xml68
1 files changed, 40 insertions, 28 deletions
diff --git a/addons/snailmail/static/src/xml/thread.xml b/addons/snailmail/static/src/xml/thread.xml
index aeda07445be..df3ae1e08d4 100644
--- a/addons/snailmail/static/src/xml/thread.xml
+++ b/addons/snailmail/static/src/xml/thread.xml
@@ -1,37 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<template id="template" xml:space="preserve">
- <t t-extend="mail.widget.Thread.Message">
- <t t-jquery=".o_thread_tooltip_container" t-operation="after">
- <span t-if="message.getType() === 'snailmail' and options.displaySnailmailIcons" class="o_thread_snailmail_tooltip_container">
- <t t-set="thread_icon_class" t-value="'o_thread_snailmail_tooltip o_thread_message_snailmail o_thread_message_snailmail_' + message.getSnailmailStatus()" />
- <t t-if="message.getSnailmailError()">
- <t t-set="thread_icon_class" t-value="thread_icon_class + ' o_thread_message_snailmail_error'"/>
- </t>
- <i t-att-class="thread_icon_class + ' fa fa-paper-plane'" t-att-data-message-id="message.getID()"/>
- </span>
- </t>
+ <t t-inherit="mail.widget.Thread.Message" t-inherit-mode="extension">
+ <xpath expr="//span[@name='notification_icon']" position="attributes">
+ <!--
+ Messages from snaimail are considered to have at most one notification.
+ The failure type of the whole message is considered to be the same as the one from
+ that first notification, and the click action will depend on it.
+ -->
+ <attribute name="t-att-data-failure-type">message.getNotifications()[0].failure_type</attribute>
+ </xpath>
</t>
- <t t-name="snailmail.widget.Thread.Message.SnailmailTooltip">
- <span class="d-inline-block text-center o_thread_tooltip_snailmail">
- <t t-if="status === 'sent'">
- <i class='fa fa-check o_thread_tooltip_snailmail_icon' title="Sent" role="img" aria-label="Sent"/>
- Sent
+ <t t-inherit="mail.widget.Thread.Message.MailTooltip" t-inherit-mode="extension">
+ <!--
+ It was decided that the information displayed for snaimail messages has to be
+ different than for standard messages, see task-1907998.
+ -->
+ <xpath expr="//span[@name='notification_status']" position="replace">
+ <t t-if="notification.notification_type === 'snail'">
+ <span class="d-inline-block text-center o_thread_tooltip_icon">
+ <t t-if="notification.notification_status === 'sent'">
+ <i class="fa fa-check o_thread_tooltip_snailmail_icon" title="Sent" role="img" aria-label="Sent"/>
+ Sent
+ </t>
+ <t t-elif="notification.notification_status === 'canceled'">
+ <i class="fa fa-trash-o o_thread_tooltip_snailmail_icon" title="Canceled" role="img" aria-label="Canceled"/>
+ Canceled
+ </t>
+ <t t-elif="notification.notification_status === 'ready'">
+ <i class="fa fa-clock-o o_thread_tooltip_snailmail_icon" title="Awaiting Dispatch" role="img" aria-label="Awaiting Dispatch"/>
+ Awaiting Dispatch
+ </t>
+ <t t-else="">
+ <i class="fa fa-exclamation text-danger o_thread_tooltip_snailmail_icon" title="Error" role="img" aria-label="Error"/>
+ Error
+ </t>
+ </span>
</t>
- <t t-elif="status === 'canceled'">
- <i class='fa fa-trash-o o_thread_tooltip_snailmail_icon' title="Canceled" role="img" aria-label="Canceled"/>
- Canceled
- </t>
- <t t-elif="status === 'pending'">
- <i class='fa fa-clock-o o_thread_tooltip_snailmail_icon' title="Awaiting Dispatch" role="img" aria-label="Awaiting Dispatch"/>
- Awaiting Dispatch
- </t>
- <t t-else="">
- <i class='fa fa-exclamation text-danger o_thread_tooltip_snailmail_icon' title="Error" role="img" aria-label="Error"/>
- Error
- </t>
- </span>
+ <t t-else="">$0</t>
+ </xpath>
+ <xpath expr="//span[@name='partner_name']" position="replace">
+ <t t-if="notification.notification_type === 'snail'"></t>
+ <t t-else="">$0</t>
+ </xpath>
</t>
</template>