Skip to content
Snippets Groups Projects
Commit f0e07d0b authored by Ashmawy Walid (was)'s avatar Ashmawy Walid (was)
Browse files

[FIX] mrp: prevent crash if no date_end


closes odoo/odoo#73861

Signed-off-by: default avatarArnold Moyaux <amoyaux@users.noreply.github.com>
parent 632ed249
No related branches found
No related tags found
No related merge requests found
......@@ -165,7 +165,9 @@ class MrpWorkorder(models.Model):
if order.working_user_ids:
order.last_working_user_id = order.working_user_ids[-1]
elif order.time_ids:
order.last_working_user_id = order.time_ids.sorted('date_end')[-1].user_id
order.last_working_user_id = order.time_ids.filtered('date_end').sorted('date_end')[-1].user_id if order.time_ids.filtered('date_end') else order.time_ids[-1].user_id
else:
order.last_working_user_id = False
if order.time_ids.filtered(lambda x: (x.user_id.id == self.env.user.id) and (not x.date_end) and (x.loss_type in ('productive', 'performance'))):
order.is_user_working = True
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment