Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
2399 Visninger

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
Kassér

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>

Forfatter

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 Besvarelser Visninger Aktivitet
3
jul. 25
4414
0
maj 25
925
2
mar. 24
2171
0
jan. 23
1760
1
nov. 22
3226