跳至内容
菜单
此问题已终结
2 回复
17522 查看

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?

形象
丢弃
最佳答案

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




形象
丢弃

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

最佳答案

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'">    
形象
丢弃

Esta es la que se debe marcar como respuesta correcta.

This is a better answer!!!!

相关帖文 回复 查看 活动
2
2月 24
11789
1
3月 15
6282
2
7月 24
15563
2
9月 23
8435
1
4月 20
10220