[FIX] account_financial_report: Prevent error related to currency from Trial Balance

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

Traceback:

Error to render compiling AST
AttributeError: 'int' object has no attribute 'decimal_places'
Template: account_financial_report.report_trial_balance_line
Path: /t/div/t[3]/t[1]/t/t/div/span/t
Node: <t t-esc="balance['initial_currency_balance']" t-options="{'widget': 'monetary', 'display_currency': balance['currency_id']}"/>

The error occured while rendering the template account_financial_report.report_trial_balance_line and evaluating the following expression: <t t-esc="balance['initial_currency_balance']" t-options="{'widget': 'monetary', 'display_currency': balance['currency_id']}"/>
pull/1068/head
Víctor Martínez 2023-07-25 08:55:42 +02:00 committed by Aritz Olea
parent b856f1f825
commit 953dc41e63
2 changed files with 17 additions and 4 deletions

View File

@ -559,6 +559,10 @@
<t t-if="not show_partner_details">
<t t-if="balance['type'] == 'account_type'">
<t t-if="balance['currency_id']">
<t
t-set="balance_currency"
t-value="currency_model.browse(balance['currency_id'])"
/>
<!--## Initial balance cur.-->
<div class="act_as_cell amount" t-att-style="style">
<t
@ -571,7 +575,7 @@
>
<t
t-esc="balance['initial_currency_balance']"
t-options="{'widget': 'monetary', 'display_currency': balance['currency_id']}"
t-options="{'widget': 'monetary', 'display_currency': balance_currency}"
/>
</span>
<!-- <t t-if="line.account_group_id">-->
@ -602,9 +606,13 @@
t-att-domain="domain+aml_domain_common"
res-model="account.move.line"
>
<t
t-set="total_amount_item_currency"
t-value="currency_model.browse(total_amount[account_id]['currency_id'])"
/>
<t
t-out="total_amount[account_id][partner_id]['initial_currency_balance']"
t-options="{'widget': 'monetary', 'display_currency': total_amount[account_id]['currency_id']}"
t-options="{'widget': 'monetary', 'display_currency': total_amount_item_currency}"
/>
</span>
</div>
@ -626,7 +634,7 @@
>
<t
t-out="balance['ending_currency_balance']"
t-options="{'widget': 'monetary', 'display_currency': balance['currency_id']}"
t-options="{'widget': 'monetary', 'display_currency': balance_currency}"
/>
</span>
<!-- <t t-if="line.account_group_id">-->
@ -657,9 +665,13 @@
t-att-domain="domain+aml_domain_common"
res-model="account.move.line"
>
<t
t-set="total_amount_item_currency"
t-value="currency_model.browse(total_amount[account_id]['currency_id'])"
/>
<t
t-out="total_amount[account_id][partner_id]['ending_currency_balance']"
t-options="{'widget': 'monetary', 'display_currency': total_amount[account_id]['currency_id']}"
t-options="{'widget': 'monetary', 'display_currency': total_amount_item_currency}"
/>
</span>
</t>

View File

@ -755,4 +755,5 @@ class TrialBalanceReport(models.AbstractModel):
"accounts_data": accounts_data,
"partners_data": partners_data,
"show_hierarchy_level": show_hierarchy_level,
"currency_model": self.env["res.currency"],
}