fix: validate expense account for opening stock reco

This commit is contained in:
Nabin Hait 2019-05-23 15:32:28 +05:30
parent 5173170be3
commit d8496a770a

View File

@ -239,7 +239,7 @@ class StockReconciliation(StockController):
if not self.expense_account:
frappe.throw(_("Please enter Expense Account"))
elif self.reconciliation_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.sql("""select name from `tabStock Ledger Entry` limit 1"""):
if frappe.db.get_value("Account", self.expense_account, "report_type") == "Profit and Loss":
frappe.throw(_("Difference Account must be a Asset/Liability type account, since this Stock Reconciliation is an Opening Entry"), OpeningEntryAccountError)