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

i have added custom selection fields on custom model, this fields are related fields and some of them are computed fields, when i add one of this fields in search view (group by option) i get error message --> Fields in 'groupby' must be database-persisted fields (no computed fields),

any idea how to work around this

الصورة الرمزية
إهمال
أفضل إجابة

Hi, You can't add computed/related field to search or group by if the store Parameter is not set to True or if the computed field not have search parameter. 

Note: By default store parameter is set to False. 

SO you have add store = True to the related fields.

For computed field you can set store=True (but this will change the calculation of the field to be recomputed once the one of depends fields changed), If you don't want to change the store for computed field you can add search parameter which called method you will write to search in computed field.

Please read more details in Odoo ORM

 

الصورة الرمزية
إهمال
الكاتب

adding store=True make it works
Thanks..

المنشورات ذات الصلة الردود أدوات العرض النشاط
0
سبتمبر 23
3797
1
مارس 22
3171
1
يوليو 25
1367
0
فبراير 21
2290