From a2403b0695b232fa8639b59f3d84c834ae7ee48b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 18 Jul 2018 11:08:35 +0200 Subject: [PATCH] [REF] purchase: clean send by email templates Purpose * use the new notification template allowing to display the payment button only in emails; * reorder the fields definition to ease the reading; * slightly clean the email body using a maximum of div and br tags as it seems better integrated with Odoo edition capabilities; This commit is linked to task ID 1860049 and PR #25824. --- addons/purchase/data/mail_template_data.xml | 114 ++++++++++---------- addons/purchase/models/purchase.py | 2 +- 2 files changed, 55 insertions(+), 61 deletions(-) diff --git a/addons/purchase/data/mail_template_data.xml b/addons/purchase/data/mail_template_data.xml index 072342afc87..16fa3861f1d 100644 --- a/addons/purchase/data/mail_template_data.xml +++ b/addons/purchase/data/mail_template_data.xml @@ -1,80 +1,74 @@ - - - RFQ - Send by Email - ${(object.create_uid.email and '"%s" <%s>' % (object.create_uid.name, object.create_uid.email) or '')|safe} + Purchase Order: Send RFQ + + ${object.create_uid.email_formatted | safe} ${object.company_id.name} Order (Ref ${object.name or 'n/a' }) ${object.partner_id.id} - - + +
+

+ Dear ${object.partner_id.name} + % if object.partner_id.parent_id: + (${object.partner_id.parent_id.name}) + % endif +

+ Here is in attachment a ${object.state in ('draft', 'sent') and 'request for quotation' or 'purchase order'} ${object.name} + % if object.partner_ref: + with reference: ${object.partner_ref} + % endif + % if object.origin: + (RFQ origin: ${object.origin}) + % endif + amounting in ${format_amount(object.amount_total, object.currency_id)} + from ${object.company_id.name}. +

+ Do not hesitate to contact us if you have any question. +

+ Best regards, +

+
RFQ_${(object.name or '').replace('/','_')} ${object.partner_id.lang} - Dear -% if object.partner_id.is_company and object.partner_id.child_ids: - ${object.partner_id.child_ids[0].name} -% else : - ${object.partner_id.name} -% endif -,

-Here is, in attachment, a ${object.state in ('draft', 'sent') and 'request for quotation' or 'purchase order confirmation'} ${object.name} -% if object.partner_ref: - with reference: ${object.partner_ref} -% endif -% if object.origin: - (RFQ origin: ${object.origin}) -% endif -amounting in ${format_amount(object.amount_total, object.currency_id)} -from ${object.company_id.name}. -

- -

Do not hesitate to contact us, further you have any question.

-

Best regards,

-

-% if object.user_id and object.user_id.signature: - ${object.user_id.signature | safe} -% endif -

-]]>
+ +
- - - Purchase Order - Send by Email - ${(object.create_uid.email and '"%s" <%s>' % (object.create_uid.name, object.create_uid.email) or '')|safe} + Purchase Order: Send PO + + ${object.create_uid.email_formatted | safe} ${object.company_id.name} Order (Ref ${object.name or 'n/a' }) ${object.partner_id.id} - - + +
+

+ Dear ${object.partner_id.name} + % if object.partner_id.parent_id: + (${object.partner_id.parent_id.name}) + % endif +

+ Here is in attachment a ${object.state in ('draft', 'sent') and 'request for quotation' or 'purchase order'} ${object.name} + % if object.partner_ref: + with reference: ${object.partner_ref} + % endif + % if object.origin: + (RFQ origin: ${object.origin}) + % endif + amounting in ${format_amount(object.amount_total, object.currency_id)} + from ${object.company_id.name}. +

+ Do not hesitate to contact us if you have any question. +

+
PO_${(object.name or '').replace('/','_')} ${object.partner_id.lang} - Dear ${object.partner_id.name} -% if object.partner_id.parent_id: - (${object.partner_id.parent_id.name}) -% endif -,

-

-Please find in attachment a ${object.state in ('draft', 'sent') and 'request for quotation' or 'purchase order confirmation'} ${object.name} -% if object.partner_ref: - with reference: ${object.partner_ref} -% endif -% if object.origin: - (RFQ origin: ${object.origin}) -% endif -amounting ${format_amount(object.amount_total, object.currency_id)} -from ${object.company_id.name}. -

- -

You can reply to this email if you have any questions.

-

Thank you,

-]]>
+ +
diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py index a73c707999a..649ab4b52b6 100644 --- a/addons/purchase/models/purchase.py +++ b/addons/purchase/models/purchase.py @@ -262,7 +262,7 @@ class PurchaseOrder(models.Model): 'default_use_template': bool(template_id), 'default_template_id': template_id, 'default_composition_mode': 'comment', - 'custom_layout': "mail.mail_notification_borders", + 'custom_layout': "mail.mail_notification_paynow", 'force_email': True, 'mark_rfq_as_sent': True, })