From 357a1c9752e9c4f92d7e1784b22268a04222e12b Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Thu, 21 Mar 2024 11:57:22 +0100 Subject: [PATCH 1/2] refactor(Item Price): validate dates (cherry picked from commit cbcc47b5c4ae190f3951a772bb88f81acfa8fc3a) # Conflicts: # erpnext/stock/doctype/item_price/item_price.py --- erpnext/stock/doctype/item_price/item_price.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/item_price/item_price.py b/erpnext/stock/doctype/item_price/item_price.py index 89a130a6bf4..1a224141750 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): @@ -46,7 +45,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,11 +55,14 @@ class ItemPrice(Document): if not frappe.db.exists("Item", self.item_code): frappe.throw(_("Item {0} not found.").format(self.item_code)) +<<<<<<< HEAD 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 Upto Date.")) +======= +>>>>>>> cbcc47b5c4 (refactor(Item Price): validate dates) def update_price_list_details(self): if self.price_list: price_list_details = frappe.db.get_value( From df6226f07fa82b51922aaf539d18226f4e031049 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Thu, 21 Mar 2024 14:16:27 +0100 Subject: [PATCH 2/2] chore: resolve conflicts --- erpnext/stock/doctype/item_price/item_price.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/erpnext/stock/doctype/item_price/item_price.py b/erpnext/stock/doctype/item_price/item_price.py index 1a224141750..25a28b436ff 100644 --- a/erpnext/stock/doctype/item_price/item_price.py +++ b/erpnext/stock/doctype/item_price/item_price.py @@ -55,14 +55,6 @@ class ItemPrice(Document): if not frappe.db.exists("Item", self.item_code): frappe.throw(_("Item {0} not found.").format(self.item_code)) -<<<<<<< HEAD - 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 Upto Date.")) - -======= ->>>>>>> cbcc47b5c4 (refactor(Item Price): validate dates) def update_price_list_details(self): if self.price_list: price_list_details = frappe.db.get_value(