Hi everyone !
For a customer, i'd like to add a new measure to the timesheet analysis report.
Here is the code i use in the python report:
quantity_days = fields.Float('Days', readonly=True)
def _select(self):
select_str = super(HrTimesheetReport, self)._select()
return "%s, %s" % (select_str,
'sum(aal.unit_amount)/4 as quantity_days')
Using this, i can now use the measure "Days" on the report view.
I'd like that measure to be used by default, but i cannot find a way to achieve this... I tried inheriting the action leading to that report:
<record id="hr_timesheet.action_hr_timesheet_report_stat_all" model="ir.actions.act_window">
<field name="context">{'measures': ['quantity_days']}</field>
</record>
But this doesnt work either (but if i add "'group_by': ['department_id']," into the context, then it is grouped by department, meaning the context is used as intended.
So, how can i achieve this? Thank you :)