Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
4 Ответы
7452 Представления

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
12607
4
мар. 15
12161
2
мар. 15
6876