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

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>


頭像
捨棄
最佳答案

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') ])]"/>
頭像
捨棄

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

作者

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.

相關帖文 回覆 瀏覽次數 活動
0
3月 23
1766
1
11月 19
4973
2
11月 18
5187
1
7月 17
14555
1
12月 16
7866