Found some XML code in the mean-time:
<record id="view_account_invoice_filter" model="ir.ui.view">
<field name="name">account.invoice.select</field>
<field name="model">account.invoice</field>
<field name="arch" type="xml">
<search string="Search Invoice">
<field name="number"
string="Invoice"
filter_domain="['|','|','|', ('number','ilike',self), ('origin','ilike',self), ('supplier_invoice_number', 'ilike', self), ('partner_id', 'ilike', self)]"/>
<filter name="draft"
string="Draft"
domain="[('state','=','draft')]" help="Draft Invoices"/>
<filter name="proforma"
string="Proforma"
domain="[('state','=','proforma2')]" help="Proforma Invoices"
groups="account.group_proforma_invoices"/>
<filter name="invoices" string="Invoices"
domain="[('state','not in',['draft','cancel'])]"
help="Proforma/Open/Paid Invoices"/>
<filter name="unpaid" string="Unpaid"
domain="[('state','=','open')]"
help="Unpaid Invoices"/>
<separator/>
<filter domain="[('user_id','=',uid)]" help="My Invoices" icon="terp-personal"/>
<field name="partner_id"/>
<field name="user_id" string="Salesperson"/>
<field name="period_id" string="Period"/>
<group expand="0" string="Group By...">
<filter string="Partner" icon="terp-partner" domain="[]"
context="{'group_by':'partner_id'}"/>
<filter string="Responsible" icon="terp-personal" domain="[]"
context="{'group_by':'user_id'}"/>
<filter string="Journal" icon="terp-folder-orange" domain="[]"
context="{'group_by':'journal_id'}"/>
<filter string="Status" icon="terp-stock_effects-object-colorize"
domain="[]" context="{'group_by':'state'}"/>
<filter string="Period" icon="terp-go-month" domain="[]"
context="{'group_by':'period_id'}"/>
<filter string="Invoice Date" icon="terp-go-month" domain="[]"
context="{'group_by':'date_invoice'}"/>
<filter string="Due Date" icon="terp-go-month" domain="[]"
context="{'group_by':'date_due'}"/>
</group>
</search>
</field>
</record>
And then, the documentation About Search View (doc.openerp.com/trunk/developers/server/03_module_dev_03/#search-views)
EDIT: The answer is in fact:
The question is about search-fields.
With view (ir.ui.view
) records you can specify <search>
views.
Every field that is added to a search-view will show up in the suggestions while typing in the search keyword.
<record id="view_account_invoice_filter" model="ir.ui.view">
<field name="name">account.invoice.select</field>
<field name="model">account.invoice</field>
<field name="arch" type="xml">
<search string="Search Invoice">
<field name="partner_id"/>
<field name="user_id" string="Salesperson"/>
</search>
</field>
</record>
A more advanced variant is the following:
<record id="view_account_invoice_filter" model="ir.ui.view">
<field name="name">account.invoice.select</field>
<field name="model">account.invoice</field>
<field name="arch" type="xml">
<search string="Search Invoice">
<field name="number" string="Invoice"
filter_domain="['|','|','|', ('number','ilike',self), ('origin','ilike',self), ('supplier_invoice_number', 'ilike', self), ('partner_id', 'ilike', self)]"/>
</search>
</field>
</record>
Here 'Invoice' suggestions appear when the search term is matched against either number, origin, supplier_invoice_number or partner_id.
However, it is not yet clear to me why the field has name="number"
.. It seems you can add the same domain to name="partner_id"
. This is not explained in the given documentation link.
There is one more feature, I found in stock picking:
<record id="view_move_search" model="ir.ui.view">
<field name="name">stock.move.search</field>
<field name="model">stock.move</field>
<field eval="3" name="priority"/>
<field name="arch" type="xml">
<search string="Stock Moves">
<field name="partner_id" string="Partner"
filter_domain="[('picking_id.partner_id','ilike',self)]"/>
</search>
</field>
</record>
Here, it seems you can also search through relations.