Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
1899 Vistas

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
Descartar
Mejor respuesta

<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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
abr 25
2407
1
may 24
10373
0
abr 21
2965
0
mar 17
3074
1
jun 25
797