Assign User groups to Static XML button used for JS - odoo 13

210 views Asked by At

Need to assign user groups to a static button used for JS. Setting groups as we do for form's xml button is not working.

<?xml version="1.0" encoding="UTF-8" ?>
<templates id="template" xml:space="preserve">
    <t t-extend="ListView.buttons">
        <t t-jquery="div.o_list_buttons" t-operation="prepend">
            <t t-if="widget.modelName == 'model.name'">
                <button type="button"
                        class="btn btn-primary o_button_action"
                        groups="module_name.group_manager"
                >
                    Action Name
                </button>
            </t>
        </t>
    </t>
</templates>

Any help is appreciated, thanks.

1

There are 1 answers

0
icra On

Use t-if to set a condition on button component. Take a look at web.ListView javascript's component to understand what data is being passed to the template. If there isn't anything related to access rights or current user group, you'll have to override the javascript and implement it.