fix(stock): check opening stock reconciliation per company

(cherry picked from commit 333273300a)

# Conflicts:
#	erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
This commit is contained in:
R-Jayaraman
2026-10-27 10:50:00 +05:30
committed by pandiyan
parent ed59ce64f3
commit 9e69fb1263
@@ -1009,8 +1009,8 @@ class StockReconciliation(StockController):
if not self.expense_account:
frappe.throw(_("Please enter Expense Account"))
elif self.purpose == "Opening Stock" or not frappe.db.sql(
"""select name from `tabStock Ledger Entry` limit 1"""
elif self.purpose == "Opening Stock" or not frappe.db.get_all(
"Stock Ledger Entry", filters={"company": self.company, "is_cancelled": 0}, limit=1
):
if frappe.db.get_value("Account", self.expense_account, "report_type") == "Profit and Loss":
frappe.throw(