Skip to content

Commit

Permalink
Merge pull request #36261 from ruthra-kumar/possible_missing_field_er…
Browse files Browse the repository at this point in the history
…ror_on_payment_entry

refactor: apply terms based validation only on sales/purchase doctypes
  • Loading branch information
ruthra-kumar authored Jul 24, 2023
2 parents 7f4dda1 + 3dd119e commit 4464b2a
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 4464b2a

Please sign in to comment.