3
0
Fork 0

[MIG][12.0] web_widget_child_selector

14.0
Enric Tobella 2020-02-19 23:23:44 +01:00 committed by Olga Marco
parent 41719e093e
commit 16e2aa7055
7 changed files with 38 additions and 19 deletions

View File

@ -14,13 +14,13 @@ Web Widget Child Selector
: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/11.0/web_widget_child_selector :target: https://github.com/OCA/web/tree/12.0/web_widget_child_selector
: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-11-0/web-11-0-web_widget_child_selector :target: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_widget_child_selector
: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/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/162/11.0 :target: https://runbot.odoo-community.org/runbot/162/12.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@ -53,7 +53,7 @@ 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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_widget_child_selector%0Aversion:%2011.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_widget_child_selector%0Aversion:%2012.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 +69,7 @@ Contributors
~~~~~~~~~~~~ ~~~~~~~~~~~~
* Enric Tobella <etobella@creublanca.es> * Enric Tobella <etobella@creublanca.es>
* Jaime Arroyo <jaime.arroyo@creublanca.es>
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~
@ -83,6 +84,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/11.0/web_widget_child_selector>`_ project on GitHub. This module is part of the `OCA/web <https://github.com/OCA/web/tree/12.0/web_widget_child_selector>`_ 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

@ -4,7 +4,7 @@
{ {
'name': 'Web Widget Child Selector', 'name': 'Web Widget Child Selector',
'summary': "Widget used for navigation on hierarchy fields", 'summary': "Widget used for navigation on hierarchy fields",
'version': '11.0.1.0.0', 'version': '12.0.1.0.0',
'license': 'AGPL-3', 'license': 'AGPL-3',
'author': 'Creu Blanca,Odoo Community Association (OCA)', 'author': 'Creu Blanca,Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/web', 'website': 'https://github.com/OCA/web',

View File

@ -0,0 +1,20 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_widget_child_selector
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: web_widget_child_selector
#: model:ir.model,name:web_widget_child_selector.model_base
msgid "Base"
msgstr ""

View File

@ -3,7 +3,7 @@
<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.14: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Web Widget Child Selector</title> <title>Web Widget Child Selector</title>
<style type="text/css"> <style type="text/css">
@ -367,7 +367,7 @@ 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. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/11.0/web_widget_child_selector"><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-11-0/web-11-0-web_widget_child_selector"><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/11.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" 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/12.0/web_widget_child_selector"><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-12-0/web-12-0-web_widget_child_selector"><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/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module allows to use a new widget for many2one fields that are made hierarchically. <p>This module allows to use a new widget for many2one fields that are made hierarchically.
Now, you can navigate easily between the hierarchy.</p> Now, you can navigate easily between the hierarchy.</p>
<p>When we are using readonly, the behaviour is similar than Many2one, but on edition <p>When we are using readonly, the behaviour is similar than Many2one, but on edition
@ -398,7 +398,7 @@ For example, name instead of display_name.</p>
<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 smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_widget_child_selector%0Aversion:%2011.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_widget_child_selector%0Aversion:%2012.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">
@ -413,6 +413,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<h2><a class="toc-backref" href="#id5">Contributors</a></h2> <h2><a class="toc-backref" href="#id5">Contributors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Enric Tobella &lt;<a class="reference external" href="mailto:etobella&#64;creublanca.es">etobella&#64;creublanca.es</a>&gt;</li> <li>Enric Tobella &lt;<a class="reference external" href="mailto:etobella&#64;creublanca.es">etobella&#64;creublanca.es</a>&gt;</li>
<li>Jaime Arroyo &lt;<a class="reference external" href="mailto:jaime.arroyo&#64;creublanca.es">jaime.arroyo&#64;creublanca.es</a>&gt;</li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
@ -422,7 +423,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<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/11.0/web_widget_child_selector">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/12.0/web_widget_child_selector">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

@ -13,10 +13,6 @@ odoo.define('web.web_widget_child_selector', function(require) {
'click .o_child_selection_button': '_onChildSelectionClick', 'click .o_child_selection_button': '_onChildSelectionClick',
}), }),
start: function () { start: function () {
// boolean indicating that the content of the input isn't synchronized
// with the current m2o value (for instance, the user is currently
// typing something in the input, and hasn't selected a value yet).
this.$input_dropdown = this.$('.o_input_dropdown'); this.$input_dropdown = this.$('.o_input_dropdown');
this.$input_value = this.$('.o_input_value') this.$input_value = this.$('.o_input_value')
return this._super.apply(this, arguments); return this._super.apply(this, arguments);

View File

@ -14,7 +14,7 @@
</t> </t>
<t t-name="FieldChildSelectorChild"> <t t-name="FieldChildSelectorChild">
<div class="row"> <div class="row">
<div t-foreach="childs" t-as="key" class="col-xs-12"> <div t-foreach="childs" t-as="key" class="col-xl-12">
<t t-set="id_for_label" t-value="'o_child_hierarchy_selector_' + _.uniqueId()"/> <t t-set="id_for_label" t-value="'o_child_hierarchy_selector_' + _.uniqueId()"/>
<input type="radio" t-att-data-id="childs[key][0]" t-att-data-index="key" <input type="radio" t-att-data-id="childs[key][0]" t-att-data-index="key"
t-att-id="id_for_label" data-type="child" class="o_child_selection_button"/> t-att-id="id_for_label" data-type="child" class="o_child_selection_button"/>
@ -34,7 +34,7 @@
</a> </a>
</t> </t>
<t t-if="Object.keys(parents).length > 0"> <t t-if="Object.keys(parents).length > 0">
<i class="fa fa-times o_child_selection_button o_child_selection_clear" aria-hidden="true" data-type="clear"/> <i class="fa fa-times o_child_selection_button o_child_selection_clear" aria-hidden="false" data-type="clear"/>
</t> </t>
</span> </span>
</t> </t>

View File

@ -8,12 +8,13 @@ class TestWidgetChildSelector(TransactionCase):
def setUp(self): def setUp(self):
super().setUp() super().setUp()
self.partner_1 = self.env['res.partner'].create({'name': 'P1'}) ResPartner = self.env['res.partner'].with_context(tracking_disable=True)
self.partner_2 = self.env['res.partner'].create({ self.partner_1 = ResPartner.create({'name': 'P1'})
self.partner_2 = ResPartner.create({
'name': 'P2', 'name': 'P2',
'parent_id': self.partner_1.id 'parent_id': self.partner_1.id
}) })
self.partner_3 = self.env['res.partner'].create({ self.partner_3 = ResPartner.create({
'name': 'P3', 'name': 'P3',
'parent_id': self.partner_2.id 'parent_id': self.partner_2.id
}) })