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

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