Reputation: 820
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:
<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>
Upvotes: 3
Views: 4411
Reputation: 1
Found a solution for this here
create scss and add this
.o_list_view .o_list_table thead > tr > th:not(.o_list_record_selector).o_list_number_th {
text-align: center;
}
.o_list_view .o_list_table tbody > tr > td:not(.o_list_record_selector).o_list_number {
text-align: center;
}
and inherit template
<template id="assets_backend_custom" name="assets_backend_custom" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" type="text/scss" href="/modulenam/static/src/scss/style.scss"/>
</xpath>
</template>
This will centralize both header and fields
Upvotes: 0
Reputation: 630
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"
).
Upvotes: 2
Reputation: 2454
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
ortext
)
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"/>
Upvotes: 1