Skip to content

Commit

Permalink
[MIG] web_tree_many2one_clickable: Migration to 16.0
Browse files Browse the repository at this point in the history
[MIG] web_tree_many2one_clickable: Migration to 16.0

[MIG] web_tree_many2one_clickable: Migration to 16.0

[MIG] web_tree_many2one_clickable: Migration to 16.0
  • Loading branch information
tarteo committed Mar 1, 2023
1 parent a35adee commit efe053e
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 84 deletions.
15 changes: 9 additions & 6 deletions web_tree_many2one_clickable/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,26 @@
{
"name": "Clickable many2one fields for tree views",
"summary": "Open the linked resource when clicking on their name",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"category": "Hidden",
"website": "https://github.com/OCA/web",
"author": "Therp BV, "
"Tecnativa, "
"Camptocamp, "
"Onestein, "
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": ["web"],
"data": [],
"assets": {
"web.assets_backend": [
"web_tree_many2one_clickable/static/src/js/*.js",
],
"web.assets_common": [
"web_tree_many2one_clickable/static/src/css/web_tree_many2one_clickable.scss",
],
"web_tree_many2one_clickable/static/src/components/"
"many2one_button/many2one_button.esm.js",
"web_tree_many2one_clickable/static/src/components/"
"many2one_button/many2one_button.scss",
"web_tree_many2one_clickable/static/src/components/"
"many2one_button/many2one_button.xml",
]
},
}
1 change: 1 addition & 0 deletions web_tree_many2one_clickable/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
* Artem Kostyuk <[email protected]>
* Anand Kansagra <[email protected]>
* Alexandre Díaz <[email protected]>
* Dennis Sluijk <[email protected]>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/** @odoo-module */
/* Copyright 2013 Therp BV (<http://therp.nl>).
* Copyright 2015 Pedro M. Baeza <[email protected]>
* Copyright 2016 Antonio Espinosa <[email protected]>
* Copyright 2017 Sodexis <[email protected]>
* Copyright 2018 Camptocamp SA
* Copyright 2019 Alexandre Díaz <[email protected]>
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */

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 {
setup() {
this.actionService = useService("action");
}

async onClick(ev) {
ev.stopPropagation();
return this.actionService.doAction({
type: "ir.actions.act_window",
res_model: this.props.field.relation,
res_id: this.props.value[0],
views: [[false, "form"]],
target: "target",
additionalContext: this.props.context || {},
});
}
}
TreeMany2oneClickableButton.template = "web_tree_many2one_clickable.Button";

Object.assign(ListRenderer.components, {TreeMany2oneClickableButton});
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
td.o_list_many2one {
button.web_tree_many2one_clickable {
margin-left: 0.5em;
visibility: hidden;
}

&:hover button.web_tree_many2one_clickable {
visibility: visible;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates>
<t t-name="web_tree_many2one_clickable.Button" owl="1">
<button
class="btn btn-sm btn-secondary fa fa-arrow-right web_tree_many2one_clickable"
t-on-click="onClick"
>
</button>
</t>

<t t-inherit="web.ListRenderer.RecordRow" t-inherit-mode="extension">
<xpath expr="//Field" position="after">
<TreeMany2oneClickableButton
record="record"
field="record.fields[column.name]"
value="record.data[column.name]"
t-if="record.fields[column.name].type == 'many2one' and record.data[column.name] and canUseFormatter(column, record) and !props.archInfo.fieldNodes[column.name].options.no_open"
/>
</xpath>
</t>
</templates>

This file was deleted.

This file was deleted.

0 comments on commit efe053e

Please sign in to comment.