Only duplicate emails used to be checked when sending a mass mail. However it is possible (e.g. using templates) to send a mass mail to the same person containing different information. The existing functions to allow models to specify emails processed in the past by some other means are kept. A new check is added in the processing that checks the full contents of the message, subject and attachment ids. The strings are not hashed as most situations are: - Sending the exact same mail to everyone -> Only need to check against one message -> Same complexity as hashing - Sending all different emails -> Checking inequality of str is usually very fast For attachments, as we cannot compare them easily. They are ignored for the purpose of equating emails whenever there are the same number of attachments in the email values as there are on the composer. This is because each email should receive its own copy of the composer attachments. If they have a different number of attachments, they were generated dynamically through reports and we assume they are all different. We can thus remove the 'document based' information as it is implicitly infered from this check. ------------------------- Test utils are also updated for two purposes: 1. Add optional body and attachment_name discriminents assertMailMail assumed all emails could at least be differentiated by subject. Our test breaks that assumption, so we use body and attachment to find the best-fitting email based on the data passed in. 2. Check email_formatted on recipients When using assertMailMailWEmails, we first find the email using the non-formatted email of the recipient. This does not match assertSentMail which checks against the raw email_to value, which would often be formatted. Task-2826811 closes odoo/odoo#99541 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
65 lines
2.5 KiB
XML
65 lines
2.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<record id="mail_test_ticket_tracking_tpl" model="mail.template">
|
|
<field name="name">Mail Test Full: Tracking Template</field>
|
|
<field name="subject">Test Template</field>
|
|
<field name="partner_to">{{ object.customer_id.id }}</field>
|
|
<field name="body_html" type="html"><p>Hello <t t-out="object.name or ''"></t></p></field>
|
|
<field name="model_id" ref="test_mail.model_mail_test_ticket"/>
|
|
<field name="auto_delete" eval="True"/>
|
|
</record>
|
|
|
|
<record id="mail_test_container_tpl" model="mail.template">
|
|
<field name="name">Mail Test: Template</field>
|
|
<field name="subject">Post on {{ object.name }}</field>
|
|
<field name="partner_to">{{ object.customer_id.id }}</field>
|
|
<field name="body_html" type="html"><p>Adding stuff on <t t-out="object.name or ''"></t></p></field>
|
|
<field name="model_id" ref="test_mail.model_mail_test_container"/>
|
|
<field name="auto_delete" eval="True"/>
|
|
</record>
|
|
|
|
<template id="mail_test_ticket_tracking_view">
|
|
<p><span t-out="object.name or ''"/> datetime has been updated to <span t-out="object.datetime or ''"/></p>
|
|
</template>
|
|
|
|
<template id="mail_test_ticket_test_template">
|
|
<t t-call="web.html_container">
|
|
<t t-set="o" t-value="res_company"/>
|
|
<t t-call="web.external_layout">
|
|
<div class="page">
|
|
<p>This is a sample of an external report.</p>
|
|
</div>
|
|
</t>
|
|
</t>
|
|
</template>
|
|
|
|
<template id="mail_test_ticket_test_template_2">
|
|
<t t-call="web.html_container">
|
|
<t t-set="o" t-value="res_company"/>
|
|
<t t-call="web.external_layout">
|
|
<div class="page">
|
|
<p>This is another sample of an external report.</p>
|
|
</div>
|
|
</t>
|
|
</t>
|
|
</template>
|
|
|
|
<template id="mail_test_ticket_test_variable_template">
|
|
<t t-call="web.html_container">
|
|
<t t-foreach="docs" t-as="ticket">
|
|
<t t-call="web.external_layout">
|
|
<div class="page">
|
|
<p>This is a sample of an external report for a ticket for
|
|
<span t-out="ticket.count"></span> people.</p>
|
|
</div>
|
|
</t>
|
|
</t>
|
|
</t>
|
|
</template>
|
|
|
|
<template id="mail_template_simple_test">
|
|
<p>Hello <t t-out="partner.name"/>, this comes from <t t-out="object.name"/>.</p>
|
|
</template>
|
|
|
|
</odoo>
|