Axelor Doc

Full Example

The following example illustrates all the features of the search engine.

<search name="sale-order-search" title="Sales Search" limit="100">
    <search-fields>
        <field name="partner" type="reference" target="com.axelor.contact.db.Contact" />
        <field name="product" type="reference" target="com.axelor.sale.db.Product" widget="SuggestBox" />
        <field name="customer" type="string" />
        <field name="date" type="date" />
        <field name="value" type="decimal" />
    </search-fields>
    <result-fields>
        <field name="customer" type="string" />
        <field name="company" type="string" />
        <field name="product" type="string" />
        <field name="date" type="date" />
        <field name="value" type="decimal" />
    </result-fields>
    <select model="com.axelor.contact.db.Contact" orderBy="customer">
        <field name="fullName" as="customer" />
        <field name="company.name" as="company" />
        <field name="dateOfBirth" as="date" />
        <where match="any">
            <input name="customer" field="fullName" matchStyle="contains" />
            <input name="partner.fullName" field="fullName" />
            <input name="date" field="dateOfBirth" />
        </where>
    </select>
    <select model="com.axelor.sale.db.Order" title="Sale Order" orderBy="date,-value">
        <field name="customer.fullName" as="customer" />
        <field name="items[].product.name" as="product" />
        <field name="createDate" as="date" />
        <field name="amount" as="value" />
        <where match="any">
            <input name="customer" field="customer.fullName" matchStyle="contains" />
            <input name="partner" field="customer" />
            <input name="date" field="createDate" />
            <input name="value" field="amount" />
            <input name="product" field="items[].product" />
        </where>
    </select>
</search>

Full Example

Red: The search criteria defined in the tag <search-fields>

Yellow: The objects on which we do research. In the example, the search is done on objects Contact and Order. By default, the search is on all the objects defined in the tags <select> . You can refine it by selecting only certain objects.

Blue: The result grid defined in the tag <result-fields> . In the example, research has recovered only 2 records.

Button Search allows you to launch the search. The button Clear will clear the results and the values entered in the search criteria.