<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.svg">
</a>
<a name="char-field-autocomplete-widget"></a>
<h2>Char Field autocomplete widget</h2>
<p>Add autocomplete widget for char fields.</p>
<a name="usage-and-configuration"></a>
<h3>Usage and configuration</h3>
<p>On your char field you can declare the widget <cite>char_autocomplete</cite>:</p>
<p><code>`
<field name="char_field" widget="char_autocomplete" options='{"model":"res.partner"}' />
`</code></p>
<p>The only required option is <cite>model</cite>: it will be used to fetch results for the autocomplete.</p>
<a name="additional-options"></a>
<h4>Additional options</h4>
<ul>
<li><p class="first"><cite>search_field</cite>: the domain will use this field to search. Default: <cite>name</cite>.</p>
<p>For instance, if you type "camp" the domain will be <cite>[('name', 'ilike', '%camp%')]</cite></p>
</li>
<li><p class="first"><cite>value_field</cite>: the field that provide the real value for the char field. Default: <cite>name</cite>.</p>
</li>
<li><p class="first"><cite>display_field</cite>: the field used for autocomplete search results label. Default: <cite>name</cite>.</p>
</li>
<li><p class="first"><cite>fields</cite>: fields to be loaded on <cite>search_read</cite>. Default: <cite>[display_field, value_field]</cite>.</p>
</li>
</ul>
<a name="domains"></a>
<h4>Domains</h4>
<p>If you set a domain on you char field (maybe via onchange) the widget will take care of it.</p>
<p>In this example you can see that the domain has been set by the field <cite>attr_id</cite>
hence the results are filtered with this parameter too.</p>
<p><img alt="preview" src="./images/preview.png" /></p>
<a name="bug-tracker"></a>
<h3>Bug Tracker</h3>
<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. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.</p>
<a name="credits"></a>
<h3>Credits</h3>
<a name="images"></a>
<h4>Images</h4>
<ul class="simple">
<li>Odoo Community Association: <a class="reference external" href="https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg">Icon</a>.</li>
</ul>
<a name="contributors"></a>
<h4>Contributors</h4>
<ul class="simple">
<li>Simone Orsi <<a class="reference external" href="mailto:simone.orsi@camptocamp.com">simone.orsi@camptocamp.com</a>></li>
</ul>
<a name="maintainer"></a>
<h4>Maintainer</h4>
<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>This module is maintained by the OCA.</p>
<p>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.</p>
<p>To contribute to this module, please visit <a class="reference external" href="https://odoo-community.org">https://odoo-community.org</a>.</p>