diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index d1d1d9469e..e200bf7923 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -164,14 +164,15 @@ class SellingController(StockController): def validate_selling_price(self): selling_settings = frappe.get_single("Selling Settings") - if not selling_settings.validate_selling_price_purchase_rate: + if not selling_settings.validate_selling_price: return for it in self.get("items"): item = frappe.get_doc("Item", it.name) - if flt(it.base_rate) < flt(item.last_purchase_rate): - frappe.throw(_("Selling price for item {0} is lower than its Purchase rate. Selling price should be atleast {1}").format(it.item_name, item.last_purchase_rate)) + if flt(it.base_rate) < flt(item.last_purchase_rate) or flt(it.base_rate) < flt(item.valuation_rate): + frappe.throw(_("""Selling price for item {0} is lower than its Purchase rate or Valuation rate. + Selling price should be atleast {1}""").format(it.item_name, item.last_purchase_rate)) def get_item_list(self): il = [] diff --git a/erpnext/selling/doctype/selling_settings/selling_settings.json b/erpnext/selling/doctype/selling_settings/selling_settings.json index 6d84730ce1..dd9bcd70c4 100644 --- a/erpnext/selling/doctype/selling_settings/selling_settings.json +++ b/erpnext/selling/doctype/selling_settings/selling_settings.json @@ -328,14 +328,14 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "validate_selling_price_purchase_rate", + "fieldname": "validate_selling_price", "fieldtype": "Check", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, - "label": "Validate Selling Price for Item against Purchase Rate", + "label": "Validate Selling Price for Item against Purchase Rate or Valuation Rate", "length": 0, "no_copy": 0, "permlevel": 0, @@ -361,7 +361,7 @@ "issingle": 1, "istable": 0, "max_attachments": 0, - "modified": "2016-10-19 18:32:19.667032", + "modified": "2016-10-20 08:17:45.621151", "modified_by": "Administrator", "module": "Selling", "name": "Selling Settings",