Skip to Content
Menu
This question has been flagged
4 Replies
6737 Views

Hello all,

In this view, I want the field user_id displays only those users who have an employee created and associated to this user. If no employee is created for a user, I don't want the user displayed in the field user_id.

How to write the domain please?

Look at the domain I wrote. You will have an idea of what I need. But this one doesn't work.

The view

<record id="hr_timesheet_line_tree_inherited" model="ir.ui.view">
            <field name="name">hr.timesheet.line.tree.inherited.vtm2</field>
            <field name="model">account.analytic.line</field>
            <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_tree" />
            <field name="arch" type="xml">
                <field name="user_id" position="replace">
                    <field name="user_id" domain="[('user_id.employee_ids', '!=', False)]"  />
                </field>     
            </field>
       </record>


Avatar
Discard

a quick shortcut could be: user_id.share=False to don't have portal user ;)

Author

Interesting. But not all users have an employee created in hr.employee.

Author

I have studied your answer. the field 'share' in res.user model is True when a user is not in the group 'Employee' (base.group_user). The field 'share' is False when the user is in the 'Employee' group (base.group_user). In our case, many users are in the group 'Employee', but they don't necessarily have an instance in hr.employee. I really need a domain who display only users who have an hr.employee created.

Author Best Answer

I think that this one will do the job!

employee_ids is a one2many field in the res.user model.

<field name="user_id" domain="[('employee_ids', '!=', False)]"  />

Thanks all for reading!


Avatar
Discard
Related Posts Replies Views Activity
1
Mar 21
3772
2
May 18
3504
2
Mar 15
11498
4
Mar 15
10446
2
Mar 15
5444