Se rendre au contenu
Menu
Cette question a été signalée
2 Réponses
17533 Vues

Hi,
in odoo 10.0 i used attribute colors on tree for set color lines like this:

<field name="arch" type="xml">
<tree string="Question" editable="bottom"
colors="maroon:text_color=='maroon';
red:text_color=='red';
purple:text_color=='purple';
fuchsia:text_color=='fuchsia';
green:text_color=='green';
lime:text_color=='lime';
olive:text_color=='olive';
yellow:text_color=='yellow';
navy:text_color=='navy';
blu:text_color=='blu';
teal:text_color=='teal';
aqua:text_color=='aqua'
">


I see that in Odoo 11.0 this doesn't work, and instead of colors it's possible to use bootstrap class like decoration-*name ... the problem is that i need more colors than just danger, warning, info, muted, primary and success like the cookbook explain.
There is some way to do that?

Avatar
Ignorer
Meilleure réponse

In odoo 11, we have:

/web/static/src/js/views/list/list_renderer.js
var DECORATIONS = [ 'decoration-bf', 'decoration-it', 'decoration-danger', 'decoration-info', 'decoration-muted', 'decoration-primary', 'decoration-success', 'decoration-warning' ];

You can use:

https://github.com/OCA/web/tree/11.0/web_widget_color




Avatar
Ignorer

Thanks a lot, still works on V12. I'd like to add a sample too:

<tree create="0" name="your_tree"

decoration-success="message_type=='succes'"

decoration-warning="message_type=='warning'"

decoration-danger="message_type=='error'"

string="Some string">

Halo Yenthe.

I was wondering, can i make 2 condition in 1 decoration.

ex. decoration-danger="message_type=='warning'" (OR/AND) "message_type=='error'"

I want to make the tree color the same with those 2 condition

Meilleure réponse

how should this be used in odoo11 now?

the following does not work in odoo 11 (in odoo 10 i had "red" instead of "danger") 

"decoration-danger" also doesn not work

<tree string="Invoice" colors="danger:state == 'open'">    
Avatar
Ignorer

Esta es la que se debe marcar como respuesta correcta.

This is a better answer!!!!

Publications associées Réponses Vues Activité
2
févr. 24
11802
1
mars 15
6288
2
juil. 24
15609
2
sept. 23
8454
1
avr. 20
10242