Skip to content

Commit

Permalink
[FIX][12.0] l10n_it_account_balance_report
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiocorato committed Aug 29, 2023
1 parent 40d5298 commit c27a906
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 10 deletions.
18 changes: 16 additions & 2 deletions l10n_it_account_balance_report/report/account_balance_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ def compute_data_for_report(self):

sign = trial_acc_line.get_balance_sign()
trial_acc_line.final_balance *= sign
trial_acc_line.period_balance *= sign
for trial_partner_line in trial_acc_line.partner_ids:
trial_partner_line.final_balance *= sign
trial_partner_line.period_balance *= sign

Check warning on line 135 in l10n_it_account_balance_report/report/account_balance_report.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_account_balance_report/report/account_balance_report.py#L135

Added line #L135 was not covered by tests

balance_line_vals = (
0, 0, {
Expand All @@ -150,11 +152,23 @@ def compute_data_for_report(self):
if section == r_sec:
section_credit_vals.append(balance_line_vals)
if not trial_acc_line.account_group_id:
total_credit += trial_acc_line.final_balance
# get total from period when we create a profit/loss report
total_credit += (
trial_acc_line.period_balance if
trial_acc_line.account_id.internal_group in
["income", "expense"]
else trial_acc_line.final_balance
)
elif section == l_sec:
section_debit_vals.append(balance_line_vals)
if not trial_acc_line.account_group_id:
total_debit += trial_acc_line.final_balance
# get total from period when we create a profit/loss report
total_debit += (
trial_acc_line.period_balance if
trial_acc_line.account_id.internal_group in
["income", "expense"]
else trial_acc_line.final_balance
)

curr = self.company_id.currency_id or self.company_id._get_euro()
digits = curr.decimal_places
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,23 @@ def _get_report_columns(self, report):
'indent_field': 'level',
'indent_unit': 2,
'width': 60},
2: {'field': 'final_balance',
2: {'field': 'period_balance',
'header': _("Period balance"),
'type': 'amount',
'width': 20},
3: {'field': 'final_balance',
'header': _("Final balance"),
'type': 'amount',
'width': 20}
}
if report.foreign_currency:
cols.update({
3: {'field': 'currency_id',
4: {'field': 'currency_id',
'field_currency_balance': 'currency_id',
'header': _("Cur."),
'type': 'many2one',
'width': 10},
4: {'field': 'final_balance_foreign_currency',
5: {'field': 'final_balance_foreign_currency',
'header': _("Ending balance in cur."),
'type': 'amount_currency',
'width': 20}
Expand Down Expand Up @@ -199,7 +203,10 @@ def generate_partner_columns(self, cols, mode):
1: {'field': 'partner_id',
'type': 'many2one',
'width': 60},
2: {'field': 'final_balance',
2: {'field': 'period_balance',
'type': 'amount',
'width': 20},
3: {'field': 'final_balance',
'type': 'amount',
'width': 20}
})
Expand All @@ -210,7 +217,10 @@ def generate_partner_columns(self, cols, mode):
1 + len(cols): {'field': 'partner_id',
'type': 'many2one',
'width': 60},
2 + len(cols): {'field': 'final_balance',
2 + len(cols): {'field': 'period_balance',
'type': 'amount',
'width': 20},
3 + len(cols): {'field': 'final_balance',
'type': 'amount',
'width': 20}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.final_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
<t t-att-style="style" t-raw="line.period_balance if line.account_id.internal_group in ['income', 'expense'] else line.final_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-elif="line.account_group_id">
Expand All @@ -229,7 +229,7 @@
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.final_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
<t t-att-style="style" t-raw="line.period_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def _compute_hide_line(self):
# lines_to_recompute will be self itself.
for line in lines_to_recompute:
trial_report = line.report_id
balance = line.final_balance
balance = line.period_balance if line.account_id.internal_group in [
"income", "expense"
] else line.final_balance
currency = line.currency_id or trial_report.company_id.currency_id
rounding = currency.rounding
if trial_report.hide_account_at_0 \
Expand Down

0 comments on commit c27a906

Please sign in to comment.