[REF] hr_timesheet: convert timesheet_uom_no_toggle to owl

Tests adaptations will come in a following PR, but the current focus is set on owl conversion.

task-2936932

closes odoo/odoo#101500

X-original-commit: 78e15be0b58c0c964f1df79e95f17fcf72480a5b
Related: odoo/enterprise#31970
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
This commit is contained in:
Laurent Stukkens (LTU)
2022-10-02 10:08:43 +02:00
parent 1cd610a9b6
commit 6e81d6c278
@@ -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);