ReiiYuki
ReiiYuki

Reputation: 365

Odoo How to allow access button for many group of user?

I am trying to allow access for two group of user as this following code :

<record model="ir.ui.view">
        <field name="name">sale.order.approve</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_order_form"/>
        <field name="arch" type="xml">
            <xpath expr="/form/header/button[@name='action_approve']" position="replace">
                <!-- <field name="groups_id" eval="[(4,ref('group_lead')),(4,ref('group_sm'))]"/> -->
                <button name="action_approve" states="pending" string="Approve" class="btn-primary o_sale_confirm" type="object"  groups="[ref('group_lead'),ref('group_sm')]" />
            </xpath>
        </field>
    </record>

However this doesn't work?

Do you have any solution to solve this problem?

Upvotes: 2

Views: 1994

Answers (1)

Hilar AK
Hilar AK

Reputation: 1675

Your syntax to given groups are wrong.

<record model="ir.ui.view">
    <field name="name">sale.order.approve</field>
    <field name="model">sale.order</field>
    <field name="inherit_id" ref="sale.view_order_form"/>
    <field name="arch" type="xml">
        <xpath expr="/form/header/button[@name='action_approve']" position="replace">
            <!-- <field name="groups_id" eval="[(4,ref('group_lead')),(4,ref('group_sm'))]"/> -->
            <button name="action_approve" states="pending" string="Approve" class="btn-primary o_sale_confirm" type="object"  groups="account.group_account_user,account.group_account_manager,account.group_account_invoice" />
        </xpath>
    </field>
</record>

Here I gave a sample group, you can add yours.

Upvotes: 3

Related Questions