Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
12606 Näkymät

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
Hylkää
Paras vastaus


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
Hylkää
Tekijä

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?

Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
2
marrask. 24
44226
1
huhtik. 21
11642
1
toukok. 25
840
4
tammik. 24
23060
2
tammik. 24
2403