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.
Use
t-ifto set a condition onbuttoncomponent. Take a look atweb.ListViewjavascript'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.