Skip to Content
Menu
This question has been flagged
1 Reply
13279 Views

Hello guys!

I have applied a domain to a field. It works well.

But now, even administrator can see only his own user_id in the field. This it not what I want.

How to applied a domain only for user in base.group_user group?

Thanks!!!

<record id="hr_timesheet_sheet_form" model="ir.ui.view">
            <field name="name">hr.timesheet.form.inherited.vtm2</field>
            <field name="model">hr_timesheet_sheet.sheet</field>
            <field name="inherit_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_form" />
            <field name="arch" type="xml">
                <field name="employee_id" position="replace">
                    <field name="employee_id" domain="[('user_id', '=', user_id)]"  />
                </field>
            </field>
        </record>


Avatar
Discard
Best Answer

Use the groups_id to make that view only apply to a specific group (like 'Employees'):

<field name="groups_id" eval="[(6, 0, [ref('base.group_user') ])]"/>
Avatar
Discard

If you need two groups, with two domains, create two views - one for each group.

Author

Big thanks for this precious answer.

I have declared two views : one view for the group base.group_user and an other view for the hr.group_hr_manager group.

But don't forget the field <name="priority">100</field> who seems to make a big difference.

Related Posts Replies Views Activity
0
Mar 23
846
1
Nov 19
3888
2
Nov 18
4168
1
Jul 17
13168
1
Dec 16
6658