Skip to Content
Menu
This question has been flagged
2 Replies
5832 Views

I know we can set text to be center as below code:

text-align:center;

what about for float number?

Avatar
Discard
Best Answer

You can add an extra class to the div that olds the tree table:

 

<tree string="Sales Orders" decoration-bf="message_needaction==True" decoration-muted="state=='cancel'" class="my_class">


this exemple comes from the default sale module:

http://gitlab.opengest.solutions/opengest/odoo/blob/master/addons/sale/sale_view.xml#L114


As you can see, I've just added class="my_class"


In the same module, the sale's one, you can find an exemple how to insert custom CSS:

http://gitlab.opengest.solutions/opengest/odoo/blob/master/addons/sale/views/sale.xml


The css file:

http://gitlab.opengest.solutions/opengest/odoo/blob/master/addons/sale/static/src/css/sale.css




Then, just add your custom css file.

Avatar
Discard
Author

I have tried as your explanation; but it seems to not work;

shall I know what is the meaning of "decoration-bf" and "decoration-muted"

decoration-bf: marks the record in bold font, decoration-muted: will mark it in gray, similarly there are quiet a few, basically they are used to indicate a quick status at glance.

I have changed my answer:

this exemple comes from the default sale module:

http://gitlab.opengest.solutions/opengest/odoo/blob/master/addons/sale/sale_view.xml#L114

As you can see, I've just added class="my_class"

In the same module, the sale's one, you can find an exemple how to insert custom CSS:

http://gitlab.opengest.solutions/opengest/odoo/blob/master/addons/sale/views/sale.xml

The css file:

http://gitlab.opengest.solutions/opengest/odoo/blob/master/addons/sale/static/src/css/sale.css

Author

Thank you for you detail showing;

I have test this; and I find the css file can work even if delete "class="my_class" ", and I don;t know why you add this?

in addition, I want to the context in "xml" to be center when I use "text-align: center" in "css" file; and I find that the code can only make "fieds.Char" to be center rather than "fields.Float()".

Best Answer

Take a look here (https://www.odoo.com/es_ES/forum/ayuda-1/question/changing-column-widths-tree-view-35981), It looks like you have the same problem.

Avatar
Discard