From 5ab1cf6550898dbd2f844cf73aef00c36ebe83a6 Mon Sep 17 00:00:00 2001 From: Marcos Oitaben Date: Thu, 16 Nov 2023 11:04:12 +0100 Subject: [PATCH] [MIG] web_widget_open_tab: Migration to 17.0 --- web_widget_open_tab/__manifest__.py | 2 +- .../static/src/js/open_tab_widget.esm.js | 21 ++++++++++--------- .../static/src/xml/open_tab_widget.xml | 2 +- web_widget_open_tab/tests/__init__.py | 1 + web_widget_open_tab/tests/test_main.py | 21 +++++++++++++++++++ 5 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 web_widget_open_tab/tests/__init__.py create mode 100644 web_widget_open_tab/tests/test_main.py diff --git a/web_widget_open_tab/__manifest__.py b/web_widget_open_tab/__manifest__.py index 3d1439220955..280d50704ecc 100644 --- a/web_widget_open_tab/__manifest__.py +++ b/web_widget_open_tab/__manifest__.py @@ -5,7 +5,7 @@ "name": "Widget Open on new Tab", "summary": """ Allow to open record from trees on new tab from tree views""", - "version": "16.0.2.0.0", + "version": "17.0.1.0.0", "license": "AGPL-3", "author": "Creu Blanca,Odoo Community Association (OCA)", "website": "https://github.com/OCA/web", diff --git a/web_widget_open_tab/static/src/js/open_tab_widget.esm.js b/web_widget_open_tab/static/src/js/open_tab_widget.esm.js index 1bb997362d46..d306f8c0634d 100644 --- a/web_widget_open_tab/static/src/js/open_tab_widget.esm.js +++ b/web_widget_open_tab/static/src/js/open_tab_widget.esm.js @@ -1,9 +1,9 @@ /** @odoo-module */ +import {Component} from "@odoo/owl"; +import {_t} from "@web/core/l10n/translation"; import {registry} from "@web/core/registry"; import {standardFieldProps} from "@web/views/fields/standard_field_props"; -import {_lt} from "@web/core/l10n/translation"; -import {Component} from "@odoo/owl"; export class OpenTabWidget extends Component { openNewTab(ev) { @@ -13,7 +13,7 @@ export class OpenTabWidget extends Component { var url = window.location.href; var searchParams = new URLSearchParams(url.split("#")[1]); searchParams.set("view_type", "form"); - searchParams.set("id", this.props.value); + searchParams.set("id", this.props.record.data.id); if ( !searchParams.has("model") || searchParams.get("model") !== this.props.record.resModel @@ -34,12 +34,13 @@ OpenTabWidget.props = { title: {type: String, optional: true}, }; -OpenTabWidget.displayName = _lt("Open Tab"); -OpenTabWidget.supportedTypes = ["integer"]; -OpenTabWidget.extractProps = () => { - return { - title: _lt("Click to open on new tab"), - }; +export const openTabWidget = { + component: OpenTabWidget, + displayName: _t("Open Tab"), + supportedTypes: ["integer"], + extractProps: () => ({ + title: _t("Click to open on new tab"), + }), }; -registry.category("fields").add("open_tab", OpenTabWidget); +registry.category("fields").add("open_tab", openTabWidget); diff --git a/web_widget_open_tab/static/src/xml/open_tab_widget.xml b/web_widget_open_tab/static/src/xml/open_tab_widget.xml index b4e4197845d1..714b8559cb2a 100644 --- a/web_widget_open_tab/static/src/xml/open_tab_widget.xml +++ b/web_widget_open_tab/static/src/xml/open_tab_widget.xml @@ -1,6 +1,6 @@