Odoo Help


Changing column widths tree view

tim diamond
on 11/8/13, 11:39 AM 14,981 views

Hi community,

I have 4 columns in a tree view, taking up all the screen. They are very spread out, and I was wondering how to change their column widths. I"ve dug around, and found this link:


This shows how to add custom css, and apply it on a field. I've followed the methodology exactly, and to me, it seems this only works in FORM view, not tree view. When I try to add a class to my field in tree view, I get XML errors.

Can anyone help me reduce my column widths in a tree view?



Sylvain LE GAL
On 12/21/13, 4:58 PM


I was facing this problem and I finally found the solution to customize a column in TREE view, only for ONE view ;

Solution 1 that doesn't work :

  • xml <field width="200" /> or <field style="width: 200" /> or <field style="width: 30 %%" />

--> width attribute doesn't seem to work in tree view ;

Solution 2 that doesn't work :

  • xml <field class="my_class" /> ;
  • css .my_class { width: 1000px;}

--> class attribute doesn't seem to work in tree view ;

Solution 3 that doesn't work :

  • xml : <field name="my_field" />
  • css : [data-id="my_field"]{width: 1000px;}

--> this works for ALL the column named "my_field". Not very good if we want to change the render of a column if the field is "name" ;

The workaround I found

  • xml : <tree string="Tree String" version="7.0" class="my_class"> <field name="my_field" />
  • css : .my_class [data-id="my_field"]{width: 1000px;}

--> class attribute works on tree tag.

-->To be sure to target only the desired view the name of my class is "myModuleName__myTreeViewName"

Thanks for your feedback.

Works perfectly, thanks!

on 1/8/14, 5:01 AM

works great for setting a single field but what if you want to set the widths for multiple fields?

Solnet Solutions Limited, Kevin McMenamin
on 7/15/14, 12:36 AM
tim diamond
On 11/13/13, 3:46 PM

I ended up solving this the following way:

I added a blank char field in my object definition, called place_holder.

Then, in my tree view I pad it with copies of this field:

<field name="place_holder/"> <field name="place_holder/"> <field name="place_holder/"> <field name="place_holder/"> <field name="place_holder/"> <field name="place_holder/"> <field name="place_holder/">

This is the only work-around I could find. Its a hack, but it does EXACTLY what I was looking for.

Hope this helps someone out there.


@Tim Diamond, I am also facing the same problem of increasing width for a particular field in tree/grid view of purchase order line, can you provide me your suggestion

Atchuthan - Technical Consultant, Sodexis Inc
on 12/17/13, 12:52 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

4 follower(s)


Asked: 11/8/13, 11:39 AM
Seen: 14981 times
Last updated: 7/26/16, 2:19 AM