[Fix] Added check to validate selling price against valuation rate

This commit is contained in:
shreyas
2016-10-20 11:50:00 +05:30
parent 1cfe2d7b45
commit edcba51c8b
2 changed files with 7 additions and 6 deletions

View File

@@ -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 = []