[FIX] hr_timesheet: wrong uom factor in widget

- Install hr_timesheet and sales;
- Create a product, set it as a service product with units of
  measurement in days.
- Set the product as a task will be created from SO;
- Add a timesheet for one day to a task in a project (8 hours for
  instance);
- The smart button on the sales order shows the time logged for that
  project.

Before this commit, when the timesheet encoding unit is 'Hours', the
smart button shows the correct logged time (8 hours). But, when the
timesheet encoding unit is changed to 'Days', the samrt button shows
0.125 Days instead of 1 Day. This occurs because the uom used to create
the uom factor for the widget is not the Timesheet encoding unit.

opw-2301510

closes odoo/odoo#55544

X-original-commit: 2a7ec79c6a4563b608a4525ebccdea5978799caa
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
This commit is contained in:
Jorge Pinna Puissant
2020-08-06 11:00:12 +00:00
parent 7e8a1f7a06
commit 09bfca4d0c
+1 -1
View File
@@ -17,5 +17,5 @@ class Http(models.AbstractModel):
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
result['timesheet_uom_factor'] = company.timesheet_encode_uom_id._compute_quantity(1.0, encoding_uom, round=False) # convert encoding uom into stored uom to get conversion factor
return result