mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 03:39:11 +00:00
chore: handle credit note validation
This commit is contained in:
@@ -273,12 +273,12 @@ class PaymentEntry(AccountsController):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if d.reference_doctype in ("Sales Invoice", "Purchase Invoice", "Fees"):
|
if d.reference_doctype in ("Sales Invoice", "Purchase Invoice", "Fees"):
|
||||||
outstanding_amount = frappe.get_cached_value(d.reference_doctype, d.reference_name, "outstanding_amount")
|
outstanding_amount, is_return = frappe.get_cached_value(d.reference_doctype, d.reference_name, ["outstanding_amount", "is_return"])
|
||||||
if outstanding_amount <= 0:
|
if outstanding_amount <= 0 and not is_return:
|
||||||
no_oustanding_refs.setdefault(d.reference_doctype, []).append(d)
|
no_oustanding_refs.setdefault(d.reference_doctype, []).append(d)
|
||||||
|
|
||||||
for k, v in no_oustanding_refs.items():
|
for k, v in no_oustanding_refs.items():
|
||||||
frappe.msgprint(_("{} - {} now have {} as they had no outstanding amount left before submitting the Payment Entry. \n \
|
frappe.msgprint(_("{} - {} now have {} as they had no outstanding amount left before submitting the Payment Entry.<br><br>\
|
||||||
If this is undesirable please cancel the corresponding Payment Entry.")
|
If this is undesirable please cancel the corresponding Payment Entry.")
|
||||||
.format(k, frappe.bold(", ".join([d.reference_name for d in v])), frappe.bold("negative outstanding amount")),
|
.format(k, frappe.bold(", ".join([d.reference_name for d in v])), frappe.bold("negative outstanding amount")),
|
||||||
title=_("Warning"), indicator="orange")
|
title=_("Warning"), indicator="orange")
|
||||||
|
|||||||
Reference in New Issue
Block a user