[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
pull/2780/head
tarteo 2023-03-01 15:55:42 +01:00 committed by maciej-wichowski
parent 564aa5179c
commit b878a1a6d5
11 changed files with 118 additions and 133 deletions

View File

@ -2,10 +2,13 @@
Clickable many2one fields for tree views Clickable many2one fields for tree views
======================================== ========================================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2b8b8f544159751e2d6eec3db8f694788e672e6ccde284cf0783987f58441d3a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status :target: https://odoo-community.org/page/development-status
@ -14,14 +17,14 @@ Clickable many2one fields for tree views
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/15.0/web_tree_many2one_clickable :target: https://github.com/OCA/web/tree/16.0/web_tree_many2one_clickable
:alt: OCA/web :alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_tree_many2one_clickable :target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_tree_many2one_clickable
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/162/15.0 :target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=16.0
:alt: Try me on Runbot :alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@ -39,7 +42,7 @@ Usage
Put the mouse pointer over a many2one cell and click the button. Put the mouse pointer over a many2one cell and click the button.
.. image:: https://raw.githubusercontent.com/OCA/web/15.0/web_tree_many2one_clickable/static/img/clickable.gif .. image:: https://raw.githubusercontent.com/OCA/web/16.0/web_tree_many2one_clickable/static/img/clickable.gif
Known issues / Roadmap Known issues / Roadmap
====================== ======================
@ -55,8 +58,8 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_tree_many2one_clickable%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/web/issues/new?body=module:%20web_tree_many2one_clickable%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues. Do not contact contributors directly about support or help with technical issues.
@ -69,6 +72,7 @@ Authors
* Therp BV * Therp BV
* Tecnativa * Tecnativa
* Camptocamp * Camptocamp
* Onestein
Contributors Contributors
~~~~~~~~~~~~ ~~~~~~~~~~~~
@ -80,6 +84,7 @@ Contributors
* Artem Kostyuk <a.kostyuk@mobilunity.com> * Artem Kostyuk <a.kostyuk@mobilunity.com>
* Anand Kansagra <kansagraanand@hotmail.com> * Anand Kansagra <kansagraanand@hotmail.com>
* Alexandre Díaz <alexandre.diaz@tecnativa.com> * Alexandre Díaz <alexandre.diaz@tecnativa.com>
* Dennis Sluijk <d.sluijk@onestein.nl>
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~
@ -94,6 +99,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/web <https://github.com/OCA/web/tree/15.0/web_tree_many2one_clickable>`_ project on GitHub. This module is part of the `OCA/web <https://github.com/OCA/web/tree/16.0/web_tree_many2one_clickable>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -7,12 +7,13 @@
{ {
"name": "Clickable many2one fields for tree views", "name": "Clickable many2one fields for tree views",
"summary": "Open the linked resource when clicking on their name", "summary": "Open the linked resource when clicking on their name",
"version": "15.0.1.0.0", "version": "16.0.1.0.0",
"category": "Hidden", "category": "Hidden",
"website": "https://github.com/OCA/web", "website": "https://github.com/OCA/web",
"author": "Therp BV, " "author": "Therp BV, "
"Tecnativa, " "Tecnativa, "
"Camptocamp, " "Camptocamp, "
"Onestein, "
"Odoo Community Association (OCA)", "Odoo Community Association (OCA)",
"license": "AGPL-3", "license": "AGPL-3",
"installable": True, "installable": True,
@ -20,10 +21,12 @@
"data": [], "data": [],
"assets": { "assets": {
"web.assets_backend": [ "web.assets_backend": [
"web_tree_many2one_clickable/static/src/js/*.js", "web_tree_many2one_clickable/static/src/components/"
], "many2one_button/many2one_button.esm.js",
"web.assets_common": [ "web_tree_many2one_clickable/static/src/components/"
"web_tree_many2one_clickable/static/src/css/web_tree_many2one_clickable.scss", "many2one_button/many2one_button.scss",
], "web_tree_many2one_clickable/static/src/components/"
"many2one_button/many2one_button.xml",
]
}, },
} }

View File

@ -3,7 +3,7 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 15.0\n" "Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"

View File

@ -1,14 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=1; plural=0;\n"

View File

@ -5,3 +5,4 @@
* Artem Kostyuk <a.kostyuk@mobilunity.com> * Artem Kostyuk <a.kostyuk@mobilunity.com>
* Anand Kansagra <kansagraanand@hotmail.com> * Anand Kansagra <kansagraanand@hotmail.com>
* Alexandre Díaz <alexandre.diaz@tecnativa.com> * Alexandre Díaz <alexandre.diaz@tecnativa.com>
* Dennis Sluijk <d.sluijk@onestein.nl>

View File

@ -3,18 +3,18 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Clickable many2one fields for tree views</title> <title>Clickable many2one fields for tree views</title>
<style type="text/css"> <style type="text/css">
/* /*
:Author: David Goodger (goodger@python.org) :Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $ :Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Copyright: This stylesheet has been placed in the public domain. :Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils. Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet. customize this style sheet.
*/ */
@ -366,57 +366,60 @@ ul.auto-toc {
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2b8b8f544159751e2d6eec3db8f694788e672e6ccde284cf0783987f58441d3a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" 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" 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" href="https://github.com/OCA/web/tree/15.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" href="https://translation.odoo-community.org/projects/web-15-0/web-15-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" href="https://runbot.odoo-community.org/runbot/162/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <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/16.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-16-0/web-16-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&amp;target_branch=16.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 <p>This addon forces Odoo to use many2one widget on a many2one fields in
tree views. This allows users to open linked resources from trees directly, tree views. This allows users to open linked resources from trees directly,
using a button without accessing the form.</p> using a button without accessing the form.</p>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents"> <div class="contents local topic" id="contents">
<ul class="simple"> <ul class="simple">
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li> <li><a class="reference internal" href="#usage" id="toc-entry-1">Usage</a></li>
<li><a class="reference internal" href="#known-issues-roadmap" id="id2">Known issues / Roadmap</a></li> <li><a class="reference internal" href="#known-issues-roadmap" id="toc-entry-2">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li> <li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul> <li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id5">Authors</a></li> <li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li> <li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li> <li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</div> </div>
<div class="section" id="usage"> <div class="section" id="usage">
<h1><a class="toc-backref" href="#id1">Usage</a></h1> <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<p>Put the mouse pointer over a many2one cell and click the button.</p> <p>Put the mouse pointer over a many2one cell and click the button.</p>
<img alt="https://raw.githubusercontent.com/OCA/web/15.0/web_tree_many2one_clickable/static/img/clickable.gif" src="https://raw.githubusercontent.com/OCA/web/15.0/web_tree_many2one_clickable/static/img/clickable.gif" /> <img alt="https://raw.githubusercontent.com/OCA/web/16.0/web_tree_many2one_clickable/static/img/clickable.gif" src="https://raw.githubusercontent.com/OCA/web/16.0/web_tree_many2one_clickable/static/img/clickable.gif" />
</div> </div>
<div class="section" id="known-issues-roadmap"> <div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#id2">Known issues / Roadmap</a></h1> <h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>
<p>This widget is currently not working on the product field in the lines tree of the <p>This widget is currently not working on the product field in the lines tree of the
sale order form, see <a class="reference external" href="https://github.com/OCA/web/pull/1438">https://github.com/OCA/web/pull/1438</a> for further details.</p> sale order form, see <a class="reference external" href="https://github.com/OCA/web/pull/1438">https://github.com/OCA/web/pull/1438</a> for further details.</p>
<p>To add this functionality to lines of sales, purchases and invoices, as they are <p>To add this functionality to lines of sales, purchases and invoices, as they are
special views, is required a glue module that add this feature.</p> special views, is required a glue module that add this feature.</p>
</div> </div>
<div class="section" id="bug-tracker"> <div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1> <h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_tree_many2one_clickable%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_tree_many2one_clickable%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
<h1><a class="toc-backref" href="#id4">Credits</a></h1> <h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
<div class="section" id="authors"> <div class="section" id="authors">
<h2><a class="toc-backref" href="#id5">Authors</a></h2> <h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Therp BV</li> <li>Therp BV</li>
<li>Tecnativa</li> <li>Tecnativa</li>
<li>Camptocamp</li> <li>Camptocamp</li>
<li>Onestein</li>
</ul> </ul>
</div> </div>
<div class="section" id="contributors"> <div class="section" id="contributors">
<h2><a class="toc-backref" href="#id6">Contributors</a></h2> <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Therp BV</li> <li>Therp BV</li>
<li>Pedro M. Baeza &lt;<a class="reference external" href="mailto:pedro.baeza&#64;serviciosbaeza.com">pedro.baeza&#64;serviciosbaeza.com</a>&gt;</li> <li>Pedro M. Baeza &lt;<a class="reference external" href="mailto:pedro.baeza&#64;serviciosbaeza.com">pedro.baeza&#64;serviciosbaeza.com</a>&gt;</li>
@ -425,16 +428,17 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Artem Kostyuk &lt;<a class="reference external" href="mailto:a.kostyuk&#64;mobilunity.com">a.kostyuk&#64;mobilunity.com</a>&gt;</li> <li>Artem Kostyuk &lt;<a class="reference external" href="mailto:a.kostyuk&#64;mobilunity.com">a.kostyuk&#64;mobilunity.com</a>&gt;</li>
<li>Anand Kansagra &lt;<a class="reference external" href="mailto:kansagraanand&#64;hotmail.com">kansagraanand&#64;hotmail.com</a>&gt;</li> <li>Anand Kansagra &lt;<a class="reference external" href="mailto:kansagraanand&#64;hotmail.com">kansagraanand&#64;hotmail.com</a>&gt;</li>
<li>Alexandre Díaz &lt;<a class="reference external" href="mailto:alexandre.diaz&#64;tecnativa.com">alexandre.diaz&#64;tecnativa.com</a>&gt;</li> <li>Alexandre Díaz &lt;<a class="reference external" href="mailto:alexandre.diaz&#64;tecnativa.com">alexandre.diaz&#64;tecnativa.com</a>&gt;</li>
<li>Dennis Sluijk &lt;<a class="reference external" href="mailto:d.sluijk&#64;onestein.nl">d.sluijk&#64;onestein.nl</a>&gt;</li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id7">Maintainers</a></h2> <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p> <p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/15.0/web_tree_many2one_clickable">OCA/web</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/16.0/web_tree_many2one_clickable">OCA/web</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>

View File

@ -0,0 +1,33 @@
/** @odoo-module */
/* Copyright 2013 Therp BV (<http://therp.nl>).
* Copyright 2015 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
* Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
* Copyright 2017 Sodexis <dev@sodexis.com>
* Copyright 2018 Camptocamp SA
* Copyright 2019 Alexandre Díaz <alexandre.diaz@tecnativa.com>
* 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});

View File

@ -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;
}
}

View File

@ -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>

View File

@ -1,10 +0,0 @@
td.o_many2one_cell {
a {
margin-left: 0.5em;
visibility: hidden;
}
&:hover a {
visibility: visible;
}
}

View File

@ -1,68 +0,0 @@
/* Copyright 2013 Therp BV (<http://therp.nl>).
* Copyright 2015 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
* Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
* Copyright 2017 Sodexis <dev@sodexis.com>
* Copyright 2018 Camptocamp SA
* Copyright 2019 Alexandre Díaz <alexandre.diaz@tecnativa.com>
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
odoo.define("web_tree_many2one_clickable.many2one_clickable", function (require) {
"use strict";
var ListRenderer = require("web.ListRenderer");
var ListFieldMany2One = require("web.relational_fields").ListFieldMany2One;
ListRenderer.include({
_renderBodyCell: function (record, node, colIndex, options) {
if (
!node.attrs.widget &&
node.attrs.name &&
this.state.fields[node.attrs.name] &&
this.state.fields[node.attrs.name].type === "many2one"
) {
// No explicit widget provided on a many2one field,
// force `many2one` widget
node.attrs.widget = "many2one";
}
return this._super(record, node, colIndex, options);
},
});
ListFieldMany2One.include({
_renderReadonly: function () {
this._super.apply(this, arguments);
var self = this;
if (!this.noOpen && this.value) {
// Replace '<a>' element
this.$el.removeClass("o_form_uri");
this.$el = $("<span/>", {
html: this.$el.html(),
class: this.$el.attr("class") + " o_field_text",
name: this.$el.attr("name"),
});
// Append button
var $a = $("<a/>", {
href: "#",
class: "o_form_uri btn btn-sm btn-secondary fa fa-angle-double-right",
}).on("click", function (ev) {
ev.preventDefault();
ev.stopPropagation();
self.do_action({
type: "ir.actions.act_window",
res_model: self.field.relation,
res_id: self.value.res_id,
views: [[false, "form"]],
target: "target",
context: self.record.getContext({
additionalContext: self.attrs.context || {},
}),
});
});
this.$el.append($a);
}
},
});
});