Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
1 Svar
1889 Visninger

I am hiding the "New" button in sales, and I managed to do it. But now, I am trying to make that same button visible only for a specific group of people, but I haven't been able to achieve it. So far, I have only been able to make it invisible for everyone or create a button next to it.

This is the code I am using and the relevant routes.

gec_accounting

static
src
xml


<?xml version="1.0" encoding="UTF-8" ?>

<templates xml:space="preserve">


    <t t-inherit="web.ListView.Buttons" t-inherit-mode="extension">

        <xpath expr="//button[contains(@class, 'o_list_button_add')]" position="attributes">

            <attribute name="style">display: none;</attribute>

        </xpath>

    </t>

    

</templates>

manifest

    'assets': {

        'web.assets_backend': [

            'gec_accounting/static/src/xml/buttons_hide.xml',

        ],

    },




Avatar
Kassér
Bedste svar

<odoo>

    <record id="view_res_partner_tree_inherit_no_create" model="ir.ui.view">

        <field name="name">res.partner.tree.no.create</field>

        <field name="model">res.partner</field>

        <field name="inherit_id" ref="base.view_partner_tree"/>

        <field name="arch" type="xml">

            <tree string="Contacts" create="false">

                <!-- It will make the create button disapear -->

            </tree>

        </field>

    </record>

</odoo>


you can specify a group like :

            <xpath expr="//tree" position="attributes">

                <attribute name="create" groups="your_module.group_no_create"/>

            </xpath>

Avatar
Kassér
Related Posts Besvarelser Visninger Aktivitet
1
apr. 25
2407
1
maj 24
10371
0
apr. 21
2963
0
mar. 17
3073
1
jun. 25
770