[FIX] mrp: timer wrong values on list view
The value of the timer was wrong when timesheeting with multiple employees at the same time. The problem was that the compute duration already takes the current timesheets into account. So the problem was that we added some time that was already in the duration task id : 3216277 closes odoo/odoo#114901 Related: odoo/enterprise#38007 Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
This commit is contained in:
@@ -872,6 +872,10 @@ class MrpWorkorder(models.Model):
|
||||
duration += (datetime.now() - time.date_start).total_seconds() / 60
|
||||
return duration
|
||||
|
||||
def get_duration(self):
|
||||
self.ensure_one()
|
||||
return sum(self.time_ids.mapped('duration')) + self.get_working_duration()
|
||||
|
||||
def action_mark_as_done(self):
|
||||
for wo in self:
|
||||
if wo.working_state == 'blocked':
|
||||
@@ -885,7 +889,6 @@ class MrpWorkorder(models.Model):
|
||||
for wo in self:
|
||||
if wo.working_state == 'blocked':
|
||||
raise UserError(_('Some workorders require another workorder to be completed first'))
|
||||
for wo in self:
|
||||
wo.button_start()
|
||||
|
||||
def action_mass_pause(self):
|
||||
|
||||
@@ -104,12 +104,11 @@ class MrpTimerField extends Component {
|
||||
!this.props.record.model.useSampleModel &&
|
||||
this.props.record.data.state == "progress"
|
||||
) {
|
||||
const additionalDuration = await this.orm.call(
|
||||
this.duration = await this.orm.call(
|
||||
"mrp.workorder",
|
||||
"get_working_duration",
|
||||
"get_duration",
|
||||
[this.props.record.resId]
|
||||
);
|
||||
this.duration += additionalDuration;
|
||||
}
|
||||
});
|
||||
onWillUpdateProps((nextProps) => {
|
||||
|
||||
Reference in New Issue
Block a user