Janik von Rotz

1 min read

Odoo Development: Tree view with custom styles

The Odoo UI cannot be customized as easy as reports and websites. Using modules we can easily inject custom CSS styles.

Here is an example where we set the width of an unlink button in a custom tree view.


<field name="part_ids" context="{'default_certificate_planer_bom_id': id}">
  <tree limit="200" class="button_width" delete="0">
	<field name="sequence" widget="handle"/>
	<field name="certificate_planer_part_id"/>
	<field name="designation"/>
	<button name="unlink" class="oe_edit_only oe_link" icon="fa-times" type="object" string="Remove"/>

The button has the name unlink and its parent tree elemnt has the CSS class button_width. The name and class are used as selectors in our custom CSS:


.button_width [data-name="unlink"] {
    width: 32px;

Make sure that the style.css file is added to the module manifest using the web.assets_backend as reference.

Categories: Odoo
Tags: odoo , development , tutorial
Improve this page
Show statistic for this page