diff --git a/erpnext/stock/doctype/item_price/item_price.py b/erpnext/stock/doctype/item_price/item_price.py index 68a3b345fe172a6898652ef6c55e851fecdfa703..e799b73338386b1afc55b9f617e376e78555f6b3 100644 --- a/erpnext/stock/doctype/item_price/item_price.py +++ b/erpnext/stock/doctype/item_price/item_price.py @@ -7,7 +7,6 @@ from frappe import _, bold from frappe.model.document import Document from frappe.query_builder import Criterion from frappe.query_builder.functions import Cast_ -from frappe.utils import getdate class ItemPriceDuplicateItem(frappe.ValidationError): @@ -48,7 +47,7 @@ class ItemPrice(Document): def validate(self): self.validate_item() - self.validate_dates() + self.validate_from_to_dates("valid_from", "valid_upto") self.update_price_list_details() self.update_item_details() self.check_duplicates() @@ -56,12 +55,7 @@ class ItemPrice(Document): def validate_item(self): if not frappe.db.exists("Item", self.item_code): - frappe.throw(_("Item {0} not found").format(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.")) + frappe.throw(_("Item {0} not found.").format(self.item_code)) def update_price_list_details(self): if self.price_list: