Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
3 Antwoorden
25918 Weergaven

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" /> 

Avatar
Annuleer

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

Hope this will helps: https://goo.gl/Wz5KEW

Beste antwoord

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" />


Avatar
Annuleer

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

Auteur

Thank you so much! That did the trick.

Hi Temur, I want my Integer/float field aligned at Centre, can you please help me out ?

one thing more i am having a widget already in my field for regex. so in that case i am not able to use any other widget in same field.

Thank You @Temur for your answer.

Beste antwoord

well the type conversion method is not valid solution because it change objective of the problem i mean it change the type of the field which is very important the SCSS method solved my problem also we should inherit it from base as mention by @waqas also should follow the file structuring and include in manifest:           

custom_module
├── __init__.py
├── models
│   ├── __init__.py
│   └── ...
├── static
│   └── src
│       └── scss
│           └── style.scss
└── views
    ├── __init__.py
    └── assets_backend_custom.xml
Avatar
Annuleer
Beste antwoord

Found a solution for this
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="/modulename/static/src/scss/style.scss"/>
xpath>

template>


this will centralize both header and fields
Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
0
mrt. 15
3265
0
mrt. 15
4651
2
mrt. 15
4995
3
feb. 16
6233
1
sep. 15
5695