Browse Source

Merge pull request #876 from arkostyuk/11.0-mig-web_tree_many2one_clickable

[11.0][MIG] web_tree_many2one_clickable
pull/885/head
Pedro M. Baeza 7 years ago
committed by GitHub
parent
commit
dee7531636
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 60
      web_tree_many2one_clickable/README.rst
  2. 1
      web_tree_many2one_clickable/__init__.py
  3. 25
      web_tree_many2one_clickable/__manifest__.py
  4. BIN
      web_tree_many2one_clickable/static/description/icon.png
  5. 21
      web_tree_many2one_clickable/static/src/js/web_tree_many2one_clickable.js
  6. 12
      web_tree_many2one_clickable/static/src/xml/assets.xml

60
web_tree_many2one_clickable/README.rst

@ -0,0 +1,60 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
========================================
Clickable many2one fields for tree views
========================================
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,
without accessing the form.
Configuration
=============
After installation, all many2one and reference fields will be clickable by default.
Usage
=====
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/162/11.0
Bug Tracker
===========
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. If you spotted it first,
help us smash it by providing a detailed and welcomed feedback.
Credits
=======
Contributors
------------
* Therp BV
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
* Antonio Espinosa <antonio.espinosa@tecnativa.com>
* Sodexis <dev@sodexis.com>
* Artem Kostyuk <a.kostyuk@mobilunity.com>
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.

1
web_tree_many2one_clickable/__init__.py

@ -0,0 +1 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

25
web_tree_many2one_clickable/__manifest__.py

@ -0,0 +1,25 @@
# Copyright 2013 Therp BV (<http://therp.nl>).
# Copyright 2015 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# Copyright 2015 Antonio Espinosa <antonio.espinosa@tecnativa.com>
# Copyright 2017 Sodexis <dev@sodexis.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Clickable many2one fields for tree views",
"summary": "Open the linked resource when clicking on their name",
"version": "11.0.1.0.0",
"category": "Hidden",
"website": "https://github.com/OCA/web",
"author": "Therp BV, "
"Tecnativa, "
"Camptocamp, "
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": [
'web',
],
"data": [
'static/src/xml/assets.xml',
],
}

BIN
web_tree_many2one_clickable/static/description/icon.png

After

Width: 80  |  Height: 80  |  Size: 7.8 KiB

21
web_tree_many2one_clickable/static/src/js/web_tree_many2one_clickable.js

@ -0,0 +1,21 @@
/* 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
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
odoo.define('web_tree_many2one_clickable.many2one_clickable', function (require) {
var ListRenderer = require('web.ListRenderer');
ListRenderer.include({
_renderBodyCell: function (record, node, colIndex, options) {
if (!node.attrs.widget && 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);
}
});
});

12
web_tree_many2one_clickable/static/src/xml/assets.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2015 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<template id="assets_backend" name="web_tree_many2one_clickable assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/web_tree_many2one_clickable/static/src/js/web_tree_many2one_clickable.js"/>
</xpath>
</template>
</odoo>
Loading…
Cancel
Save