From 115887a886bd8997fd3714a0a70e5919de57515b Mon Sep 17 00:00:00 2001
From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com>
Date: Mon, 28 Oct 2019 12:07:57 +0530
Subject: [PATCH] fix: Better validation msg for difference account in Stock
Entry (#19401)
* fix: Better validation msg for difference account
* fix: Make primary info bold
---
erpnext/stock/doctype/stock_entry/stock_entry.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index e6806784cda..b27c92d609e 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -227,7 +227,9 @@ class StockEntry(StockController):
for d in self.get("items"):
if not d.expense_account:
- frappe.throw(_("Please enter Difference Account"))
+ frappe.throw(_("Please enter Difference Account or set default Stock Adjustment Account for company {0}")
+ .format(frappe.bold(self.company)))
+
elif self.is_opening == "Yes" and frappe.db.get_value("Account", d.expense_account, "report_type") == "Profit and Loss":
frappe.throw(_("Difference Account must be a Asset/Liability type account, since this Stock Entry is an Opening Entry"), OpeningEntryAccountError)