跳至內容
選單
此問題已被標幟
1 回覆
5572 瀏覽次數

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?
頭像
捨棄
最佳答案

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:


頭像
捨棄
作者

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)

作者

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.

相關帖文 回覆 瀏覽次數 活動
2
12月 22
24008
1
12月 20
18746
1
10月 19
5690
1
8月 19
3742
1
12月 19
2747