Skip to content
Snippets Groups Projects
Commit e628e662 authored by Christophe Simonis's avatar Christophe Simonis
Browse files

[FIX] hr_timesheet: add missing dependency for `timesheet_uom` widget


The `timesheet_uom` widget is a proxy to another widget (configurable
server-side). We need to ensure the widget registry is filled before
using it to avoid a fallback to `float_factor` widget.

closes odoo/odoo#34350

Signed-off-by: default avatarChristophe Simonis <chs@odoo.com>
parent 89d5cc3b
Branches
Tags
No related merge requests found
......@@ -6,6 +6,7 @@ var basicFields = require('web.basic_fields');
var fieldUtils = require('web.field_utils');
var fieldRegistry = require('web.field_registry');
var _registry = require('web._field_registry'); // wait registry to be filled...
var session = require('web.session');
/**
......@@ -75,7 +76,6 @@ var FieldTimesheetToggle = basicFields.FieldFloatToggle.extend({
* implementation (float_time, float_toggle, ...). The default
* value will be 'float_factor'.
**/
var FieldTimesheetUom = FieldTimesheetFactor;
var widgetName = 'timesheet_uom' in session ?
session.timesheet_uom.timesheet_widget : 'float_factor';
var FieldTimesheetUom = widgetName === 'float_toggle' ?
......@@ -90,7 +90,7 @@ var _tweak_options = function(options) {
options.factor = session.timesheet_uom_factor;
}
return options;
}
};
fieldUtils.format.timesheet_uom = function(value, field, options) {
options = _tweak_options(options || {});
......@@ -106,4 +106,3 @@ fieldUtils.parse.timesheet_uom = function(value, field, options) {
return FieldTimesheetUom;
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment