[FIX] account_financial_report: Prevent error related to currency from General ledger

Use case: Generate report (showing foreign currency) with accounts with defined currency.

Traceback:

File "/odoo/odoo-server/odoo/addons/base/models/ir_qweb_fields.py", line 448, in value_to_html
fmt = "%.{0}f".format(display_currency.decimal_places)
AttributeError: 'int' object has no attribute 'decimal_places'

The above exception was the direct cause of the following exception:

Error to render compiling AST
AttributeError: 'int' object has no attribute 'decimal_places'
Template: account_financial_report.report_general_ledger_lines
Path: /t/div/div[2]/t[6]/t[1]/div[1]/t[1]/span/t
Node: <t t-raw="account_or_group_item_object['init_bal']['bal_curr']" t-options="{'widget': 'monetary', 'display_currency': account['currency_id']}"/>

TT42804
pull/1033/head
Víctor Martínez 2023-04-27 09:07:26 +02:00
parent 2129527a36
commit a394558c36
1 changed files with 16 additions and 8 deletions

View File

@ -313,6 +313,10 @@
</div> </div>
<t t-if="foreign_currency"> <t t-if="foreign_currency">
<t t-if="account['currency_id']"> <t t-if="account['currency_id']">
<t
t-set="account_currency"
t-value="currency_model.browse(account['currency_id'])"
/>
<div class="act_as_cell amount" style="width: 3.63%;"> <div class="act_as_cell amount" style="width: 3.63%;">
<t t-if="type == 'account_type'"> <t t-if="type == 'account_type'">
<span <span
@ -321,7 +325,7 @@
> >
<t <t
t-raw="account_or_group_item_object['init_bal']['bal_curr']" t-raw="account_or_group_item_object['init_bal']['bal_curr']"
t-options="{'widget': 'monetary', 'display_currency': account['currency_id']}" t-options="{'widget': 'monetary', 'display_currency': account_currency}"
/> />
</span> </span>
</t> </t>
@ -332,7 +336,7 @@
> >
<t <t
t-raw="account_or_group_item_object['init_bal']['bal_curr']" t-raw="account_or_group_item_object['init_bal']['bal_curr']"
t-options="{'widget': 'monetary', 'display_currency': account['currency_id']}" t-options="{'widget': 'monetary', 'display_currency': account_currency}"
/> />
</span> </span>
</t> </t>
@ -345,7 +349,7 @@
> >
<t <t
t-raw="account_or_group_item_object['init_bal']['bal_curr']" t-raw="account_or_group_item_object['init_bal']['bal_curr']"
t-options="{'widget': 'monetary', 'display_currency': account['currency_id']}" t-options="{'widget': 'monetary', 'display_currency': account_currency}"
/> />
</span> </span>
</t> </t>
@ -356,7 +360,7 @@
> >
<t <t
t-raw="account_or_group_item_object['init_bal']['bal_curr']" t-raw="account_or_group_item_object['init_bal']['bal_curr']"
t-options="{'widget': 'monetary', 'display_currency': account['currency_id']}" t-options="{'widget': 'monetary', 'display_currency': account_currency}"
/> />
</span> </span>
</t> </t>
@ -693,6 +697,10 @@
<t t-set="misc_grouped_domain" t-value="[]" t-else="" /> <t t-set="misc_grouped_domain" t-value="[]" t-else="" />
<t t-if="foreign_currency"> <t t-if="foreign_currency">
<t t-if="account['currency_id']"> <t t-if="account['currency_id']">
<t
t-set="account_currency"
t-value="currency_model.browse(account['currency_id'])"
/>
<div class="act_as_cell amount" style="width: 3.63%;"> <div class="act_as_cell amount" style="width: 3.63%;">
<t t-if="type == 'account_type'"> <t t-if="type == 'account_type'">
<span> <span>
@ -704,7 +712,7 @@
> >
<t <t
t-raw="account_or_group_item_object['fin_bal']['bal_curr']" t-raw="account_or_group_item_object['fin_bal']['bal_curr']"
t-options="{'widget': 'monetary', 'display_currency': account['currency_id']}" t-options="{'widget': 'monetary', 'display_currency': account_currency}"
/> />
</a> </a>
</span> </span>
@ -719,7 +727,7 @@
> >
<t <t
t-raw="account_or_group_item_object['fin_bal']['bal_curr']" t-raw="account_or_group_item_object['fin_bal']['bal_curr']"
t-options="{'widget': 'monetary', 'display_currency': account['currency_id']}" t-options="{'widget': 'monetary', 'display_currency': account_currency}"
/> />
</a> </a>
</span> </span>
@ -736,7 +744,7 @@
> >
<t <t
t-raw="account_or_group_item_object['fin_bal']['bal_curr']" t-raw="account_or_group_item_object['fin_bal']['bal_curr']"
t-options="{'widget': 'monetary', 'display_currency': account['currency_id']}" t-options="{'widget': 'monetary', 'display_currency': account_currency}"
/> />
</a> </a>
</span> </span>
@ -751,7 +759,7 @@
> >
<t <t
t-raw="account_or_group_item_object['fin_bal']['bal_curr']" t-raw="account_or_group_item_object['fin_bal']['bal_curr']"
t-options="{'widget': 'monetary', 'display_currency': account['currency_id']}" t-options="{'widget': 'monetary', 'display_currency': account_currency}"
/> />
</a> </a>
</span> </span>