[FIX] partner_autocomplete, *: fix partner autocomplete dropdown menu hidden

base: The two elements were not distinguishable by an xpath.

partner_autocomplete: Use new ids in xpath

The class `o_text_overflow` set on the fields was also
preventing the dropdown menu from appearing. This class is
now moved to the `input` tag instead of the while `div`.

closes odoo/odoo#78141

Task: 2638570
X-original-commit: fd7bfbccd45f874d5a826e695858bc75c8467700
Signed-off-by: Florian Daloze (fda) <fda@odoo.com>
This commit is contained in:
François (FRC)
2021-10-11 13:52:31 +00:00
committed by Louis Baudoux
parent 85b8a95116
commit 377f18013a
4 changed files with 18 additions and 8 deletions
@@ -176,6 +176,10 @@ var FieldAutocomplete = FieldChar.extend(AutocompleteMixin, {
suggestions: this.suggestions,
}));
this.$dropdown.appendTo(this.$el);
// We need to make sure that the element containing the dropdown menu doesn't have the
// style attribute overflow: hidden, otherwise the dropdown menu will be hidden by it
this.$el.removeClass('o_text_overflow');
this.$input.addClass('o_text_overflow');
}
},
@@ -5,7 +5,10 @@
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//div[hasclass('oe_title')]/h1/field[@name='name']" position="attributes">
<xpath expr="//div[hasclass('oe_title')]/h1/field[@id='company']" position="attributes">
<attribute name="widget">field_partner_autocomplete</attribute>
</xpath>
<xpath expr="//div[hasclass('oe_title')]/h1/field[@id='individual']" position="attributes">
<attribute name="widget">field_partner_autocomplete</attribute>
</xpath>
<xpath expr="//field[@name='vat']" position="attributes">
@@ -23,7 +26,10 @@
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_simple_form"/>
<field name="arch" type="xml">
<xpath expr="//div[hasclass('oe_title')]/h1/field[@name='name']" position="attributes">
<xpath expr="//div[hasclass('oe_title')]/h1/field[@id='company']" position="attributes">
<attribute name="widget">field_partner_autocomplete</attribute>
</xpath>
<xpath expr="//div[hasclass('oe_title')]/h1/field[@id='individual']" position="attributes">
<attribute name="widget">field_partner_autocomplete</attribute>
</xpath>
<xpath expr="//field[last()]" position="after">
+4 -4
View File
@@ -88,8 +88,8 @@
<div class="oe_title">
<field name="company_type" options="{'horizontal': true}" widget="radio" groups="base.group_no_one"/>
<h1>
<field name="name" default_focus="1" placeholder="e.g. Lumber Inc" attrs="{'required' : [('type', '=', 'contact')], 'invisible': [('is_company','=', False)]}"/>
<field name="name" default_focus="1" placeholder="e.g. Brandom Freeman" attrs="{'required' : [('type', '=', 'contact')], 'invisible': [('is_company','=', True)]}"/>
<field id="company" name="name" default_focus="1" placeholder="e.g. Lumber Inc" attrs="{'required' : [('type', '=', 'contact')], 'invisible': [('is_company','=', False)]}"/>
<field id="individual" name="name" default_focus="1" placeholder="e.g. Brandom Freeman" attrs="{'required' : [('type', '=', 'contact')], 'invisible': [('is_company','=', True)]}"/>
</h1>
<field name="parent_id"
widget="res_partner_many2one"
@@ -168,8 +168,8 @@
<field name="country_code" invisible="1"/>
<field name="company_type" widget="radio" options="{'horizontal': true}"/>
<h1>
<field class="o_text_overflow" name="name" default_focus="1" placeholder="e.g. Lumber Inc" attrs="{'required' : [('type', '=', 'contact')], 'invisible': [('is_company','=', False)]}"/>
<field class="o_text_overflow" name="name" default_focus="1" placeholder="e.g. Brandom Freeman" attrs="{'required' : [('type', '=', 'contact')], 'invisible': [('is_company','=', True)]}"/>
<field id="company" class="o_text_overflow" name="name" default_focus="1" placeholder="e.g. Lumber Inc" attrs="{'required' : [('type', '=', 'contact')], 'invisible': [('is_company','=', False)]}"/>
<field id="individual" class="o_text_overflow" name="name" default_focus="1" placeholder="e.g. Brandom Freeman" attrs="{'required' : [('type', '=', 'contact')], 'invisible': [('is_company','=', True)]}"/>
</h1>
<div class="o_row">
<field name="parent_id"
@@ -172,7 +172,7 @@ tour.stepUtils.autoExpandMoreButtons('.o_form_readonly'),
position: "right",
}, {
mobile: true,
trigger: "input[name=name]:not(.o_invisible_modifier)",
trigger: ".o_field_widget[name=name] input:not(.o_invisible_modifier)",
extra_trigger: ".modal:not(.o_inactive_modal) .modal-dialog .o_field_radio.o_field_widget[name=company_type]",
content: _t('Select a seller'),
position: 'top',
@@ -461,7 +461,7 @@ tour.stepUtils.autoExpandMoreButtons('.o_form_readonly'),
position: "left",
}, {
mobile: true,
trigger: "input[name=name]:not(.o_invisible_modifier)",
trigger: ".o_field_widget[name=name] input:not(.o_invisible_modifier)",
extra_trigger: ".modal:not(.o_inactive_modal) .modal-title:contains('Organization / Contact')",
content: _t('Let\'s enter the name.'),
position: 'left',