Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
17515 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit

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

Nejlepší odpověď

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
Zrušit

Esta es la que se debe marcar como respuesta correcta.

This is a better answer!!!!

Related Posts Odpovědi Zobrazení Aktivita
2
úno 24
11778
1
bře 15
6276
2
čvc 24
15555
2
zář 23
8430
1
dub 20
10213