How to align fields in tree view odoo?

Viewed 2280

I have a tree view with two columns. The first column's text (Numero) is aligned to right and the second is aligned to left. Why is that happening? How can I align the text of the first column to the left? This is the code of the tree view:I would like all texts aligned to left

<record id="planificacion_resultado_tree" model="ir.ui.view">
  <field name="name">Resultados</field>
  <field name="model">utepda_planificacion.resultado</field>
  <field name="arch" type="xml">
    <tree>
      <field name="numero"/>
      <field name="name" />
    </tree>
  </field>
</record>
2 Answers

As Odoo is using Bootstrap for its styling, you have access to all its text classes, text-left being one of them (which will apply a text-align: left):

<field name="numero" string="numero" class="text-left"/>

Note this does not left-align the column name though. For that you'll need to add some CSS (you can target the th element with data-name="numero").

tico1993

I think you went through added style to that field and if it does not work then you can use like this way,

The text is aligned at the left side anyway (fields of type char or text)

Reasonably, Numeric (integer or float) fields as numeric fields are aligned at the right side, to align them to the left side like text fields, using type="char" attribute in XML record.

<field name="numero" type="char"/>
Related