From da1f3d3ce49b0d3444fcea7dda9c9659e3311cdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 17 Nov 2020 12:54:14 +0000 Subject: [PATCH] [MOV][IMP] account: reorganize qweb / jinja templates used for mailing PURPOSE Clean organization of templates in odoo apps: mail.template records in data, qweb templates (views) used directly in code, notably using post with view. Purpose is to ease future improvements in posting based on templates. SPECIFICATIONS * move those templates in their own file to ease their discovering and maintenance; * put them into data (as those are not views even if it contains qweb) * guidelines are now : -> Qweb templates should be in data/mail_templates.xml; -> mail.template records should be in data/mail_template_data.xml; * put their declaration in no update when not done if template has no technical code or complex dependency on underlying code; * move found mail data (mail.message.subtype or mail.activity.type) records in a mail_data file that should contain only "core" records linked to mail; LINKS Task ID-2375767 COM PR odoo/odoo#61814 ENT PR odoo/enterprise#14775 UPG PR odoo/upgrade#1936 --- addons/account/__manifest__.py | 5 +- addons/account/data/mail_template_data.xml | 29 ++++++++ addons/account/data/payment_receipt_data.xml | 68 ------------------- addons/account/views/account_payment_view.xml | 33 +++++++++ 4 files changed, 64 insertions(+), 71 deletions(-) delete mode 100644 addons/account/data/payment_receipt_data.xml diff --git a/addons/account/__manifest__.py b/addons/account/__manifest__.py index b3f27b9f7fd..1617407b2af 100644 --- a/addons/account/__manifest__.py +++ b/addons/account/__manifest__.py @@ -22,6 +22,8 @@ You could use this simplified accounting in case you work with an (external) acc 'data/data_account_type.xml', 'data/account_data.xml', 'data/digest_data.xml', + 'views/account_report.xml', + 'data/mail_template_data.xml', 'views/account_payment_view.xml', 'wizard/account_automatic_entry_wizard_views.xml', 'wizard/account_unreconcile_view.xml', @@ -45,9 +47,7 @@ You could use this simplified accounting in case you work with an (external) acc 'views/account_chart_template_views.xml', 'views/res_partner_bank_views.xml', 'views/report_statement.xml', - 'views/account_report.xml', 'views/terms_template.xml', - 'data/mail_template_data.xml', 'wizard/account_validate_move_view.xml', 'views/res_company_views.xml', 'views/product_view.xml', @@ -64,7 +64,6 @@ You could use this simplified accounting in case you work with an (external) acc 'views/account_journal_dashboard_view.xml', 'views/account_portal_templates.xml', 'views/report_payment_receipt_templates.xml', - 'data/payment_receipt_data.xml', 'views/account_onboarding_templates.xml', 'data/service_cron.xml', 'views/account_incoterms_view.xml', diff --git a/addons/account/data/mail_template_data.xml b/addons/account/data/mail_template_data.xml index 1aa788e3019..62a79d8acd5 100644 --- a/addons/account/data/mail_template_data.xml +++ b/addons/account/data/mail_template_data.xml @@ -55,5 +55,34 @@ ${object.partner_id.lang} + + + Payment Receipt: Send by email + + ${object.company_id.name} Payment Receipt (Ref ${object.name or 'n/a' }) + ${object.partner_id.id} + +
+

+ Dear ${object.partner_id.name}

+ Thank you for your payment. + Here is your payment receipt ${(object.name or '').replace('/','-')} amounting + to ${format_amount(object.amount, object.currency_id)} from ${object.company_id.name}. +

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

+ Best regards, + % if user.signature: +
+ ${user.signature | safe} + % endif +

+
+
+ + ${(object.name or '').replace('/','-')} + ${object.partner_id.lang} + +
diff --git a/addons/account/data/payment_receipt_data.xml b/addons/account/data/payment_receipt_data.xml deleted file mode 100644 index 74b6eb657fb..00000000000 --- a/addons/account/data/payment_receipt_data.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - Payment Receipt: Send by email - - ${object.company_id.name} Payment Receipt (Ref ${object.name or 'n/a' }) - ${object.partner_id.id} - -
-

- Dear ${object.partner_id.name}

- Thank you for your payment. - Here is your payment receipt ${(object.name or '').replace('/','-')} amounting - to ${format_amount(object.amount, object.currency_id)} from ${object.company_id.name}. -

- Do not hesitate to contact us if you have any questions. -

- Best regards, - % if user.signature: -
- ${user.signature | safe} - % endif -

-
-
- - ${(object.name or '').replace('/','-')} - ${object.partner_id.lang} - -
- - - Send receipt by email - mail.compose.message - form - new - - - form - - - - - Send receipts by email - mail.compose.message - form - new - - - list - -
-
diff --git a/addons/account/views/account_payment_view.xml b/addons/account/views/account_payment_view.xml index 78251dc1d08..d47cae7d4cc 100644 --- a/addons/account/views/account_payment_view.xml +++ b/addons/account/views/account_payment_view.xml @@ -365,6 +365,39 @@ records.action_post()
+ + + + Send receipt by email + mail.compose.message + form + new + + + form + + + + Send receipts by email + mail.compose.message + form + new + + + list +