Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2410 Переглядів

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?

Аватар
Відмінити

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>

Автор

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 Відповіді Переглядів Дія
naked domain set up Вирішено
3
лип. 25
4424
0
трав. 25
927
2
бер. 24
2173
0
січ. 23
1761
1
лист. 22
3228