跳至內容
選單
此問題已被標幟
4 回覆
7447 瀏覽次數

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!


頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
3月 21
5324
2
5月 18
4525
2
3月 15
12606
4
3月 15
12158
2
3月 15
6874