From 0cdbde26270357bb106e9a1ad4979c68e5a672b5 Mon Sep 17 00:00:00 2001 From: PicchiSeba Date: Tue, 10 Oct 2023 10:29:58 +0200 Subject: [PATCH] [FIX] fieldservice: edge-case NoneType + datetime.timedelta --- fieldservice/models/fsm_order.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fieldservice/models/fsm_order.py b/fieldservice/models/fsm_order.py index 9465a3a146..2f7ada5cd7 100644 --- a/fieldservice/models/fsm_order.py +++ b/fieldservice/models/fsm_order.py @@ -323,8 +323,9 @@ def _calc_scheduled_dates(self, vals): "scheduled_date_start", self.scheduled_date_start ) start_date = fields.Datetime.from_string(start_date_val) - date_to_with_delta = start_date + timedelta(hours=hours) - vals["scheduled_date_end"] = str(date_to_with_delta) + if start_date: + date_to_with_delta = start_date + timedelta(hours=hours) + vals["scheduled_date_end"] = str(date_to_with_delta) elif vals.get("scheduled_date_start") is not None: vals["scheduled_date_end"] = False