Files
odoo_source/addons/hr_timesheet/models/ir_http.py
T
Anh Thao Pham (pta) b9e988040e [FIX] hr_timesheet: fix timesheets encoded in days
- Go to Timesheets > Configuration > Settings and select Days as Encoding Unit
- Go to Project and create a Project with Timesheets activated
- Open the created Project and create a Task
- Edit the task and encode a timesheet line with 1 Day duration
"Hours Spent" and "Remaining Hours" have incorrect values.
The 1 day encoded is computed as 1 hour.

Reverting: https://github.com/odoo/odoo/commit/2a7ec79c6a4563b608a4525ebccdea5978799caa

opw-2328603

closes odoo/odoo#57379

X-original-commit: 8b3eed7418d6eea870f5e65ae238a304c88bd9f5
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
2020-09-09 15:55:42 +00:00

22 lines
907 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class Http(models.AbstractModel):
_inherit = 'ir.http'
def session_info(self):
""" The widget 'timesheet_uom' needs to know which UoM conversion factor and which javascript
widget to apply, depending on th ecurrent company.
"""
result = super(Http, self).session_info()
if self.env.user.has_group('base.group_user'):
company = self.env.company
encoding_uom = company.timesheet_encode_uom_id
result['timesheet_uom'] = encoding_uom.read(['name', 'rounding', 'timesheet_widget'])[0]
result['timesheet_uom_factor'] = company.project_time_mode_id._compute_quantity(1.0, encoding_uom, round=False) # convert encoding uom into stored uom to get conversion factor
return result