From bcb0f6038e0742d73888720c2fafc4609ac3aa6a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 21 Aug 2019 14:47:33 +0530 Subject: [PATCH] fix: Single gl entry should only be considered once either in opening or closing entry (#18792) --- .../report/accounts_receivable/accounts_receivable.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index 97e710450c..0e4ee12548 100755 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -197,8 +197,10 @@ class ReceivablePayableReport(object): if self.filters.based_on_payment_terms and gl_entries_data: self.payment_term_map = self.get_payment_term_detail(voucher_nos) + self.gle_inclusion_map = {} for gle in gl_entries_data: if self.is_receivable_or_payable(gle, self.dr_or_cr, future_vouchers, return_entries): + self.gle_inclusion_map[gle.name] = True outstanding_amount, credit_note_amount, payment_amount = self.get_outstanding_amount( gle,self.filters.report_date, self.dr_or_cr, return_entries) temp_outstanding_amt = outstanding_amount @@ -409,7 +411,9 @@ class ReceivablePayableReport(object): for e in self.get_gl_entries_for(gle.party, gle.party_type, gle.voucher_type, gle.voucher_no): if getdate(e.posting_date) <= report_date \ and (e.name!=gle.name or (e.voucher_no in return_entries and not return_entries.get(e.voucher_no))): - + if e.name!=gle.name and self.gle_inclusion_map.get(e.name): + continue + self.gle_inclusion_map[e.name] = True amount = flt(e.get(reverse_dr_or_cr), self.currency_precision) - flt(e.get(dr_or_cr), self.currency_precision) if e.voucher_no not in return_entries: payment_amount += amount