diff --git a/erpnext/patches/v8_1/set_delivery_date_in_so_item.py b/erpnext/patches/v8_1/set_delivery_date_in_so_item.py index aa5cbc50bc..e3e23a584e 100644 --- a/erpnext/patches/v8_1/set_delivery_date_in_so_item.py +++ b/erpnext/patches/v8_1/set_delivery_date_in_so_item.py @@ -13,11 +13,11 @@ def execute(): frappe.db.sql(""" update `tabSales Order` so, `tabSales Order Item` so_item - set so_item.delivery_date = so.delivery_date + set so_item.delivery_date = if(ifnull(so.delivery_date, '0000-00-00'), ifnull(so.delivery_date, '0000-00-00'), '0000-00-00') where so.name = so_item.parent and so.order_type = 'Sales' and (so_item.delivery_date is null or so_item.delivery_date = '' or so_item.delivery_date = '0000-00-00') - and (so.delivery_date is not null and so.delivery_date != '' + and (so.delivery_date is not null and so.delivery_date != '' and so.delivery_date != "" and so.delivery_date != '0000-00-00') """)