From 6da5dff26cb4f61f7e6fc4abe04441d12e535651 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 7 Apr 2026 12:28:41 +0000 Subject: [PATCH] fix: skip validate_stock_accounts in Journal Entry when perpetual inventory is disabled (backport #53554) (backport #53558) (#54104) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Saeed Kola Co-authored-by: diptanilsaha --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index d2eb3b23dda..2d229a6e21d 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -354,8 +354,11 @@ class JournalEntry(AccountsController): frappe.throw(_("Account {0} should be of type Expense").format(d.account)) def validate_stock_accounts(self): - if self.voucher_type == "Periodic Accounting Entry": - # Skip validation for periodic accounting entry + if ( + not erpnext.is_perpetual_inventory_enabled(self.company) + or self.voucher_type == "Periodic Accounting Entry" + ): + # Skip validation for periodic accounting entry and Perpetual Inventory Disabled Company. return stock_accounts = get_stock_accounts(self.company, accounts=self.accounts)