[MIG][12.0] web_widget_child_selector

pull/1959/head
Enric Tobella 2020-02-19 23:23:44 +01:00
parent 43a46badeb
commit 010f593a5b
4 changed files with 7 additions and 10 deletions

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

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