Ir al contenido
Menú
Se marcó esta pregunta

I am trying to add all fields of one2many field in "Add custom filters" section but it is not working.

Here is the code i am trying: -

<filter name="survey_user_input" string="Testing1" domain="[('survey_user_input.state','ilike', self)]"/>
it is creating a custom filter not adding fields to "Add custom filters" section. So May i get help on this?
Avatar
Descartar
Mejor respuesta

Hi Gautam,

You cannot add any filter inside the Custom Filters section. Your code will simply add a new filter option under "Filters".

But you can add a field in the search which will search the value in the o2m.

Try the following code:

<field name="survey_user_input" string="Input State" filter_domain="[('survey_user_input.state','ilike', self)]"/>

This code will add the field in the search box. Write your value to search and select the option as shown in the screenshot:


Avatar
Descartar
Autor

OK... i got it this code will add the fields to search view or custom filters. So how can i add any or all one2many fields in Custom Filters section. Is there any way i can achieve it? can you give a bit idea on this?

No, there is no way to add anything in the custome filter option because it is dynamically created by the framework. You can only see those fields which are available in the database table (normal fields or fields having store=True)

Autor

In case,I have added store=True to the one2many field. will those fields, which are inside one2many field, be visible to the Custom Filters section. As i have added store true to the one2many field but still the fields inside one2many are not visible in the Custom fields section.

Here is the code:-

survey_user_input = fields.One2many('customer.survey', 'partner_id', compute='user_survey_output', store=True)

No. One2many and Many2many does not store in the database table since they have their own table. So you cannot do that.

Publicaciones relacionadas Respuestas Vistas Actividad
2
dic 22
23480
1
dic 20
18009
1
oct 19
5398
1
ago 19
3397
1
dic 19
2413