fix: allocation logic on 'Get Outstanding Invoices' btn in PE

1. fixed broken `payment_term` filter in Payment References section
2. Throw error if user fails to select 'Payment Term' for an invoice
with 'Payment Term based allocation' enabled.
This commit is contained in:
ruthra kumar
2023-07-22 11:18:11 +05:30
parent cc36af57bd
commit 662ccd467c
3 changed files with 32 additions and 10 deletions

View File

@@ -874,3 +874,18 @@ def get_fields(doctype, fields=None):
fields.insert(1, meta.title_field.strip())
return unique(fields)
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def get_payment_terms_for_references(doctype, txt, searchfield, start, page_len, filters) -> list:
terms = []
if filters:
terms = frappe.db.get_all(
"Payment Schedule",
filters={"parent": filters.get("reference")},
fields=["payment_term"],
limit=page_len,
as_list=1,
)
return terms