Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
4 ตอบกลับ
7446 มุมมอง

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>


อวตาร
ละทิ้ง

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

ผู้เขียน

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

ผู้เขียน

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.

ผู้เขียน คำตอบที่ดีที่สุด

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!


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มี.ค. 21
5324
2
พ.ค. 18
4525
2
มี.ค. 15
12605
4
มี.ค. 15
12153
2
มี.ค. 15
6874