Odoo Help

2

2
6 Answers
2
Brijesh Kesariya India
7/11/15, 6:17 AM

I am having same issue for the Progressbar and finally I found the sollution using inheriting the javascript Code for the progressbar widget and got the desired output as per I want.


 

2 Comments
Nilmar Shereef Qatar
3/21/17, 3:13 AM

You changed the colour in tree view or form view?

Brijesh Kesariya India
3/23/17, 9:11 AM

In tree view

1
Avatar

Mohammed Amal N India

--Mohammed Amal N--

2287
| 6 4 9
Ernakulam, India
--Mohammed Amal N--

Email : mohammedamal.n@gmail.com

Blog: https://www.blogger.com/profile/14877879550922602186

Mohammed Amal N India
3/23/17, 4:29 AM

You can inherit progressbar in progress_bar.js

add this code to set different colors in formview

do add css

.o_progressbar .o_progress .o_progressbar_complete.o_progress_gt_fty {
background-color: #456325;
height: 100%;
}
.o_progressbar .o_progress .o_progressbar_complete.o_progress_lt_fty {
background-color: #000000;
height: 100%;
}
ProgressBar.include({

_render_value: function(v) {
var value = this.value;
var max_value = this.max_value;
if(!isNaN(v)) {
if(this.edit_max_value) {
max_value = v;
} else {
value = v;
}
}
value = value || 0;
max_value = max_value || 0;

var widthComplete;
if(value <= max_value) {
widthComplete = value/max_value * 100;
} else {
widthComplete = max_value/value * 100;
}
this.$('.o_progress').toggleClass('o_progress_overflow', value > max_value);
this.$('.o_progressbar_complete').toggleClass('o_progress_gt_fty', widthComplete > 70).css('width', widthComplete + '%');
this.$('.o_progressbar_complete').toggleClass('o_progress_lt_fty', widthComplete <= 70).css('width', widthComplete + '%');

if(this.readonly) {
if(max_value !== 100) {
this.$('.o_progressbar_value').html(utils.human_number(value) + " / " + utils.human_number(max_value));
} else {
this.$('.o_progressbar_value').html(utils.human_number(value) + "%");
}
} else if(isNaN(v)) {
this.$('.o_progressbar_value').val(this.edit_max_value ? max_value : value);
}
}
});
     
1
Timothy Solomon South Africa
6/11/14, 7:47 AM

Probably the best way is to cusomise the css to show different colours. You can override the css by adding a static/css/mycss.css file, and include in your __openerp__.py.

If that doesnt work you will have to create your own widget by inheriting from the progressbar widget - but that requires a bit of developement and javascript knowledge.

Give a shout if you need help

1 Comment
Anil R. Kesariya (AKE) India
7/10/14, 7:41 AM

Hello Timothy, Which class do we need to change color for progress bar. Do we need to create our ownclass inside css? can send me steps for it.

0
nabil Morocco
5/13/16, 7:51 AM

you can do it just with css and xml without using javascript :)

Ask a Question
Keep Informed
3 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now