تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3 الردود
26285 أدوات العرض

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?

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

أفضل إجابة

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.

الكاتب

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.

أفضل إجابة

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
الصورة الرمزية
إهمال
أفضل إجابة

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
الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
مارس 15
3371
0
مارس 15
4792
2
مارس 15
5238
3
فبراير 16
6460
1
سبتمبر 15
5900