Skip to content

Commit efe053e

Browse files
committed
[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 [MIG] web_tree_many2one_clickable: Migration to 16.0
1 parent a35adee commit efe053e

File tree

7 files changed

+74
-84
lines changed

7 files changed

+74
-84
lines changed

web_tree_many2one_clickable/__manifest__.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,26 @@
77
{
88
"name": "Clickable many2one fields for tree views",
99
"summary": "Open the linked resource when clicking on their name",
10-
"version": "15.0.1.0.0",
10+
"version": "16.0.1.0.0",
1111
"category": "Hidden",
1212
"website": "https://github.com/OCA/web",
1313
"author": "Therp BV, "
1414
"Tecnativa, "
1515
"Camptocamp, "
16+
"Onestein, "
1617
"Odoo Community Association (OCA)",
1718
"license": "AGPL-3",
1819
"installable": True,
1920
"depends": ["web"],
2021
"data": [],
2122
"assets": {
2223
"web.assets_backend": [
23-
"web_tree_many2one_clickable/static/src/js/*.js",
24-
],
25-
"web.assets_common": [
26-
"web_tree_many2one_clickable/static/src/css/web_tree_many2one_clickable.scss",
27-
],
24+
"web_tree_many2one_clickable/static/src/components/"
25+
"many2one_button/many2one_button.esm.js",
26+
"web_tree_many2one_clickable/static/src/components/"
27+
"many2one_button/many2one_button.scss",
28+
"web_tree_many2one_clickable/static/src/components/"
29+
"many2one_button/many2one_button.xml",
30+
]
2831
},
2932
}

web_tree_many2one_clickable/readme/CONTRIBUTORS.rst

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
* Artem Kostyuk <a.kostyuk@mobilunity.com>
66
* Anand Kansagra <kansagraanand@hotmail.com>
77
* Alexandre Díaz <alexandre.diaz@tecnativa.com>
8+
* Dennis Sluijk <d.sluijk@onestein.nl>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/** @odoo-module */
2+
/* Copyright 2013 Therp BV (<http://therp.nl>).
3+
* Copyright 2015 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
4+
* Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
5+
* Copyright 2017 Sodexis <dev@sodexis.com>
6+
* Copyright 2018 Camptocamp SA
7+
* Copyright 2019 Alexandre Díaz <alexandre.diaz@tecnativa.com>
8+
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
9+
10+
import {ListRenderer} from "@web/views/list/list_renderer";
11+
import {Component} from "@odoo/owl";
12+
import {useService} from "@web/core/utils/hooks";
13+
14+
export class TreeMany2oneClickableButton extends Component {
15+
setup() {
16+
this.actionService = useService("action");
17+
}
18+
19+
async onClick(ev) {
20+
ev.stopPropagation();
21+
return this.actionService.doAction({
22+
type: "ir.actions.act_window",
23+
res_model: this.props.field.relation,
24+
res_id: this.props.value[0],
25+
views: [[false, "form"]],
26+
target: "target",
27+
additionalContext: this.props.context || {},
28+
});
29+
}
30+
}
31+
TreeMany2oneClickableButton.template = "web_tree_many2one_clickable.Button";
32+
33+
Object.assign(ListRenderer.components, {TreeMany2oneClickableButton});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
td.o_list_many2one {
2+
button.web_tree_many2one_clickable {
3+
margin-left: 0.5em;
4+
visibility: hidden;
5+
}
6+
7+
&:hover button.web_tree_many2one_clickable {
8+
visibility: visible;
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<templates>
3+
<t t-name="web_tree_many2one_clickable.Button" owl="1">
4+
<button
5+
class="btn btn-sm btn-secondary fa fa-arrow-right web_tree_many2one_clickable"
6+
t-on-click="onClick"
7+
>
8+
</button>
9+
</t>
10+
11+
<t t-inherit="web.ListRenderer.RecordRow" t-inherit-mode="extension">
12+
<xpath expr="//Field" position="after">
13+
<TreeMany2oneClickableButton
14+
record="record"
15+
field="record.fields[column.name]"
16+
value="record.data[column.name]"
17+
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"
18+
/>
19+
</xpath>
20+
</t>
21+
</templates>

web_tree_many2one_clickable/static/src/css/web_tree_many2one_clickable.scss

-10
This file was deleted.

web_tree_many2one_clickable/static/src/js/web_tree_many2one_clickable.js

-68
This file was deleted.

0 commit comments

Comments
 (0)