refactor: use hooks to identify advance doctypes

This commit is contained in:
ruthra kumar
2024-10-12 15:54:21 +05:30
parent a112581acd
commit e7bb960bb5

View File

@@ -1263,6 +1263,10 @@ class PaymentEntry(AccountsController):
if not self.party_account: if not self.party_account:
return return
advance_payment_doctypes = frappe.get_hooks("advance_payment_receivable_doctypes") + frappe.get_hooks(
"advance_payment_payable_doctypes"
)
if self.payment_type == "Receive": if self.payment_type == "Receive":
against_account = self.paid_to against_account = self.paid_to
else: else:
@@ -1313,10 +1317,7 @@ class PaymentEntry(AccountsController):
) )
if self.book_advance_payments_in_separate_party_account: if self.book_advance_payments_in_separate_party_account:
if d.reference_doctype in [ if d.reference_doctype in advance_payment_doctypes:
"Sales Order",
"Purchase Order",
]:
gle.update( gle.update(
{ {
"against_voucher_type": d.reference_doctype, "against_voucher_type": d.reference_doctype,