fix: update advace paid in SO/PO in account currency
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 216c9f4..1849e8b 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -1352,12 +1352,12 @@
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)