fix: warning message for COGS account in the stock entry

(cherry picked from commit bba6b0ff45)
This commit is contained in:
Rohit Waghchaure
2025-05-07 16:03:59 +05:30
committed by Mergify
parent 3993525bf6
commit 1bbbd261cb

View File

@@ -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 (
@@ -463,6 +463,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"""