Odoo Help


6 Answers
Sylvain LE GAL
21‏/12‏/2013 4:58 م


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.

8‏/1‏/2014 5:01 ص

Works perfectly, thanks!

Solnet Solutions Limited, Kevin McMenamin
15‏/7‏/2014 12:36 ص

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

Badache Zoubir
20‏/6‏/2018 11:07 ص

multiple fields?


I have a Field called "Name" in tree view. I want to increase the column width for this field so the data below does not take up too many lines.


<field name="name"/>                <-----------this is the original.

<field name="name" string="    Name    "/> <---------------this is what i have done.

Please note: use ASCII code 255 for space (Alt+255)

Hope this helps someone!



tim diamond
13‏/11‏/2013 3:46 م

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.


1 Comment
Atchuthan - Technical Consultant, Sodexis Inc
17‏/12‏/2013 12:52 ص

@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

Ask a Question
Keep Informed
4 follower(s)
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