تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
5320 أدوات العرض

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
ديسمبر 22
23523
1
ديسمبر 20
18050
1
أكتوبر 19
5431
1
أغسطس 19
3412
1
ديسمبر 19
2457