From 2f56c8c0bb559f9ac9f2defb393f02bd65d20b50 Mon Sep 17 00:00:00 2001 From: "Pieter Claeys (clpi)" Date: Thu, 21 Sep 2023 10:41:56 +0200 Subject: [PATCH] [IMP] mrp: time tracking consider now as end date When changing the duration on a time-tracking entry on a workorder, set the end time to now and calculate the start time by detracting the duration, instead of the other way around. Task: 3456827 (nr 35) Part-of: odoo/odoo#137535 --- addons/mrp/models/mrp_workcenter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/models/mrp_workcenter.py b/addons/mrp/models/mrp_workcenter.py index 5f1e347a062..a47697478dc 100644 --- a/addons/mrp/models/mrp_workcenter.py +++ b/addons/mrp/models/mrp_workcenter.py @@ -418,7 +418,7 @@ class MrpWorkcenterProductivity(models.Model): @api.onchange('duration') def _duration_changed(self): - self.date_end = self.date_start + timedelta(minutes=self.duration) + self.date_start = self.date_end - timedelta(minutes=self.duration) self._loss_type_change() @api.onchange('date_start')