From 9942fcc8cb8d2d45ebd285b4876e2f69c725f897 Mon Sep 17 00:00:00 2001
From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com>
Date: Mon, 28 Oct 2019 12:08:31 +0530
Subject: [PATCH] fix: Better validation msg for difference account in Stock
Entry (#19400)
* 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 7fa7d3b0b6b..55e02a46ff2 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -241,7 +241,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)