Skip to content

Commit

Permalink
fix: Bulk update of valid upto field wasn't working (#28242)
Browse files Browse the repository at this point in the history
* fix: Bulk update of valid upto field wasn't working

Check in dates for the price list was failing because valid_upto field was string. Converting to date fixed the problem.

* chore: extend fix and cleanup whitespace

Co-authored-by: Ankush Menat <ankush@frappe.io>
  • Loading branch information
fatihustaoglu and ankush authored Nov 4, 2021
1 parent 73e9e99 commit 95a5ef1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion erpnext/stock/doctype/item_price/item_price.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import getdate


class ItemPriceDuplicateItem(frappe.ValidationError):
Expand All @@ -27,7 +28,7 @@ def validate_item(self):

def validate_dates(self):
if self.valid_from and self.valid_upto:
if self.valid_from > self.valid_upto:
if getdate(self.valid_from) > getdate(self.valid_upto):
frappe.throw(_("Valid From Date must be lesser than Valid Upto Date."))

def update_price_list_details(self):
Expand Down

0 comments on commit 95a5ef1

Please sign in to comment.