Wrong error message on item price lower than buy price

Hi there,

I’m getting an error message:

I’ve doubled check and there are no selling price lower than 0.32, see pics for selling prices:

and buying prices:

Could you please have a look?



System here is validating Selling Price for Item against Purchase Rate or Valuation Rate.

Can you please confirm the last Purchase rate for the item.

Hope this helps

@ArundhatiS sorry, i’m not getting your point …even if it’s validating prices, I don’t have selling item prices lower than the buying price or last purchase price …what is validating? Last Purchase price is 0,32

Can you please let us know what is the current price you are using for the item.

@ArundhatiS the standard selling price is 0.46 tax included it means 0.377 net rate.

btw i got the method who is validating the price:

def validate_selling_price(self):
	def throw_message(item_name, rate, ref_rate_field):
		frappe.throw(_("""Selling price for item {0} is lower than its {1}. Selling price should be atleast {2}""")
			.format(item_name, ref_rate_field, rate))

	if not frappe.db.get_single_value("Selling Settings", "validate_selling_price"):

	for it in self.get("items"):
		last_purchase_rate, is_stock_item = frappe.db.get_value("Item", it.item_code, ["last_purchase_rate", "is_stock_item"])

		if flt(it.base_rate) < flt(last_purchase_rate):
			throw_message(it.item_name, last_purchase_rate, "last purchase rate")

		last_valuation_rate = frappe.db.sql("""
			SELECT valuation_rate FROM `tabStock Ledger Entry` WHERE item_code = %s
			AND warehouse = %s AND valuation_rate > 0
			ORDER BY posting_date DESC, posting_time DESC, name DESC LIMIT 1
			""", (it.item_code, it.warehouse))

		if is_stock_item and flt(it.base_rate) < flt(last_valuation_rate):
			throw_message(it.name, last_valuation_rate, "valuation rate")

I think rate comparison should be done on net value for both selling and last valutation / last purchase price, i’m not sure it’s done in that way …because last_purchase_rate seems to be a net value while it.base_rate is value tax included (at least in my case on which sell price are all stored as tax included).

1 Like