How to hide record selector column of checkboxes in tree view odoo 16.0

222 views Asked by At

I want to hide record selector or checkboxes column in tree view, the actions must be performed one for each record.

Or how to hide delete action from tree view, alternatively.

Previous version: how to hide or remove checkbox column by default on tree view?

Items to hide

I know that is a bad idea but i tray to hide column using backend css, but this hide column in all models

.o_list_record_selector {
    display: none;
}

Tree view

        <record model="ir.ui.view" id="cetiia_registro.list">
            <field name="name">list</field>
            <field name="model">cetiia_registro.registro</field>
            <field name="arch" type="xml">
                <tree>
                    <field name="id" />
                    <field name="email" />
                    <field name="website_name" />
                    <field name="website_url" widget="url" options="{'target': 'new'}"
                        string="Website URL" />
                    <button string="Editar" type="object" name="action_open_edit_form" />
                    <button string="Ver sitio" type="object" name="action_view_website" />
                </tree>
            </field>
        </record>
1

There are 1 answers

0
Kenly On BEST ANSWER
  1. You can easily create a new list view that disables selectors and set the js_class attribute in the tree view tag

    Example:

    /** @odoo-module **/
    import { registry } from '@web/core/registry';
    import { ListRenderer } from "@web/views/list/list_renderer";
    import { listView } from "@web/views/list/list_view";
    
    export class ListRendererNoSelectors extends ListRenderer {
        setup() {
            super.setup();
            this.props.allowSelectors = false;
        }
    };
    
    registry.category('views').add('no_selector_tree', {
        ...listView,
        Renderer: ListRendererNoSelectors,
    });
    
    

  1. To hide the delete action, you just need to remove the delete access (Access Rights)