Skip to content
Snippets Groups Projects
Commit 61ae0b4e authored by Audric Onockx (auon)'s avatar Audric Onockx (auon) Committed by Laurent Stukkens (LTU)
Browse files

[FIX] hr_timesheet : round time on task


Steps :
- Install Sales & Timesheets
- Timesheets > Settings > Time Encoding :
	- Min duration : 60 min
	- Rounding up : 15 min
- Create a Project P
- Create a Product S :
	- Product Type : Service
	- Service Invoicing Policy : Timesheets on tasks
	- Service Tracking : Create a task in an existing project
	- Project : P
- Create a Sales Order SO and add S
- SO > 1 Tasks (smart button) as T > Timesheets (tab) > Add a line :
	- Employee : Mitchell Admin
	- Duration : 0

- Timesheets > Start :
	- Time : 1:09
	- Project : P
	- Task : SO:S
- T > Timesheets (tab) : Note Time = 1:15 (Min duration + Roundup)

- T > Start and Stop
- Confirm Time Spent Wizard : Note Duration = 1:00 (Min Duration)
	- Duration : 1:09
- Save and T > Timesheets (tab) : Note Time = 1:09

Issue:
- Unconsistent behaviors :
	The time is rounded when using Timesheets' timer and from Task's timer to Confirm Time Spent Wizard
	but it is not rounded when confirming the Wizard.

Fix:
- Round it in when confirming the wizard too.

opw-2672249

closes odoo/odoo#80977

X-original-commit: 3e78c0db
Related: odoo/enterprise#22762
Signed-off-by: default avatarLaurent Stukkens (ltu) <ltu@odoo.com>
parent 6f82fa59
Branches
Tags
No related merge requests found
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
from datetime import datetime
from odoo import fields, models
class ProjectTaskCreateTimesheet(models.TransientModel):
......@@ -20,16 +19,10 @@ class ProjectTaskCreateTimesheet(models.TransientModel):
)
def save_timesheet(self):
values = {
'task_id': self.task_id.id,
'project_id': self.task_id.project_id.id,
'date': fields.Date.context_today(self),
'name': self.description,
'user_id': self.env.uid,
'unit_amount': self.time_spent,
}
self.task_id.user_timer_id.unlink()
return self.env['account.analytic.line'].create(values)
# Deprecated the method in hr_timesheet and overridden in timesheet_grid as config has moved to timesheet_grid.
# Move the whole wizard to timesheet_grid in master.
return self.env['account.analytic.line']
def action_delete_timesheet(self):
self.task_id.user_timer_id.unlink()
# Deprecated the method in hr_timesheet and overridden in timesheet_grid as timer mixin has moved to enterprise.
return True
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment