[fix] check for null date fields (#11334)

This commit is contained in:
Saurabh 2017-10-25 17:44:22 +05:30 committed by Nabin Hait
parent 6a4e230cde
commit d6e67ce123

View File

@ -17,6 +17,8 @@ def execute():
doc = frappe.get_doc(doctype, record)
if doc.items:
if not doc.schedule_date:
min_schedule_date = min([d.schedule_date for d in doc.items])
frappe.db.set_value(doctype, record,
"schedule_date", min_schedule_date, update_modified=False)
schedule_dates = [d.schedule_date for d in doc.items if d.schedule_date]
if len(schedule_dates) > 0:
min_schedule_date = min(schedule_dates)
frappe.db.set_value(doctype, record,
"schedule_date", min_schedule_date, update_modified=False)