feat(Item Price): validate UOM

(cherry picked from commit 69824eff80)

# Conflicts:
#	erpnext/stock/doctype/item_price/item_price.py
This commit is contained in:
barredterra
2024-03-21 11:52:10 +01:00
committed by Mergify
parent 4eca7f0524
commit 376da8df0a

View File

@@ -55,6 +55,19 @@ class ItemPrice(Document):
if not frappe.db.exists("Item", self.item_code): if not frappe.db.exists("Item", self.item_code):
frappe.throw(_("Item {0} not found.").format(self.item_code)) frappe.throw(_("Item {0} not found.").format(self.item_code))
<<<<<<< HEAD
=======
if self.uom and not frappe.db.exists(
"UOM Conversion Detail", {"parenttype": "Item", "parent": self.item_code, "uom": self.uom}
):
frappe.throw(_("UOM {0} not found in Item {1}").format(self.uom, self.item_code))
def validate_dates(self):
if self.valid_from and self.valid_upto:
if getdate(self.valid_from) > getdate(self.valid_upto):
frappe.throw(_("Valid From Date must be lesser than Valid Up To Date."))
>>>>>>> 69824eff80 (feat(Item Price): validate UOM)
def update_price_list_details(self): def update_price_list_details(self):
if self.price_list: if self.price_list:
price_list_details = frappe.db.get_value( price_list_details = frappe.db.get_value(