diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index a23ac8342a0..ca5e3f7eb10 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -6,7 +6,7 @@ import json from collections import defaultdict import frappe -from frappe import _ +from frappe import _, bold from frappe.model.mapper import get_mapped_doc from frappe.query_builder.functions import Sum from frappe.utils import ( @@ -526,6 +526,14 @@ class StockEntry(StockController): OpeningEntryAccountError, ) + if self.purpose != "Material Issue" and acc_details.account_type == "Cost of Goods Sold": + frappe.msgprint( + _( + "At row {0}: You have selected the Difference Account {1}, which is a Cost of Goods Sold type account. Please select a different account" + ).format(d.idx, bold(get_link_to_form("Account", d.expense_account))), + title=_("Warning : Cost of Goods Sold Account"), + ) + def validate_warehouse(self): """perform various (sometimes conditional) validations on warehouse"""