diff --git a/web_tree_many2one_clickable/README.rst b/web_tree_many2one_clickable/README.rst index 47d0286fe..f3d2ebafe 100644 --- a/web_tree_many2one_clickable/README.rst +++ b/web_tree_many2one_clickable/README.rst @@ -2,7 +2,7 @@ Clickable many2one fields for tree views ======================================== -.. +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! @@ -88,6 +88,7 @@ Contributors - Anand Kansagra - Alexandre Díaz - Dennis Sluijk +- Maciej Wichowski Maintainers ----------- diff --git a/web_tree_many2one_clickable/__manifest__.py b/web_tree_many2one_clickable/__manifest__.py index b5847d3cc..b99b78fef 100644 --- a/web_tree_many2one_clickable/__manifest__.py +++ b/web_tree_many2one_clickable/__manifest__.py @@ -7,7 +7,7 @@ { "name": "Clickable many2one fields for tree views", "summary": "Open the linked resource when clicking on their name", - "version": "16.0.1.0.0", + "version": "17.0.1.0.0", "category": "Hidden", "website": "https://github.com/OCA/web", "author": "Therp BV, " diff --git a/web_tree_many2one_clickable/readme/CONTRIBUTORS.md b/web_tree_many2one_clickable/readme/CONTRIBUTORS.md index 8c22eb86a..801d72d84 100644 --- a/web_tree_many2one_clickable/readme/CONTRIBUTORS.md +++ b/web_tree_many2one_clickable/readme/CONTRIBUTORS.md @@ -6,3 +6,4 @@ - Anand Kansagra \<\> - Alexandre Díaz \<\> - Dennis Sluijk \<\> +- Maciej Wichowski \<\> diff --git a/web_tree_many2one_clickable/static/description/index.html b/web_tree_many2one_clickable/static/description/index.html index 69ccca8bf..3bd18c4d5 100644 --- a/web_tree_many2one_clickable/static/description/index.html +++ b/web_tree_many2one_clickable/static/description/index.html @@ -430,6 +430,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
  • Anand Kansagra <kansagraanand@hotmail.com>
  • Alexandre Díaz <alexandre.diaz@tecnativa.com>
  • Dennis Sluijk <d.sluijk@onestein.nl>
  • +
  • Maciej Wichowski <maciej@versada.eu>
  • @@ -445,4 +446,4 @@ promote its widespread use.

    - + \ No newline at end of file diff --git a/web_tree_many2one_clickable/static/src/components/many2one_button/many2one_button.esm.js b/web_tree_many2one_clickable/static/src/components/many2one_button/many2one_button.esm.js index df8c2ce92..46ed06e7e 100644 --- a/web_tree_many2one_clickable/static/src/components/many2one_button/many2one_button.esm.js +++ b/web_tree_many2one_clickable/static/src/components/many2one_button/many2one_button.esm.js @@ -5,29 +5,29 @@ * Copyright 2017 Sodexis * Copyright 2018 Camptocamp SA * Copyright 2019 Alexandre Díaz + * Copyright 2024 Versada (https://versada.eu) * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ +import {patch} from "@web/core/utils/patch"; import {ListRenderer} from "@web/views/list/list_renderer"; -import {Component} from "@odoo/owl"; import {useService} from "@web/core/utils/hooks"; -export class TreeMany2oneClickableButton extends Component { +patch(ListRenderer.prototype, { setup() { this.actionService = useService("action"); - } - - async onClick(ev) { + super.setup(...arguments); + }, + async onClickM2oButton(record, column, ev) { ev.stopPropagation(); + const field = record.fields[column.name]; + const value = record.data[column.name]; return this.actionService.doAction({ type: "ir.actions.act_window", - res_model: this.props.field.relation, - res_id: this.props.value[0], + res_model: field.relation, + res_id: value[0], views: [[false, "form"]], target: "target", - additionalContext: this.props.context || {}, + additionalContext: column.context || {}, }); - } -} -TreeMany2oneClickableButton.template = "web_tree_many2one_clickable.Button"; - -Object.assign(ListRenderer.components, {TreeMany2oneClickableButton}); + }, +}); diff --git a/web_tree_many2one_clickable/static/src/components/many2one_button/many2one_button.xml b/web_tree_many2one_clickable/static/src/components/many2one_button/many2one_button.xml index 89f688a18..41d2a84fd 100644 --- a/web_tree_many2one_clickable/static/src/components/many2one_button/many2one_button.xml +++ b/web_tree_many2one_clickable/static/src/components/many2one_button/many2one_button.xml @@ -1,21 +1,13 @@ - - - - - - + +