From e628e662719c19c7a9e1b95ffae72d74565dcdee Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 25 Jun 2019 09:27:23 +0000 Subject: [PATCH] [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: Christophe Simonis --- addons/hr_timesheet/static/src/js/timesheet_uom.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/hr_timesheet/static/src/js/timesheet_uom.js b/addons/hr_timesheet/static/src/js/timesheet_uom.js index 503b923488c..345012d80e5 100644 --- a/addons/hr_timesheet/static/src/js/timesheet_uom.js +++ b/addons/hr_timesheet/static/src/js/timesheet_uom.js @@ -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; }); -