Skip to content

Commit

Permalink
refactor: apply terms based validation only on sales/purchase doctyp
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthra-kumar committed Jul 24, 2023
1 parent a785a60 commit 3dd119e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion erpnext/accounts/doctype/payment_entry/payment_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ def validate_allocated_amount(self):
def term_based_allocation_enabled_for_reference(
self, reference_doctype: str, reference_name: str
) -> bool:
if reference_doctype and reference_name:
if (
reference_doctype
and reference_doctype in ["Sales Invoice", "Sales Order", "Purchase Order", "Purchase Invoice"]
and reference_name
):
if template := frappe.db.get_value(reference_doctype, reference_name, "payment_terms_template"):
return frappe.db.get_value(
"Payment Terms Template", template, "allocate_payment_based_on_payment_terms"
Expand Down

0 comments on commit 3dd119e

Please sign in to comment.