Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
12584 Zobrazení

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?

 

Avatar
Zrušit
Nejlepší odpověď


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')
Avatar
Zrušit
Autor

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?

Related Posts Odpovědi Zobrazení Aktivita
2
lis 24
44192
1
dub 21
11612
1
kvě 25
818
4
led 24
23015
2
led 24
2372