From bf76b85dfd3562f4384cdd9a42322e5a41bfd734 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 22 Nov 2022 12:16:11 +0530 Subject: [PATCH] fix: update advace paid in SO/PO in account currency --- erpnext/controllers/accounts_controller.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 216c9f45d3f..1849e8b3b55 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -1352,12 +1352,12 @@ class AccountsController(TransactionBase): party = self.customer if self.doctype == "Sales Order" else self.supplier advance = ( frappe.qb.from_(ple) - .select(ple.account_currency, Abs(Sum(ple.amount)).as_("amount")) + .select(ple.account_currency, Abs(Sum(ple.amount_in_account_currency)).as_("amount")) .where( (ple.against_voucher_type == self.doctype) & (ple.against_voucher_no == self.name) & (ple.party == party) - & (ple.delinked == 0) + & (ple.docstatus == 1) & (ple.company == self.company) ) .run(as_dict=True)