From b212d7a5e17bd6a0a4e8d9fefa4c8ad21d4690c9 Mon Sep 17 00:00:00 2001 From: diptanilsaha Date: Thu, 6 Aug 2026 16:37:57 +0530 Subject: [PATCH] fix(journal_entry): validate blocked purchase invoices (cherry picked from commit 04718e15c954a082197cfbc7f294ac95fff9e65f) --- .../accounts/doctype/journal_entry/journal_entry.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 762585601e5..5bf3f0cf53c 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -798,6 +798,18 @@ class JournalEntry(AccountsController): ) ) + if reference_type == "Purchase Invoice" and invoice.invoice_is_blocked(): + msg = ( + _("{0} {1} is blocked and on hold until {2}.").format( + invoice.doctype, invoice.name, invoice.release_date + ) + if invoice.release_date + else _("{0} {1} is blocked.").format( + invoice.doctype, invoice.name, invoice.release_date + ) + ) + frappe.throw(msg) + def set_against_account(self): accounts_debited, accounts_credited = [], [] if self.voucher_type in ("Deferred Revenue", "Deferred Expense"):