Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
17524 Widoki

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?

Awatar
Odrzuć
Najlepsza odpowiedź

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




Awatar
Odrzuć

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

Najlepsza odpowiedź

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'">    
Awatar
Odrzuć

Esta es la que se debe marcar como respuesta correcta.

This is a better answer!!!!

Powiązane posty Odpowiedzi Widoki Czynność
2
lut 24
11791
1
mar 15
6283
2
lip 24
15566
2
wrz 23
8439
1
kwi 20
10221