[FIX] account: decimal separator on vendor bill
Steps to reproduce: - Set a language which use ',' (comma) as decimal separator (eg French) - Make a Vendor Bill for any product at any price. If the partner's language use '.' (period) as decimal separator (eg English), the field amount_by_group is formated whit period, while others are formated with comma. They should all be formated with comma. - Now print the Vendor Bill The same issue is occuring. With Customer Invoices, the issue is the same on the form view, but not on the printing, where all the fields are formated with period, as set in the partner's language. After this commit, we format all the fields regarding the environment's language on the view form, either in Vendor Bills and Customer Invoices, and we formating the printed bill/invoice regarding the partner's language opw-2735698 closes odoo/odoo#84666 X-original-commit: bb029a476a04b7d41ea1f585274d24f581b4003d Signed-off-by: Florian Gilbert <flg@odoo.com> Signed-off-by: Guillaume Vanleynseele <guva@odoo.com>
This commit is contained in:
@@ -1843,7 +1843,6 @@ class AccountMove(models.Model):
|
||||
}
|
||||
}
|
||||
"""
|
||||
lang_env = self.with_context(lang=partner.lang).env
|
||||
account_tax = self.env['account.tax']
|
||||
|
||||
grouped_taxes = defaultdict(lambda: defaultdict(lambda: {'base_amount': 0.0, 'tax_amount': 0.0, 'base_line_keys': set()}))
|
||||
@@ -1889,8 +1888,8 @@ class AccountMove(models.Model):
|
||||
'tax_group_name': group.name,
|
||||
'tax_group_amount': amounts['tax_amount'],
|
||||
'tax_group_base_amount': amounts['base_amount'],
|
||||
'formatted_tax_group_amount': formatLang(lang_env, amounts['tax_amount'], currency_obj=currency),
|
||||
'formatted_tax_group_base_amount': formatLang(lang_env, amounts['base_amount'], currency_obj=currency),
|
||||
'formatted_tax_group_amount': formatLang(self.env, amounts['tax_amount'], currency_obj=currency),
|
||||
'formatted_tax_group_base_amount': formatLang(self.env, amounts['base_amount'], currency_obj=currency),
|
||||
'tax_group_id': group.id,
|
||||
'group_key': '%s-%s' %(subtotal_title, group.id),
|
||||
} for group, amounts in sorted(groups.items(), key=lambda l: l[0].sequence)]
|
||||
@@ -1905,7 +1904,7 @@ class AccountMove(models.Model):
|
||||
subtotals_list.append({
|
||||
'name': subtotal_title,
|
||||
'amount': subtotal_value,
|
||||
'formatted_amount': formatLang(lang_env, subtotal_value, currency_obj=currency),
|
||||
'formatted_amount': formatLang(self.env, subtotal_value, currency_obj=currency),
|
||||
})
|
||||
|
||||
subtotal_tax_amount = sum(group_val['tax_group_amount'] for group_val in groups_by_subtotal[subtotal_title])
|
||||
@@ -1915,8 +1914,8 @@ class AccountMove(models.Model):
|
||||
return {
|
||||
'amount_total': amount_total,
|
||||
'amount_untaxed': amount_untaxed,
|
||||
'formatted_amount_total': formatLang(lang_env, amount_total, currency_obj=currency),
|
||||
'formatted_amount_untaxed': formatLang(lang_env, amount_untaxed, currency_obj=currency),
|
||||
'formatted_amount_total': formatLang(self.env, amount_total, currency_obj=currency),
|
||||
'formatted_amount_untaxed': formatLang(self.env, amount_untaxed, currency_obj=currency),
|
||||
'groups_by_subtotal': groups_by_subtotal,
|
||||
'subtotals': subtotals_list,
|
||||
'allow_tax_edition': False,
|
||||
|
||||
@@ -259,7 +259,7 @@
|
||||
<template id="report_invoice">
|
||||
<t t-call="web.html_container">
|
||||
<t t-foreach="docs" t-as="o">
|
||||
<t t-set="lang" t-value="o.invoice_user_id.sudo().lang if o.move_type in ('in_invoice', 'in_refund') else o.partner_id.lang"/>
|
||||
<t t-set="lang" t-value="o.partner_id.lang"/>
|
||||
<t t-if="o._get_name_invoice_report() == 'account.report_invoice_document'"
|
||||
t-call="account.report_invoice_document" t-lang="lang"/>
|
||||
</t>
|
||||
@@ -269,7 +269,7 @@
|
||||
<template id="report_invoice_with_payments">
|
||||
<t t-call="web.html_container">
|
||||
<t t-foreach="docs" t-as="o">
|
||||
<t t-set="lang" t-value="o.invoice_user_id.sudo().lang if o.move_type in ('in_invoice', 'in_refund') else o.partner_id.lang"/>
|
||||
<t t-set="lang" t-value="o.partner_id.lang"/>
|
||||
<t t-set="print_with_payments" t-value="True"/>
|
||||
<t t-if="o._get_name_invoice_report() == 'account.report_invoice_document'"
|
||||
t-call="account.report_invoice_document" t-lang="lang"/>
|
||||
|
||||
Reference in New Issue
Block a user