Skip to Content
Menu
This question has been flagged
1840 Views

I have created a new field x_status for task in project.task model in Odoo 13 Saas.
I want to use it to filter the task when entering a new timesheet.
I have added a new inherited view to account.analytic.line.tree.hr_timesheet that goes like :
Original fields: 

<field name="project_id" required="1" class="o_timesheet_tour_project_name" context="{'form_view_ref': 'project.project_project_view_form_simplified',}"/>

<field name="task_id" context="{'default_project_id': project_id}" class="o_timesheet_tour_task_name"/>

inherited view:

    <xpath expr="//field[@name='task_id']" position="attributes">
      <attribute name="domain">[('x_status', '!=', True)]</attribute>
    </xpath>
 

However, the domain is not taken into account when creating a new timesheet: All tasks are displayed irrespectively from the field.

If I create a timesheet and let the task empty before saving, then edit this timesheet, the domain is used and only those with x_status=False are displayed.

What am I doing wrong?

Avatar
Discard

would you like to try this?
<attribute name="domain">[('company_id' ,'=', company_id),('project_id.allow_timesheets','=',True),('project_id','=?', project_id),"|",('x_status', '!=', True)]</attribute>

Author

Got this message :

AssertionError: This domain is syntactically not correct: [['company_id', '=', 1], ['project_id.allow_timesheets', '=', True], ['project_id', '=?', 15], '|', ['x_status', '!=', True]]

Related Posts Replies Views Activity
2
Mar 24
569
0
Feb 24
1196
0
Jan 23
702
1
Nov 22
1759
0
Aug 22
1051