3
0
Fork 0

[MIG]web_field_tooltip: Migration to 17.0

17.0
manu 2024-07-24 10:16:30 +02:00
parent 9945b0a036
commit e74989d55f
12 changed files with 39 additions and 46 deletions

View File

@ -80,6 +80,12 @@ Contributors
- Benoit Aimont <benoit.aimont@acsone.eu> (https://www.acsone.eu/) - Benoit Aimont <benoit.aimont@acsone.eu> (https://www.acsone.eu/)
- `Sygel <https://sygel.es>`__:
- Manuel Regidor <manuel.regidor@sygel.es>
- Harald Panten <harald.panten@sygel.es>
- Valentín Vinagre <valentin.vinagre@sygel.es>
Maintainers Maintainers
----------- -----------

View File

@ -6,7 +6,7 @@
"name": "Web Field Tooltip", "name": "Web Field Tooltip",
"summary": """ "summary": """
Displays customizable tooltips for fields""", Displays customizable tooltips for fields""",
"version": "16.0.1.1.0", "version": "17.0.1.0.0",
"license": "AGPL-3", "license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)", "author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web", "website": "https://github.com/OCA/web",

View File

@ -1 +1,6 @@
- Benoit Aimont \<<benoit.aimont@acsone.eu>\> (<https://www.acsone.eu/>) - Benoit Aimont \<<benoit.aimont@acsone.eu>\> (<https://www.acsone.eu/>)
- [Sygel](https://sygel.es):
- Manuel Regidor \<<manuel.regidor@sygel.es>\>
- Harald Panten \<<harald.panten@sygel.es>\>
- Valentín Vinagre \<<valentin.vinagre@sygel.es>\>

View File

@ -427,6 +427,12 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2> <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Benoit Aimont &lt;<a class="reference external" href="mailto:benoit.aimont&#64;acsone.eu">benoit.aimont&#64;acsone.eu</a>&gt; (<a class="reference external" href="https://www.acsone.eu/">https://www.acsone.eu/</a>)</li> <li>Benoit Aimont &lt;<a class="reference external" href="mailto:benoit.aimont&#64;acsone.eu">benoit.aimont&#64;acsone.eu</a>&gt; (<a class="reference external" href="https://www.acsone.eu/">https://www.acsone.eu/</a>)</li>
<li><a class="reference external" href="https://sygel.es">Sygel</a>:<ul>
<li>Manuel Regidor &lt;<a class="reference external" href="mailto:manuel.regidor&#64;sygel.es">manuel.regidor&#64;sygel.es</a>&gt;</li>
<li>Harald Panten &lt;<a class="reference external" href="mailto:harald.panten&#64;sygel.es">harald.panten&#64;sygel.es</a>&gt;</li>
<li>Valentín Vinagre &lt;<a class="reference external" href="mailto:valentin.vinagre&#64;sygel.es">valentin.vinagre&#64;sygel.es</a>&gt;</li>
</ul>
</li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">

View File

@ -4,7 +4,6 @@ import {Component, markup} from "@odoo/owl";
import {FormViewDialog} from "@web/views/view_dialogs/form_view_dialog"; import {FormViewDialog} from "@web/views/view_dialogs/form_view_dialog";
import {session} from "@web/session"; import {session} from "@web/session";
import {usePopover} from "@web/core/popover/popover_hook";
import {useService} from "@web/core/utils/hooks"; import {useService} from "@web/core/utils/hooks";
export class FieldTooltipPopover extends Component {} export class FieldTooltipPopover extends Component {}
@ -12,7 +11,7 @@ FieldTooltipPopover.template = "web_field_tooltip.FieldTooltipPopover";
export class FieldTooltip extends Component { export class FieldTooltip extends Component {
setup() { setup() {
this.popover = usePopover(); this.popover = useService("popover");
this.tooltipPopover = null; this.tooltipPopover = null;
this.hasFieldTooltip = this.props.hasFieldTooltip; this.hasFieldTooltip = this.props.hasFieldTooltip;
this.canManageTooltip = session.can_manage_tooltips; this.canManageTooltip = session.can_manage_tooltips;

View File

@ -1,4 +1,5 @@
sup.field-tooltip { sup.field-tooltip {
padding-top: 6px;
.tooltip-icon { .tooltip-icon {
background: none; background: none;
border: none; border: none;

View File

@ -1,18 +1,18 @@
/** @odoo-module **/ /** @odoo-module **/
import {FormController} from "@web/views/form/form_controller"; import {FormController} from "@web/views/form/form_controller";
import {_t} from "@web/core/l10n/translation";
import {patch} from "@web/core/utils/patch"; import {patch} from "@web/core/utils/patch";
import {session} from "@web/session"; import {session} from "@web/session";
patch(FormController.prototype, "web_field_tooltip", { const web_field_tooltip = {
getActionMenuItems() { get actionMenuItems() {
const menuItems = this._super(...arguments); const menuItems = super.actionMenuItems;
const otherMenuItems = menuItems.other; const otherMenuItems = menuItems.action;
if (session.can_manage_tooltips) { if (session.can_manage_tooltips) {
otherMenuItems.push({ otherMenuItems.push({
key: "manage_tooltips", key: "manage_tooltips",
description: this.env._t("Manage tooltips"), description: _t("Manage tooltips"),
callback: () => this.manageTooltips(), callback: () => this.manageTooltips(),
}); });
} }
@ -31,4 +31,6 @@ patch(FormController.prototype, "web_field_tooltip", {
} }
); );
}, },
}); };
patch(FormController.prototype, web_field_tooltip);

View File

@ -7,7 +7,7 @@ import {patch} from "@web/core/utils/patch";
import {session} from "@web/session"; import {session} from "@web/session";
patch(FormLabel.prototype, "web_field_tooltip", { const web_field_tooltip = {
get showTooltipAddHelper() { get showTooltipAddHelper() {
return session.tooltip_show_add_helper; return session.tooltip_show_add_helper;
}, },
@ -27,7 +27,9 @@ patch(FormLabel.prototype, "web_field_tooltip", {
fieldName: props.fieldName, fieldName: props.fieldName,
}; };
}, },
}); };
patch(FormLabel.prototype, web_field_tooltip);
FormLabel.components = Object.assign({}, FormLabel.components, { FormLabel.components = Object.assign({}, FormLabel.components, {
FieldTooltip, FieldTooltip,

View File

@ -7,7 +7,7 @@ import {patch} from "@web/core/utils/patch";
import {session} from "@web/session"; import {session} from "@web/session";
patch(ListRenderer.prototype, "web_field_tooltip", { const web_field_tooltip = {
showTooltipAddHelper() { showTooltipAddHelper() {
return session.tooltip_show_add_helper; return session.tooltip_show_add_helper;
}, },
@ -29,7 +29,9 @@ patch(ListRenderer.prototype, "web_field_tooltip", {
fieldName: fieldName, fieldName: fieldName,
}; };
}, },
}); };
patch(ListRenderer.prototype, web_field_tooltip);
ListRenderer.components = Object.assign({}, ListRenderer.components, { ListRenderer.components = Object.assign({}, ListRenderer.components, {
FieldTooltip, FieldTooltip,

View File

@ -13,7 +13,7 @@
name="web_ribbon" name="web_ribbon"
title="Archived" title="Archived"
bg_color="bg-danger" bg_color="bg-danger"
attrs="{'invisible': [('active', '=', True)]}" invisible="active"
/> />
<group name="first"> <group name="first">
<group name="left"> <group name="left">

View File

@ -13,7 +13,7 @@
name="tooltip_show_add_helper" name="tooltip_show_add_helper"
widget="boolean_toggle" widget="boolean_toggle"
readonly="0" readonly="0"
attrs="{'invisible': [('tooltip_show_add_helper_allowed', '=', False)]}" invisible="not tooltip_show_add_helper_allowed"
/> />
</xpath> </xpath>
</field> </field>

View File

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2023 ACSONE SA/NV
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<template
id="web_field_tooltip_asset"
inherit_id="web.assets_backend"
name="Web Field Tooltip assets"
>
<xpath expr="." position="inside">
<link
rel="stylesheet"
href="web_field_tooltip/static/src/css/web_field_tooltip.css"
/>
<script
type="text/javascript"
src="/web_field_tooltip/static/src/js/controller.js"
/>
<script
type="text/javascript"
src="/web_field_tooltip/static/src/js/renderer.js"
/>
<script
type="text/javascript"
src="/web_field_tooltip/static/src/js/web_field_tooltip.js"
/>
</xpath>
</template>
</odoo>