From 13f6d26cd9e5ee6c713ffd801c3c8b192e5ca887 Mon Sep 17 00:00:00 2001 From: Dossogne Bertrand Date: Mon, 28 Nov 2022 16:44:44 +0000 Subject: [PATCH] [FIX] hr_contract: fix tooltip warning When the contract has a working schedule different from the employee's, a red triangle appears with a tooltip explaining the reason. That tooltip was implemented in the arch view using data-tooltip, which is not intended. This commit adds an owl widget replacing that issue. In order to test that tooltip warning, it's only needed to go on any running contract and change the resource_calendar so it's different to the one on the employee's page. Same process on the employee form. closes odoo/odoo#106760 Signed-off-by: Kevin Baptiste --- .../src/widgets/tooltip_warning_widget.js | 17 ++++++++++ .../src/widgets/tooltip_warning_widget.xml | 10 ++++++ .../hr_contract/views/hr_contract_views.xml | 34 ++++++++----------- 3 files changed, 42 insertions(+), 19 deletions(-) create mode 100644 addons/hr_contract/static/src/widgets/tooltip_warning_widget.js create mode 100644 addons/hr_contract/static/src/widgets/tooltip_warning_widget.xml diff --git a/addons/hr_contract/static/src/widgets/tooltip_warning_widget.js b/addons/hr_contract/static/src/widgets/tooltip_warning_widget.js new file mode 100644 index 00000000000..17a5f2dd7bc --- /dev/null +++ b/addons/hr_contract/static/src/widgets/tooltip_warning_widget.js @@ -0,0 +1,17 @@ +/** @odoo-module **/ + +import { registry } from "@web/core/registry"; +import { _t } from "@web/core/l10n/translation"; + +const { Component } = owl; + +export class ContractWarningTooltip extends Component { + get tooltipInfo() { + return JSON.stringify({ + "text" : _t("Calendar Mismatch : The employee's calendar does not match this contract's calendar. This could lead to unexpected behaviors."), + }) + } +} +ContractWarningTooltip.template = "hr_contract.ContractWarningTooltip"; + +registry.category("view_widgets").add("contract_warning_tooltip", ContractWarningTooltip); diff --git a/addons/hr_contract/static/src/widgets/tooltip_warning_widget.xml b/addons/hr_contract/static/src/widgets/tooltip_warning_widget.xml new file mode 100644 index 00000000000..3e1c6ded16c --- /dev/null +++ b/addons/hr_contract/static/src/widgets/tooltip_warning_widget.xml @@ -0,0 +1,10 @@ + + + + + + + diff --git a/addons/hr_contract/views/hr_contract_views.xml b/addons/hr_contract/views/hr_contract_views.xml index e3c6fa9cb1b..518dfa45805 100644 --- a/addons/hr_contract/views/hr_contract_views.xml +++ b/addons/hr_contract/views/hr_contract_views.xml @@ -19,15 +19,10 @@