Skip to content

Commit

Permalink
[FIX] fieldservice: edge-case NoneType + datetime.timedelta
Browse files Browse the repository at this point in the history
  • Loading branch information
PicchiSeba committed Oct 10, 2023
1 parent 7e6a8c9 commit 0cdbde2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fieldservice/models/fsm_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0cdbde2

Please sign in to comment.