Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2176 Представления

When creating a custom `<search>` element, the order of `<field>` elements changes which fields are active for the search. What are the precedence rules, where are they documented?

Example, with a model `vetclinic.animal` that has `name` as a `char` field, and `class_id` and `breed_id` as `many2one` fields:

    <search string="Animal">

        <field name="class_id" />

        <field name="breed_id" />

        <field name="name" />

    </search><!-- Animal -->

That will work as expected: the search box will present options to search on any of the `class`, `breed`, and `name` fields.

If the order is different:

    <search string="Animal">

         <field name="name" /><!-- Want to have this field listed first. -->

         <field name="class_id" />

        <field name="breed_id" />

    </search><!-- Animal -->

Now, unexpectedly, the search box omits the options to search by `class` or `breed`; only `name` is allowed.

Why does this happen? What are the rules for the difference in behaviour? Can I have the order of fields as I want, without losing some of them from the search?


Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
июл. 25
570
Search a message Решено
1
февр. 25
1279
0
сент. 23
2234
2
июн. 23
4063
1
авг. 22
12806