From 3f004db14fbf481cccca59d8a4344dbafec069c1 Mon Sep 17 00:00:00 2001 From: ljain112 Date: Mon, 30 Jun 2025 17:35:08 +0530 Subject: [PATCH] fix: cost center for payment entry against advance payment doctypes in accounts Payable/Receivable report (cherry picked from commit 8f19f1400468d6dc2762b62475b762f57b829f3d) --- .../report/accounts_receivable/accounts_receivable.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index e87fa699908..5bf6163fc6a 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -62,6 +62,9 @@ class ReceivablePayableReport: frappe.db.get_single_value("Accounts Settings", "receivable_payable_fetch_method") or "Buffered Cursor" ) # Fail Safe + self.advance_payment_doctypes = frappe.get_hooks( + "advance_payment_receivable_doctypes" + ) + frappe.get_hooks("advance_payment_payable_doctypes") def run(self, args): self.filters.update(args) @@ -181,7 +184,10 @@ class ReceivablePayableReport: if key not in self.voucher_balance: self.voucher_balance[key] = self.build_voucher_dict(ple) - if ple.voucher_type == ple.against_voucher_type and ple.voucher_no == ple.against_voucher_no: + if (ple.voucher_type == ple.against_voucher_type and ple.voucher_no == ple.against_voucher_no) or ( + ple.voucher_type in ("Payment Entry", "Journal Entry") + and ple.against_voucher_type in self.advance_payment_doctypes + ): self.voucher_balance[key].cost_center = ple.cost_center self.get_invoices(ple)