[FIX] account: payment terms examples only in EN

To reproduce the issue:
1. Change the language to french
2. Go to Accounting > Payment terms
3. Select one payment term
4. Look at the example section
5. Examples are in English

Error: The examples should have been in French

The sentence was hardcoded and not translatable

OPW-3203268

closes odoo/odoo#116883

X-original-commit: 7b244e71284d9bfb7186caa82f33f39902937b96
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
Signed-off-by: Demany Antoine (ande) <ande@odoo.com>
This commit is contained in:
Antoine (ande)
2023-03-29 11:46:58 +02:00
parent ecbca821ad
commit 548777ab4b
2 changed files with 29 additions and 11 deletions
+17
View File
@@ -307,6 +307,15 @@ msgstr ""
msgid "45 Days"
msgstr ""
#. module: account
#. odoo-python
#: code:addons/account/models/account_payment_term.py:0
#, python-format
msgid ""
"<b>%(count)s#</b> Installment of <b>%(amount)s</b> due on <b style='color: "
"#704A66;'>%(date)s</b>"
msgstr ""
#. module: account
#: model_terms:ir.ui.view,arch_db:account.view_account_payment_register_form
msgid "<b>Early Payment Discount applied.</b>"
@@ -5613,6 +5622,14 @@ msgstr ""
msgid "Early Payment Discount granted for this line"
msgstr ""
#. module: account
#. odoo-python
#: code:addons/account/models/account_payment_term.py:0
#, python-format
msgid ""
"Early Payment Discount: <b>%(amount)s</b> if paid before <b>%(date)s</b>"
msgstr ""
#. module: account
#: model_terms:ir.ui.view,arch_db:account.view_move_line_tree
msgid "Edit"
+12 -11
View File
@@ -85,9 +85,11 @@ class AccountPaymentTerm(models.Model):
if record.early_discount:
date = record._get_last_discount_date_formatted(record.example_date)
discount_amount = record._get_amount_due_after_discount(record.example_amount, 0.0)
record.example_preview_discount = f"""
Early Payment Discount: <b>{formatLang(self.env, discount_amount, monetary=True, currency_obj=currency)}</b> if paid before <b>{date}</b>
"""
record.example_preview_discount = _(
"Early Payment Discount: <b>%(amount)s</b> if paid before <b>%(date)s</b>",
amount=formatLang(self.env, discount_amount, monetary=True, currency_obj=currency),
date=date,
)
if not record.example_invalid:
terms = record._compute_terms(
@@ -102,14 +104,13 @@ class AccountPaymentTerm(models.Model):
for i, info_by_dates in enumerate(record._get_amount_by_date(terms).values()):
date = info_by_dates['date']
amount = info_by_dates['amount']
example_preview += f"""
<div>
<b>{i+1}#</b>
Installment of
<b>{formatLang(self.env, amount, monetary=True, currency_obj=currency)}</b>
due on
<b style='color: #704A66;'>{date}</b>
"""
example_preview += "<div>"
example_preview += _(
"<b>%(count)s#</b> Installment of <b>%(amount)s</b> due on <b style='color: #704A66;'>%(date)s</b>",
count=i+1,
amount=formatLang(self.env, amount, monetary=True, currency_obj=currency),
date=date,
)
example_preview += "</div>"
record.example_preview = example_preview