Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
1939 Visualizzazioni

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
Abbandona
Risposta migliore

<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
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
apr 25
2414
1
mag 24
10402
0
apr 21
2976
0
mar 17
3084
0
lug 25
146