From 4de3a488434e370e8c4b4ed63449104ff241deaa Mon Sep 17 00:00:00 2001 From: Jordi Ballester Date: Tue, 1 Jun 2021 10:35:44 +0200 Subject: [PATCH] [account_financial_report][fix] The aged and open items reports should ignore move lines with a zero balance, even when they have an amount residual. Those entries can exist as a result of an exchange rate difference. --- account_financial_report/report/aged_partner_balance.py | 5 +++++ account_financial_report/report/open_items.py | 3 +++ 2 files changed, 8 insertions(+) diff --git a/account_financial_report/report/aged_partner_balance.py b/account_financial_report/report/aged_partner_balance.py index 0ded56b4..62a9f00f 100644 --- a/account_financial_report/report/aged_partner_balance.py +++ b/account_financial_report/report/aged_partner_balance.py @@ -111,6 +111,8 @@ class AgedPartnerBalanceReport(models.AbstractModel): "journal_id", "account_id", "partner_id", + "debit", + "credit", "amount_residual", "date_maturity", "ref", @@ -153,6 +155,9 @@ class AgedPartnerBalanceReport(models.AbstractModel): move_line for move_line in move_lines if move_line["date"] <= date_at_object + and not float_is_zero( + move_line["debit"] - move_line["credit"], precision_digits=2 + ) and not float_is_zero(move_line["amount_residual"], precision_digits=2) ] for move_line in move_lines: diff --git a/account_financial_report/report/open_items.py b/account_financial_report/report/open_items.py index d19ac529..3981a043 100644 --- a/account_financial_report/report/open_items.py +++ b/account_financial_report/report/open_items.py @@ -102,6 +102,9 @@ class OpenItemsReport(models.AbstractModel): move_line for move_line in move_lines if move_line["date"] <= date_at_object + and not float_is_zero( + move_line["debit"] - move_line["credit"], precision_digits=2 + ) and not float_is_zero(move_line["amount_residual"], precision_digits=2) ]