mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[17.0][MIG] web_tree_many2one_clickable
This commit is contained in:
committed by
Carlos Roca
parent
d7742a6922
commit
0927889142
@@ -7,7 +7,7 @@ Clickable many2one fields for tree views
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:2b8b8f544159751e2d6eec3db8f694788e672e6ccde284cf0783987f58441d3a
|
||||
!! source digest: sha256:41451aef51a252c3aa3a636dafaddb337b6e192a91df1097b7e84aa517962b82
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||
@@ -88,6 +88,7 @@ Contributors
|
||||
- Anand Kansagra <kansagraanand@hotmail.com>
|
||||
- Alexandre Díaz <alexandre.diaz@tecnativa.com>
|
||||
- Dennis Sluijk <d.sluijk@onestein.nl>
|
||||
- Maciej Wichowski <maciej@versada.eu>
|
||||
|
||||
Maintainers
|
||||
-----------
|
||||
|
||||
@@ -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, "
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
"Language-Team: none\n"
|
||||
"Language: it\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Project-Id-Version: Odoo Server 17.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
|
||||
@@ -6,3 +6,4 @@
|
||||
- Anand Kansagra \<<kansagraanand@hotmail.com>\>
|
||||
- Alexandre Díaz \<<alexandre.diaz@tecnativa.com>\>
|
||||
- Dennis Sluijk \<<d.sluijk@onestein.nl>\>
|
||||
- Maciej Wichowski \<<maciej@versada.eu>\>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
@@ -367,7 +366,7 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:2b8b8f544159751e2d6eec3db8f694788e672e6ccde284cf0783987f58441d3a
|
||||
!! source digest: sha256:41451aef51a252c3aa3a636dafaddb337b6e192a91df1097b7e84aa517962b82
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/17.0/web_tree_many2one_clickable"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_tree_many2one_clickable"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This addon forces Odoo to use many2one widget on a many2one fields in
|
||||
@@ -430,6 +429,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
||||
<li>Anand Kansagra <<a class="reference external" href="mailto:kansagraanand@hotmail.com">kansagraanand@hotmail.com</a>></li>
|
||||
<li>Alexandre Díaz <<a class="reference external" href="mailto:alexandre.diaz@tecnativa.com">alexandre.diaz@tecnativa.com</a>></li>
|
||||
<li>Dennis Sluijk <<a class="reference external" href="mailto:d.sluijk@onestein.nl">d.sluijk@onestein.nl</a>></li>
|
||||
<li>Maciej Wichowski <<a class="reference external" href="mailto:maciej@versada.eu">maciej@versada.eu</a>></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
|
||||
@@ -5,29 +5,29 @@
|
||||
* Copyright 2017 Sodexis <dev@sodexis.com>
|
||||
* Copyright 2018 Camptocamp SA
|
||||
* Copyright 2019 Alexandre Díaz <alexandre.diaz@tecnativa.com>
|
||||
* 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});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,21 +1,13 @@
|
||||
<?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 expr="//t[@t-if='!isInvisible']" position="inside">
|
||||
<button
|
||||
class="btn btn-sm btn-secondary fa fa-arrow-right web_tree_many2one_clickable"
|
||||
t-on-click="(ev) => this.onClickM2oButton(record, column, ev)"
|
||||
t-if="record.fields[column.name].type == 'many2one' and record.data[column.name] and canUseFormatter(column, record) and !column.options.no_open"
|
||||
>
|
||||
</button>
|
||||
</xpath>
|
||||
</t>
|
||||
</templates>
|
||||
|
||||
Reference in New Issue
Block a user