Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
11752 มุมมอง

On odoo reporting, there is by default a total row giving the float or integer field sum, this field is on the measure selection box
There is necessarily a method allowing to do a sum operation (maybe using sum sql aggregate function), I want to override this method to allow me do a data average (maybe a svg sql aggeregate function) instead of sum, and just for one specified reporting (the one I'm developping), and not for all Odoo reportings.

Here is a picture that summarizes what I want to do.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

@Yassine TEIMI

To change that you just need to define group_operator = 'avg' in the measure field definition of the model class

อวตาร
ละทิ้ง
ผู้เขียน

So I should overwrite the measure field definition on the report model I'm using, then I can get the avg as a operator only for desired report ? on the other hand, I'm looking for the original measure field definition, on the models.py (ORM) but can't find it.

when I said measure field definition I really mean to say the definition of the field used as measure of the pivot table graph view that you need to group using avg, that field in your report model need to have the group_operator = 'avg'

did you test it?

ผู้เขียน

Great ! It works fine, thanks a lot Axel :)

ผู้เขียน

@Axel, How can I change the 'total' string (see http://prntscr.com/9eexf9) in to 'average' ?

I don't know how to do it without an extension

ผู้เขียน

How is it possible to do it with an extension ?

Please create another question for that, to explain all the steps of how to do it in an answer without mix things

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ค. 15
3506
2
ก.พ. 22
17185
2
ธ.ค. 23
23541
0
พ.ค. 24
9537
How to find the id of a menuitem? แก้ไขแล้ว
3
ม.ค. 19
28647