diff --git a/addons/hr_timesheet/static/src/components/timesheet_uom_no_toggle/timesheet_uom_no_toggle.js b/addons/hr_timesheet/static/src/components/timesheet_uom_no_toggle/timesheet_uom_no_toggle.js new file mode 100644 index 00000000000..91f35d701dd --- /dev/null +++ b/addons/hr_timesheet/static/src/components/timesheet_uom_no_toggle/timesheet_uom_no_toggle.js @@ -0,0 +1,20 @@ +/** @odoo-module */ + +import { registry } from "@web/core/registry"; + +import { TimesheetUOM } from "../timesheet_uom/timesheet_uom"; + + +export class TimesheetUOMNoToggle extends TimesheetUOM { + + get timesheetWidget() { + const timesheetWidget = super.timesheetWidget; + return timesheetWidget !== "float_toggle" ? timesheetWidget : "float_factor"; + } + +} + +// As FloatToggleField won't be used by TimesheetUOMNoToggle, we remove it from the components that we get from TimesheetUOM. +delete TimesheetUOMNoToggle.components.FloatToggleField; + +registry.category("fields").add("timesheet_uom_no_toggle", TimesheetUOMNoToggle);