Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
17514 Tampilan

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
Buang
Jawaban Terbai

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
Buang

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

Jawaban Terbai

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
Buang

Esta es la que se debe marcar como respuesta correcta.

This is a better answer!!!!

Post Terkait Replies Tampilan Aktivitas
2
Feb 24
11778
1
Mar 15
6276
2
Jul 24
15555
2
Sep 23
8429
1
Apr 20
10213