From e00ce93a77fb71b49bd505eb0d883bbcb98b584f Mon Sep 17 00:00:00 2001 From: fw-bot Date: Fri, 20 Mar 2020 12:43:06 +0000 Subject: [PATCH] [FIX] sale: fix uneditable "Confirmation Email" template body Website sale order confirmation email is broken by design. Indeed it has jinja markers between html elements that do not allow them, like between table and tr, between tr, ... In this commit we completely rewrite the structure to correctly include jinja markers where they are not moved or stripped by standard browsers and editors. Translations are updated accordingly as changing a mail template content imply updating the whole body translation. Followup of 74c5c00 website_sale: add website on some demo orders Purpose is to showcase orders using website field, used notably for some template rendering. Forward port of afd173652214000ed and f74c86d448246b796d closes odoo/odoo#48228 X-original-commit: d3bdb0a42eb052281b4652bf78e82b1c6c1c1d24 Signed-off-by: Martin Trigaux (mat) Signed-off-by: Thibault Delavallee (tde) --- addons/sale/data/mail_data.xml | 255 ++++++++++++++------------ addons/sale/i18n/sale.pot | 285 ++++++++++++++++-------------- addons/website_sale/data/demo.xml | 10 ++ 3 files changed, 310 insertions(+), 240 deletions(-) diff --git a/addons/sale/data/mail_data.xml b/addons/sale/data/mail_data.xml index 9322aed4863..6b720427155 100644 --- a/addons/sale/data/mail_data.xml +++ b/addons/sale/data/mail_data.xml @@ -136,119 +136,150 @@

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

- % if object.website_id: - - - - - - - - % for line in object.order_line: - % if not line.is_delivery: - - % if line.display_type == 'line_section': - - % elif line.display_type == 'line_note': - - % else: - - - - % if object.user_id.has_group('account.group_show_line_subtotals_tax_excluded'): - - % endif - % if object.user_id.has_group('account.group_show_line_subtotals_tax_included'): - - % endif - % endif - - % endif - % endfor -
ProductsQuantityPrice
${line.name}${line.name} - Product image - ${line.product_id.name}${line.product_uom_qty}${format_amount(line.price_reduce_taxexcl, object.currency_id)}${format_amount(line.price_reduce_taxinc, object.currency_id)}
- - % if object.carrier_id: - - - - - - - - - % else: - - - - - % endif - - - - - - - - -
Delivery:${format_amount(object.amount_delivery, object.currency_id)}
SubTotal:${format_amount(object.amount_untaxed, object.currency_id)}
SubTotal:${format_amount(object.amount_untaxed, object.currency_id)}
Taxes:${format_amount(object.amount_tax, object.currency_id)}
Total:${format_amount(object.amount_total, object.currency_id)}
-
- - % if object.partner_invoice_id: - - - - - - - % endif - % if object.partner_shipping_id and not object.only_services: - - - - % if object.carrier_id: - - - - % endif - % endif -
- Bill to: - ${object.partner_invoice_id.street or ''} - ${object.partner_invoice_id.city or ''} - ${object.partner_invoice_id.state_id.name or ''} - ${object.partner_invoice_id.zip or ''} - ${object.partner_invoice_id.country_id.name or ''} -
- Payment Method: - % if transaction.payment_token_id: - ${transaction.payment_token_id.name} - % else: - ${transaction.acquirer_id.name} - % endif - (${format_amount(transaction.amount, object.currency_id)}) -
-
- Ship to: - ${object.partner_shipping_id.street or ''} - ${object.partner_shipping_id.city or ''} - ${object.partner_shipping_id.state_id.name or ''} - ${object.partner_shipping_id.zip or ''} - ${object.partner_shipping_id.country_id.name or ''} -
- Shipping Method: - ${object.carrier_id.name} - % if object.carrier_id.fixed_price == 0.0: - (Free) - % else: - (${format_amount(object.carrier_id.fixed_price, object.currency_id)}) - % endif -
- % endif

- - +% if object.website_id: +
+ + + + + + + +
ProductsQuantityPrice
+ % for line in object.order_line: + % if not line.is_delivery and line.display_type in ['line_section', 'line_note']: + + + + +
+ % if line.display_type == 'line_section': + ${line.name} + % elif line.display_type == 'line_note': + ${line.name} + % endif +
+ % elif not line.is_delivery + + + + + + % if object.user_id.has_group('account.group_show_line_subtotals_tax_excluded'): + + % endif + % if object.user_id.has_group('account.group_show_line_subtotals_tax_included'): + + % endif + +
+ Product image + ${line.product_id.name}${line.product_uom_qty}${format_amount(line.price_reduce_taxexcl, object.currency_id)}${format_amount(line.price_reduce_taxinc, object.currency_id)}
+ % endif + % endfor +
+ % if object.carrier_id: +
+ + + + + + + + + +
+ Delivery:${format_amount(object.amount_delivery, object.currency_id)}
+ SubTotal:${format_amount(object.amount_untaxed, object.currency_id)}
+
+ % else: +
+ + + + + +
+ SubTotal:${format_amount(object.amount_untaxed, object.currency_id)}
+
+ % endif +
+ + + + + + + + + +
+ Taxes:${format_amount(object.amount_tax, object.currency_id)}
+ Total:${format_amount(object.amount_total, object.currency_id)}
+
+ % if object.partner_invoice_id: +
+ + + + + + + +
+ Bill to: + ${object.partner_invoice_id.street or ''} + ${object.partner_invoice_id.city or ''} + ${object.partner_invoice_id.state_id.name or ''} + ${object.partner_invoice_id.zip or ''} + ${object.partner_invoice_id.country_id.name or ''} +
+ Payment Method: + % if transaction.payment_token_id: + ${transaction.payment_token_id.name} + % else: + ${transaction.acquirer_id.name} + % endif + (${format_amount(transaction.amount, object.currency_id)}) +
+
+ % endif + % if object.partner_shipping_id and not object.only_services: +
+ + + + +
+
+ Ship to: + ${object.partner_shipping_id.street or ''} + ${object.partner_shipping_id.city or ''} + ${object.partner_shipping_id.state_id.name or ''} + ${object.partner_shipping_id.zip or ''} + ${object.partner_shipping_id.country_id.name or ''} +
+ % if object.carrier_id: + + + + +
+ Shipping Method: + ${object.carrier_id.name} + % if object.carrier_id.fixed_price == 0.0: + (Free) + % else: + (${format_amount(object.carrier_id.fixed_price, object.currency_id)}) + % endif +
+ % endif +
+ % endif +% endif + ${(object.name or '').replace('/','_')} ${object.partner_id.lang} diff --git a/addons/sale/i18n/sale.pot b/addons/sale/i18n/sale.pot index af410204259..5508c655595 100644 --- a/addons/sale/i18n/sale.pot +++ b/addons/sale/i18n/sale.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server saas~13.2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-02-13 08:34+0000\n" -"PO-Revision-Date: 2020-02-13 08:34+0000\n" +"POT-Creation-Date: 2020-03-24 07:00+0000\n" +"PO-Revision-Date: 2020-03-24 07:00+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -95,119 +95,150 @@ msgid "" "

\n" " Do not hesitate to contact us if you have any questions.\n" "

\n" -" % if object.website_id:\n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" % for line in object.order_line:\n" -" % if not line.is_delivery:\n" -" \n" -" % if line.display_type == 'line_section':\n" -" \n" -" % elif line.display_type == 'line_note':\n" -" \n" -" % else:\n" -" \n" -" \n" -" \n" -" % if object.user_id.has_group('account.group_show_line_subtotals_tax_excluded'):\n" -" \n" -" % endif\n" -" % if object.user_id.has_group('account.group_show_line_subtotals_tax_included'):\n" -" \n" -" % endif\n" -" % endif\n" -" \n" -" % endif\n" -" % endfor\n" -"
Products\n" -" QuantityPrice
${line.name}${line.name}\n" -" \"Product\n" -" ${line.product_id.name}${line.product_uom_qty}${format_amount(line.price_reduce_taxexcl, object.currency_id)}${format_amount(line.price_reduce_taxinc, object.currency_id)}
\n" -" \n" -" % if object.carrier_id:\n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" % else:\n" -" \n" -" \n" -" \n" -" \n" -" % endif\n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -"
Delivery:${format_amount(object.amount_delivery, object.currency_id)}
SubTotal:${format_amount(object.amount_untaxed, object.currency_id)}
SubTotal:${format_amount(object.amount_untaxed, object.currency_id)}
Taxes:${format_amount(object.amount_tax, object.currency_id)}
Total:${format_amount(object.amount_total, object.currency_id)}
\n" -"
\n" -" \n" -" % if object.partner_invoice_id:\n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" % endif\n" -" % if object.partner_shipping_id and not object.only_services:\n" -" \n" -" \n" -" \n" -" % if object.carrier_id:\n" -" \n" -" \n" -" \n" -" % endif\n" -" % endif\n" -"
\n" -" Bill to:\n" -" ${object.partner_invoice_id.street or ''}\n" -" ${object.partner_invoice_id.city or ''}\n" -" ${object.partner_invoice_id.state_id.name or ''}\n" -" ${object.partner_invoice_id.zip or ''}\n" -" ${object.partner_invoice_id.country_id.name or ''}\n" -"
\n" -" Payment Method:\n" -" % if transaction.payment_token_id:\n" -" ${transaction.payment_token_id.name}\n" -" % else:\n" -" ${transaction.acquirer_id.name}\n" -" % endif\n" -" (${format_amount(transaction.amount, object.currency_id)})\n" -"
\n" -"
\n" -" Ship to:\n" -" ${object.partner_shipping_id.street or ''}\n" -" ${object.partner_shipping_id.city or ''}\n" -" ${object.partner_shipping_id.state_id.name or ''}\n" -" ${object.partner_shipping_id.zip or ''}\n" -" ${object.partner_shipping_id.country_id.name or ''}\n" -"
\n" -" Shipping Method:\n" -" ${object.carrier_id.name}\n" -" % if object.carrier_id.fixed_price == 0.0:\n" -" (Free)\n" -" % else:\n" -" (${format_amount(object.carrier_id.fixed_price, object.currency_id)})\n" -" % endif\n" -"
\n" -" % endif\n" "

\n" -"\n" -" " +"% if object.website_id:\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
Products\n" +" QuantityPrice
\n" +" % for line in object.order_line:\n" +" % if not line.is_delivery and line.display_type in ['line_section', 'line_note']:\n" +" \n" +" \n" +" \n" +" \n" +"
\n" +" % if line.display_type == 'line_section':\n" +" ${line.name}\n" +" % elif line.display_type == 'line_note':\n" +" ${line.name}\n" +" % endif\n" +"
\n" +" % elif not line.is_delivery\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" % if object.user_id.has_group('account.group_show_line_subtotals_tax_excluded'):\n" +" \n" +" % endif\n" +" % if object.user_id.has_group('account.group_show_line_subtotals_tax_included'):\n" +" \n" +" % endif\n" +" \n" +"
\n" +" \"Product\n" +" ${line.product_id.name}${line.product_uom_qty}${format_amount(line.price_reduce_taxexcl, object.currency_id)}${format_amount(line.price_reduce_taxinc, object.currency_id)}
\n" +" % endif\n" +" % endfor\n" +"
\n" +" % if object.carrier_id:\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +" Delivery:${format_amount(object.amount_delivery, object.currency_id)}
\n" +" SubTotal:${format_amount(object.amount_untaxed, object.currency_id)}
\n" +"
\n" +" % else:\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +" SubTotal:${format_amount(object.amount_untaxed, object.currency_id)}
\n" +"
\n" +" % endif\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +" Taxes:${format_amount(object.amount_tax, object.currency_id)}
\n" +" Total:${format_amount(object.amount_total, object.currency_id)}
\n" +"
\n" +" % if object.partner_invoice_id:\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
\n" +" Bill to:\n" +" ${object.partner_invoice_id.street or ''}\n" +" ${object.partner_invoice_id.city or ''}\n" +" ${object.partner_invoice_id.state_id.name or ''}\n" +" ${object.partner_invoice_id.zip or ''}\n" +" ${object.partner_invoice_id.country_id.name or ''}\n" +"
\n" +" Payment Method:\n" +" % if transaction.payment_token_id:\n" +" ${transaction.payment_token_id.name}\n" +" % else:\n" +" ${transaction.acquirer_id.name}\n" +" % endif\n" +" (${format_amount(transaction.amount, object.currency_id)})\n" +"
\n" +"
\n" +" % endif\n" +" % if object.partner_shipping_id and not object.only_services:\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +"
\n" +"
\n" +" Ship to:\n" +" ${object.partner_shipping_id.street or ''}\n" +" ${object.partner_shipping_id.city or ''}\n" +" ${object.partner_shipping_id.state_id.name or ''}\n" +" ${object.partner_shipping_id.zip or ''}\n" +" ${object.partner_shipping_id.country_id.name or ''}\n" +"
\n" +" % if object.carrier_id:\n" +" \n" +" \n" +" \n" +" \n" +"
\n" +" Shipping Method:\n" +" ${object.carrier_id.name}\n" +" % if object.carrier_id.fixed_price == 0.0:\n" +" (Free)\n" +" % else:\n" +" (${format_amount(object.carrier_id.fixed_price, object.currency_id)})\n" +" % endif\n" +"
\n" +" % endif\n" +"
\n" +" % endif\n" +"% endif\n" +"" msgstr "" #. module: sale @@ -1280,9 +1311,7 @@ msgstr "" #: model:ir.model.fields,help:sale.field_sale_order__expected_date msgid "" "Delivery date you can promise to the customer, computed from the minimum " -"lead time of the order lines in case of Service products. In case of " -"shipping, the shipping policy of the order will be taken into account to " -"either use the minimum or maximum lead time of the order lines." +"lead time of the order lines." msgstr "" #. module: sale @@ -2034,6 +2063,11 @@ msgstr "" msgid "Margins" msgstr "" +#. module: sale +#: model:ir.actions.server,name:sale.model_sale_order_action_quotation_sent +msgid "Mark Quotation as Sent" +msgstr "" + #. module: sale #: model_terms:ir.ui.view,arch_db:sale.account_invoice_form msgid "Marketing" @@ -2290,6 +2324,12 @@ msgstr "" msgid "Only Integer Value should be valid." msgstr "" +#. module: sale +#: code:addons/sale/models/sale.py:0 +#, python-format +msgid "Only draft orders can be marked as sent directly." +msgstr "" + #. module: sale #: model:ir.model.constraint,message:sale.constraint_product_attribute_custom_value_sol_custom_value_unique msgid "" @@ -4128,14 +4168,3 @@ msgstr "" #: model:ir.model.fields,help:sale.field_sale_order__amount_by_group msgid "type: [(name, amount, base, formated amount, formated base)]" msgstr "" - -#. module: sale -#: model:ir.actions.server,name:sale.model_sale_order_action_quotation_sent -msgid "Mark Quotation as Sent" -msgstr "" - -#. module: sale -#: code:addons/sale/models/sale.py:0 -#, python-format -msgid "Only draft orders can be marked as sent directly." -msgstr "" diff --git a/addons/website_sale/data/demo.xml b/addons/website_sale/data/demo.xml index 3e38aadb212..4e4b8726665 100644 --- a/addons/website_sale/data/demo.xml +++ b/addons/website_sale/data/demo.xml @@ -410,6 +410,7 @@ + @@ -430,6 +431,7 @@ + @@ -450,6 +452,7 @@ + @@ -479,6 +482,7 @@ + @@ -499,6 +503,7 @@ + @@ -519,6 +524,7 @@ + @@ -541,6 +547,7 @@ + @@ -560,6 +567,7 @@ + @@ -581,6 +589,7 @@ + @@ -602,6 +611,7 @@ +