improve validation (#13058)

This commit is contained in:
Shreya Shah 2018-02-23 16:23:57 +05:30 committed by Nabin Hait
parent dd0fc1084e
commit d5b2e39f45

View File

@ -104,8 +104,8 @@ class SalesOrder(SellingController):
def validate_delivery_date(self):
if self.order_type == 'Sales':
if not self.delivery_date:
self.delivery_date = max([d.delivery_date for d in self.get("items") if d.delivery_date])
delivery_date_list = [d.delivery_date for d in self.get("items") if d.delivery_date]
self.delivery_date = max(delivery_date_list) if delivery_date_list else None
if self.delivery_date:
for d in self.get("items"):
if not d.delivery_date: