fix: skip validate_stock_accounts when perpetual inventory is disabled

When perpetual inventory is disabled, stock transactions produce no GL
entries, so blocking manual Journal Entries against stock accounts is
incorrect. Added an early return guard in validate_stock_accounts()
to skip the check when is_perpetual_inventory_enabled() returns False.
This commit is contained in:
Saeed Kola
2026-03-17 17:08:29 +05:30
parent 3720a8d5c9
commit 3bc9190795

View File

@@ -269,6 +269,9 @@ class JournalEntry(AccountsController):
frappe.throw(_("Journal Entry type should be set as Depreciation Entry for asset depreciation"))
def validate_stock_accounts(self):
if not erpnext.is_perpetual_inventory_enabled(self.company):
return
stock_accounts = get_stock_accounts(self.company, accounts=self.accounts)
for account in stock_accounts:
account_bal, stock_bal, warehouse_list = get_stock_and_account_balance(