From 39e10c4ab0c17fccd20e1d70c9d0533f7d2e4778 Mon Sep 17 00:00:00 2001 From: Nihantra Patel Date: Wed, 11 Mar 2026 14:40:41 +0530 Subject: [PATCH] fix: Append existing ignored doctypes in Journal Entry on_cancel instead of overwriting --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 4f6e8b7507e..d2eb3b23dda 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -294,6 +294,8 @@ class JournalEntry(AccountsController): # References for this Journal are removed on the `on_cancel` event in accounts_controller super().on_cancel() + + from_doc_events = getattr(self, "ignore_linked_doctypes", ()) self.ignore_linked_doctypes = ( "GL Entry", "Stock Ledger Entry", @@ -307,6 +309,10 @@ class JournalEntry(AccountsController): "Advance Payment Ledger Entry", "Tax Withholding Entry", ) + + if from_doc_events and from_doc_events != self.ignore_linked_doctypes: + self.ignore_linked_doctypes = self.ignore_linked_doctypes + from_doc_events + self.make_gl_entries(1) JournalTaxWithholding(self).on_cancel() self.unlink_advance_entry_reference()