跳至内容
菜单
此问题已终结
1 回复
12462 查看

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
11月 24
43984
1
4月 21
11514
1
5月 25
713
4
1月 24
22871
2
1月 24
2256