From b0f302e57929e4556760049b8c88c86a565af043 Mon Sep 17 00:00:00 2001 From: Saqib Ansari Date: Wed, 11 May 2022 12:42:35 +0530 Subject: [PATCH] fix: validate on hold purchase invoices in payment entry --- erpnext/accounts/doctype/payment_entry/payment_entry.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 7257e6d75f..a3a7be2958 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -346,6 +346,12 @@ class PaymentEntry(AccountsController): ) ) + if ref_doc.doctype == "Purchase Invoice" and ref_doc.get("on_hold"): + frappe.throw( + _("{0} {1} is on hold").format(d.reference_doctype, d.reference_name), + title=_("Invalid Invoice"), + ) + if ref_doc.docstatus != 1: frappe.throw(_("{0} {1} must be submitted").format(d.reference_doctype, d.reference_name))