콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
25739 화면

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
3월 15
3068
0
3월 15
4590
2
3월 15
4874
3
2월 16
6041
1
9월 15
5564