Hi, thanks all for support.
I'm creating with odoo 16 ce a new View to show the task list, accessable only for supervisors, filtering only by task and timesheet added by workers for whom he is supervisors. I have to show hours logged and remaining hours for each task.
The best I could accomplish was this, what do I have to change to reach my goal?
The field x_remaining_hours has been added to account.analytic.line model as calculated with this "Calculate" field:
sum = 0
for record in self:
sum = sum + record.task_id.project_id.remaining_hours
Still not working... my code below (tags stripped 'cause I'm not able to use the code tag, sorry)
tree editable="bottom" string="Timesheet Activities" sample="1"
field name="date"/
field name="employee_id"/
field name="project_id" required="1" options="{'no_create_edit': True, 'no_open': 1}"/
field name="task_id" optional="show" options="{'no_create_edit': True, 'no_open': True}" widget="task_with_hours" context="{'default_project_id': project_id}"/
field name="name" optional="show" required="0"/
field name="unit_amount" optional="show" widget="timesheet_uom" sum="Total" decoration-danger="unit_amount > 24 or unit_amount < 0"/
field name="x_remaining_hours" optional="show" widget="remaining_hours" sum="Total" decoration-danger="unit_amount > 24 or unit_amount < 0"/
field name="company_id" invisible="1"/
field name="user_id" invisible="1"/
/tree