Community: Framework mailing list archives

expert-framework@mail.odoo.com

Pivot report and aggregation detail

by
m.redaelli
- 01/12/2015 09:04:58
Hello.

I'm trying to make a report that lists Projects, Tasks and Work summary with hours spent.
So I copied the Task Analysis report, modified the view by joining 

JOIN project_task_work tw on tw.task_id = t.id

and adding the fields:

tw.id as task_work_id,
tw.name as task_work_desc,
tw.hours as task_work_hours

Then added the fields and filter in the search view

<field name="task_work_hours"/>
<field name="task_work_desc"/>
...
<filter string="Work Hours" name="work_hours" context="{'group_by':'task_work_id'}" />

and in the graph view:

<field name="project_id" type="row"/>
<field name="name" type="row"/> 
<field name="task_work_desc" type="row"/>

It works well, and in fact I get the following table:

Total
# of tasks # of Days Total Hours Planned Hours Remaining Hours Time used
Total 4 0 40.00 40.00 23.00 7.00
P1 4 0 40.00 40.00 23.00 7.00
 T1 3 0 30.00 30.00 15.00 5.00
  W1 1 0 10.00 10.00 5.00 2.00
  W2 1 0 10.00 10.00 5.00 3.00
  W3 1 0 10.00 10.00 5.00 0.00
 T2 1 0 10.00 10.00 8.00 2.00
  W8 1 0 10.00 10.00 8.00 2.00

The problem is that some fields, for instance, Total Hours, are relative to the Task, and not to the Task Work. However, since they are in all the records of the view, they are summed each time.
So for instance I get 30 Total hours for task T1, even though they should be 10, because every Task Work has 10, "inherited" from the parent Task.

How can I solve this? Is there a way to specify that a field (Total Hours) should not be counted at a certain level of detail (Task Work)?

Thanks

M.