fix: advance payment doctypes to keep input/output distinction

This commit is contained in:
David Arnold
2024-01-22 22:04:30 +01:00
parent 72614fe9e1
commit c88ce55242
5 changed files with 26 additions and 7 deletions

View File

@@ -1749,7 +1749,10 @@ class AccountsController(TransactionBase):
def set_total_advance_paid(self):
ple = frappe.qb.DocType("Payment Ledger Entry")
party = self.customer if self.doctype == "Sales Order" else self.supplier
if self.doctype in frappe.get_hooks("advance_payment_customer_doctypes"):
party = self.customer
if self.doctype in frappe.get_hooks("advance_payment_supplier_doctypes"):
party = self.supplier
advance = (
frappe.qb.from_(ple)
.select(ple.account_currency, Abs(Sum(ple.amount_in_account_currency)).as_("amount"))