Skip to Content
Menu
This question has been flagged

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
Discard
Best Answer

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
Discard
Author

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)

Author

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.

Related Posts Replies Views Activity
2
Dec 22
23376
1
Dec 20
17820
1
Oct 19
5245
1
Aug 19
3233
1
Dec 19
2303