diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index a64e76fdca..6b18b826bd 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -150,13 +150,16 @@ class SellingController(StockController): if not frappe.db.get_single_value("Selling Settings", "validate_selling_price"): return + if hasattr(self, "is_return") and self.is_return: + return + for it in self.get("items"): if not it.item_code: continue last_purchase_rate, is_stock_item = frappe.db.get_value("Item", it.item_code, ["last_purchase_rate", "is_stock_item"]) last_purchase_rate_in_sales_uom = last_purchase_rate / (it.conversion_factor or 1) - if flt(it.base_rate) < flt(last_purchase_rate_in_sales_uom) and not self.is_return: + if flt(it.base_rate) < flt(last_purchase_rate_in_sales_uom): throw_message(it.item_name, last_purchase_rate_in_sales_uom, "last purchase rate") last_valuation_rate = frappe.db.sql(""" @@ -166,7 +169,7 @@ class SellingController(StockController): """, (it.item_code, it.warehouse)) if last_valuation_rate: last_valuation_rate_in_sales_uom = last_valuation_rate[0][0] / (it.conversion_factor or 1) - if is_stock_item and flt(it.base_rate) < flt(last_valuation_rate_in_sales_uom) and not self.is_return: + if is_stock_item and flt(it.base_rate) < flt(last_valuation_rate_in_sales_uom): throw_message(it.name, last_valuation_rate_in_sales_uom, "valuation rate")