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

Hi,

by clicking on a group in a search view, the records in the list view get grouped. The records representing a group automatically sums integer or float fields. But is there a way to change this aggregation behavior? For certain fields, I would like to see the average instead of the sum. 
Is there a way?

 

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


Hi Gregor Heger

You need to define the field group_operator that by default is sum even if you don't specify it. That it's defined directly in the field, like:

count = fields.Integer('Count', group_operator='avg')
الصورة الرمزية
إهمال
الكاتب

It works! Thank you very much!

Happy to help

How can add some other calculation in group_by. For an example if we need division on two grouped value, how we can do that?

المنشورات ذات الصلة الردود أدوات العرض النشاط
2
نوفمبر 24
44231
1
أبريل 21
11645
1
مايو 25
846
4
يناير 24
23081
Attrs attribute تم الحل
2
يناير 24
2406