İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
5567 Görünümler

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
Vazgeç
En İyi Yanıt

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
Vazgeç
Üretici

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)

Üretici

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.

İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Ara 22
24008
1
Ara 20
18746
1
Eki 19
5690
1
Ağu 19
3742
1
Ara 19
2747