Odoo Help


How to change the css text-align property for column in a tree view?

on 10/26/15, 6:20 PM 1,384 views

What is the right way to change the text-align property for a column in a tree view.  

I have a custom css file in the static/src/css directory.  

I also have it registered in the __openerp__.py file in the 'css': [ 'static/src/css/custom_style.css' ].  

I also made sure the field in the xml file had the right class name set like class="change_text_align"

For some reason though, it will not change the text-align for the column for the field in the tree view.  Is there anything that I am missing?  I just want to align the text on the left side of the column instead of the right.

I also tried adding a style attribute to the field like this, but it still didnt work:

         <field name="my_field" style="text-align: left" /> 

texts are aligned at the left side anyway, you have nothing to change. Probably you mean numbers?

on 10/27/15, 8:16 AM


| 6 5 7
Tbilisi, Georgia
On 10/27/15, 8:35 AM

quote from question:

I just want to align the text on the left side of the column instead of the right.

NOTE: text is aligned at the left side anyway (fields of type char or text), so question is not correctly describes the problem and requires further clarification.

Perhaps, if question is about numeric (integer or float) fields (as numeric fields are aligned at the right side), then it's possible to align them to the left side like text fields, using type="char" attribute in xml record:

<field name="my_numeric_field" type="char" />

if we use this way, then we do not need additional css for this purpose.

on 10/27/15, 8:40 AM

Thank you so much! That did the trick.

on 10/27/15, 11:23 AM

Axel Mendoza

--Axel Mendoza--
| 7 8 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 10/26/15, 7:23 PM

The css and js resource file load have changed since Odoo 8, you need to load using a view extension of the asset_backend, like:

<template id="assets_backend" name="module assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/module/static/src/css/custom_style.css"/> 

question is about "openerp7" as per one of the tags of the question, so 8.0 way can't be used in this case. @Eric has added css correctly, through __openerp__.py. ref: https://www.odoo.com/es_ES/forum/help-1/question/how-to-add-css-and-js-javascript-files-in-openerp-7-odoo-8-module-76719

on 10/27/15, 8:25 AM

sure, I don't see the tag

Axel Mendoza
on 10/27/15, 7:30 PM

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

2 follower(s)


Asked: 10/26/15, 6:20 PM
Seen: 1384 times
Last updated: 10/27/15, 11:23 AM