@ -0,0 +1,26 @@ |
|||||
|
Lifeline for Task |
||||
|
================= |
||||
|
|
||||
|
This module aims to automatically update the color of the progressbar in task form. |
||||
|
LifeLine progressbar is calculated based on live time and given deadline time. |
||||
|
|
||||
|
Features |
||||
|
======== |
||||
|
|
||||
|
* User Defined Progress Bar Colour Configuration. |
||||
|
* Task Lifeline Bar based on Deadline. |
||||
|
* Automatic Colour Change of Lifeline Bar. |
||||
|
* Default Colour for Forbidden. |
||||
|
|
||||
|
|
||||
|
.. note:: |
||||
|
|
||||
|
A new menu is created under Project-configuration where |
||||
|
>set color for percentage range. |
||||
|
|
||||
|
It effects the task form view Life line progress bar |
||||
|
|
||||
|
|
||||
|
Credits |
||||
|
======= |
||||
|
Developer: Nilmar Shereef @ cybrosys, shereef@cybrosys.in |
@ -0,0 +1,23 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2009-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
||||
|
# Author: Nilmar Shereef(<http://www.cybrosys.com>) |
||||
|
# you can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# It is forbidden to publish, distribute, sublicense, or sell copies |
||||
|
# of the Software or modified copies of the Software. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
import models |
@ -0,0 +1,41 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2009-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
||||
|
# Author: Nilmar Shereef(<http://www.cybrosys.com>) |
||||
|
# you can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# It is forbidden to publish, distribute, sublicense, or sell copies |
||||
|
# of the Software or modified copies of the Software. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
{ |
||||
|
'name': "Lifeline for Task", |
||||
|
'summary': """Lifeline Progressbar for Tasks (100% -> 0%)""", |
||||
|
'description': """Calculates the time remaining based on live time & deadline.""", |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'website': "http://www.cybrosys.com", |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'category': 'Project', |
||||
|
'version': '0.2', |
||||
|
'depends': ['base', 'project'], |
||||
|
'data': [ |
||||
|
'views/task_lifeline_view.xml', |
||||
|
'views/progress_bar_view.xml', |
||||
|
'views/progress_bar_settings.xml', |
||||
|
], |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2009-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
||||
|
# Author: Nilmar Shereef(<http://www.cybrosys.com>) |
||||
|
# you can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# It is forbidden to publish, distribute, sublicense, or sell copies |
||||
|
# of the Software or modified copies of the Software. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
import task_lifeline |
||||
|
import progress_bar_color |
@ -0,0 +1,56 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2009-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
||||
|
# Author: Nilmar Shereef(<http://www.cybrosys.com>) |
||||
|
# you can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# It is forbidden to publish, distribute, sublicense, or sell copies |
||||
|
# of the Software or modified copies of the Software. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
from odoo import models, fields, api, exceptions, _ |
||||
|
|
||||
|
|
||||
|
class SelectColor(models.Model): |
||||
|
_name = "set.progressbar.color" |
||||
|
_rec_name = 'color' |
||||
|
|
||||
|
range_start = fields.Integer(string='Range From(%)', required=True, help="Starting range of Statusbar in Percentage") |
||||
|
range_stop = fields.Integer(string='Range To(%)', required=True, help="Stop range of Statusbar in Percentage") |
||||
|
color = fields.Selection([('red', 'Red'), ('green', 'Green'), ('yellow', 'Yellow'), |
||||
|
('pink', 'Pink'), ('orange', 'Orange'), |
||||
|
('light_green', 'Light Green'), ('grey', 'Grey'), |
||||
|
('blue', 'Blue'), ('purple', 'Purple'), |
||||
|
('black', 'Black'), ('brown', 'Brown')], |
||||
|
string='Color', required=True, default='red', |
||||
|
help="Choose a color for selected range") |
||||
|
|
||||
|
@api.multi |
||||
|
def assign_progress_bar_color(self): |
||||
|
values = self.env['set.progressbar.color'].search([]) |
||||
|
list_ret = [] |
||||
|
for value in values: |
||||
|
list_temp = [] |
||||
|
list_temp.append(value.range_start) |
||||
|
list_temp.append(value.range_stop) |
||||
|
list_temp.append(value.color) |
||||
|
list_ret.append(list_temp) |
||||
|
return list_ret |
||||
|
|
||||
|
@api.multi |
||||
|
@api.constrains('range_start', 'range_stop') |
||||
|
def check_range(self): |
||||
|
if self.range_start > self.range_stop: |
||||
|
raise exceptions.ValidationError("Start range should be less than stop range") |
@ -0,0 +1,59 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2009-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
||||
|
# Author: Nilmar Shereef(<http://www.cybrosys.com>) |
||||
|
# you can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# It is forbidden to publish, distribute, sublicense, or sell copies |
||||
|
# of the Software or modified copies of the Software. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
from odoo import fields, models |
||||
|
from dateutil.relativedelta import relativedelta |
||||
|
|
||||
|
|
||||
|
class TaskLifeline(models.Model): |
||||
|
_inherit = 'project.task' |
||||
|
|
||||
|
lifeline = fields.Float(string="Life line", default='100', copy=False, readonly=True) |
||||
|
date_deadline = fields.Datetime('Deadline', required=True) |
||||
|
|
||||
|
def process_lifeline_scheduler(self): |
||||
|
task_obj = self.env['project.task'] |
||||
|
task_ids = task_obj.search([]) |
||||
|
time_now = fields.Datetime.from_string(fields.Datetime.now()) |
||||
|
for task in task_ids: |
||||
|
start_date = fields.Datetime.from_string(task.date_assign) |
||||
|
end_date = fields.Datetime.from_string(task.date_deadline) |
||||
|
if task.stage_id and (task.stage_id.name == 'Done' or task.stage_id.name == 'Cancelled'): |
||||
|
task.lifeline = 0 |
||||
|
else: |
||||
|
if task.date_deadline and task.date_assign and end_date > start_date: |
||||
|
if time_now < end_date: |
||||
|
total_difference_days = relativedelta(end_date, start_date) |
||||
|
difference_minute = total_difference_days.hours * 60 + total_difference_days.minutes |
||||
|
date_difference = end_date - start_date |
||||
|
total_difference_minute = int(date_difference.days) * 24 * 60 + difference_minute |
||||
|
|
||||
|
remaining_days = relativedelta(time_now, start_date) |
||||
|
remaining_minute = remaining_days.hours * 60 + remaining_days.minutes |
||||
|
date_remaining = time_now - start_date |
||||
|
total_minute_remaining = int(date_remaining.days) * 24 * 60 + remaining_minute |
||||
|
if total_difference_minute != 0: |
||||
|
task.lifeline = (100 - ((total_minute_remaining * 100) / total_difference_minute)) |
||||
|
else: |
||||
|
task.lifeline = 0 |
||||
|
else: |
||||
|
task.lifeline = 0 |
After Width: | Height: | Size: 134 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 65 KiB |
After Width: | Height: | Size: 13 KiB |
@ -0,0 +1,131 @@ |
|||||
|
<section class="oe_container"> |
||||
|
<div class="oe_row oe_spaced"> |
||||
|
<h2 class="oe_slogan">LifeLine ProgressBar for Task</h2> |
||||
|
<h3 class="oe_slogan">LifeLine is calculated based on live time and deadline time.</h3> |
||||
|
<h4 class="oe_slogan">Author : Cybrosys Techno Solutions , www.cybrosys.com</h4> |
||||
|
</div> |
||||
|
<div class="row oe_row oe_spaced"> |
||||
|
<div class="col-md-6"> |
||||
|
☀ User Defined Progress Bar Colour Configuration.<br> |
||||
|
☀ Task Lifeline Bar based on Deadline.<br> |
||||
|
☀ Automatic Colour Change of Lifeline Bar.<br> |
||||
|
☀ Default Colour for Forbidden.<br> |
||||
|
</div> |
||||
|
<div class="col-md-6"> |
||||
|
<div class="oe_bg_img"> |
||||
|
<img class="oe_picture oe_screenshot center-block" src="disply.png" style="margin-top: 0px !important;"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</section> |
||||
|
|
||||
|
<section class="oe_container"> |
||||
|
<div class="oe_row oe_spaced"> |
||||
|
<p class='oe_mt32'> |
||||
|
☛ Default Form/Tree view of Task |
||||
|
</p> |
||||
|
<div class="oe_span6"> |
||||
|
<div class="oe_demo oe_picture oe_screenshot"> |
||||
|
<p><center>Form View</center></p> |
||||
|
<img src="form_view.png"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="oe_span6"> |
||||
|
<div class="oe_demo oe_picture oe_screenshot"> |
||||
|
<p><center>Tree View</center></p> |
||||
|
<img src="tree_view.png"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</section> |
||||
|
|
||||
|
<section class="oe_container oe_dark"> |
||||
|
<div class="oe_row oe_padded"> |
||||
|
<p class='oe_mt32'> |
||||
|
☛User Can Define the Color of Progressbar for Different Percentage Ranges. |
||||
|
</p> |
||||
|
<div class="oe_span6"> |
||||
|
<div class="oe_row_img oe_centered"> |
||||
|
<p><center>Form View</center></p> |
||||
|
<img class="oe_picture oe_screenshot" src="set_range_form_view.png"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="oe_span6"> |
||||
|
<div class="oe_row_img oe_centered"> |
||||
|
<p><center>Tree View</center></p> |
||||
|
<img class="oe_picture oe_screenshot" src="set_range_tree_view.png"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="oe_span6"> |
||||
|
</div> |
||||
|
</section> |
||||
|
<section class="oe_container oe_dark"> |
||||
|
<div class="oe_row oe_padded"> |
||||
|
<p class='oe_mt32'> |
||||
|
☛Color of progressbar based on different ranges |
||||
|
</p> |
||||
|
<div class="oe_span6"> |
||||
|
<div class="oe_row_img oe_centered"> |
||||
|
<img class="oe_picture oe_screenshot" src="set_green.png"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="oe_span6"> |
||||
|
<div class="oe_row_img oe_centered"> |
||||
|
<img class="oe_picture oe_screenshot" src="set_range_green.png"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</section> |
||||
|
<section class="oe_container "> |
||||
|
<div class="oe_row oe_padded"> |
||||
|
<p class='oe_mt32'> |
||||
|
☛Color of progressbar based on different ranges |
||||
|
</p> |
||||
|
<div class="oe_span6"> |
||||
|
<div class="oe_row_img oe_centered"> |
||||
|
<img class="oe_picture oe_screenshot" src="set_yellow.png"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="oe_span6"> |
||||
|
<div class="oe_row_img oe_centered"> |
||||
|
<img class="oe_picture oe_screenshot" src="set_range_yellow.png"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</section> |
||||
|
<section class="oe_container oe_dark"> |
||||
|
<div class="oe_row oe_padded"> |
||||
|
<p class='oe_mt32'> |
||||
|
☛Color of progressbar based on different ranges |
||||
|
</p> |
||||
|
<div class="oe_span6"> |
||||
|
<div class="oe_row_img oe_centered"> |
||||
|
<img class="oe_picture oe_screenshot" src="set_red.png"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="oe_span6"> |
||||
|
<div class="oe_row_img oe_centered"> |
||||
|
<img class="oe_picture oe_screenshot" src="set_range_red.png"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</section> |
||||
|
|
||||
|
<section class="oe_container oe_dark"> |
||||
|
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2> |
||||
|
<div class="oe_slogan" style="margin-top:10px !important;"> |
||||
|
<a class="btn btn-primary btn-lg mt8" |
||||
|
style="color: #FFFFFF !important;" href="http://www.cybrosys.com"><i |
||||
|
class="fa fa-envelope"></i> Email </a> <a |
||||
|
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;" |
||||
|
href="http://www.cybrosys.com/contact/"><i |
||||
|
class="fa fa-phone"></i> Contact Us </a> <a |
||||
|
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;" |
||||
|
href="http://www.cybrosys.com/odoo-customization-and-installation/"><i |
||||
|
class="fa fa-check-square"></i> Request Customization </a> |
||||
|
</div> |
||||
|
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block"> |
||||
|
</section> |
After Width: | Height: | Size: 75 KiB |
After Width: | Height: | Size: 64 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 73 KiB |
After Width: | Height: | Size: 73 KiB |
After Width: | Height: | Size: 78 KiB |
@ -0,0 +1,52 @@ |
|||||
|
.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: orange; |
||||
|
height: 100%; |
||||
|
} |
||||
|
.o_progressbar .o_progress .o_progressbar_complete.o_progress_red { |
||||
|
background-color: #FF0000; |
||||
|
height: 100%; |
||||
|
} |
||||
|
.o_progressbar .o_progress .o_progressbar_complete.o_progress_pink { |
||||
|
background-color: #FFC0CB; |
||||
|
height: 100%; |
||||
|
} |
||||
|
.o_progressbar .o_progress .o_progressbar_complete.o_progress_orange { |
||||
|
background-color: #FFA500; |
||||
|
height: 100%; |
||||
|
} |
||||
|
.o_progressbar .o_progress .o_progressbar_complete.o_progress_yellow { |
||||
|
background-color: #FFFF00; |
||||
|
height: 100%; |
||||
|
} |
||||
|
.o_progressbar .o_progress .o_progressbar_complete.o_progress_light_green { |
||||
|
background-color: #00FF00; |
||||
|
height: 100%; |
||||
|
} |
||||
|
.o_progressbar .o_progress .o_progressbar_complete.o_progress_green { |
||||
|
background-color: #008000; |
||||
|
height: 100%; |
||||
|
} |
||||
|
.o_progressbar .o_progress .o_progressbar_complete.o_progress_grey { |
||||
|
background-color:#A9A9A9; |
||||
|
height: 100%; |
||||
|
} |
||||
|
.o_progressbar .o_progress .o_progressbar_complete.o_progress_blue { |
||||
|
background-color:#0000FF; |
||||
|
height: 100%; |
||||
|
} |
||||
|
.o_progressbar .o_progress .o_progressbar_complete.o_progress_purple { |
||||
|
background-color:#800080; |
||||
|
height: 100%; |
||||
|
} |
||||
|
.o_progressbar .o_progress .o_progressbar_complete.o_progress_brown { |
||||
|
background-color:#835C3B; |
||||
|
height: 100%; |
||||
|
} |
||||
|
.o_progressbar .o_progress .o_progressbar_complete.o_progress_black { |
||||
|
background-color:#000000; |
||||
|
height: 100%; |
||||
|
} |
@ -0,0 +1,83 @@ |
|||||
|
odoo.define('progress_bar_color.ProgressBar', function (require) { |
||||
|
"use strict"; |
||||
|
|
||||
|
var core = require('web.core'); |
||||
|
var utils = require('web.utils'); |
||||
|
var Widget = require('web.Widget'); |
||||
|
var ProgressBar = require('web.ProgressBar') |
||||
|
var Model = require('web.DataModel'); |
||||
|
|
||||
|
var QWeb = core.qweb; |
||||
|
var _t = core._t; |
||||
|
|
||||
|
|
||||
|
ProgressBar.include({ |
||||
|
|
||||
|
_render_value: function(v) { |
||||
|
var self = this |
||||
|
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; |
||||
|
} |
||||
|
var Users = new Model('set.progressbar.color'); |
||||
|
Users.call('assign_progress_bar_color', [[]]).then(function (result) { |
||||
|
if (result[0]){ |
||||
|
for (var ranges = 0; ranges < result.length; ranges++){ |
||||
|
self.$('.o_progress').toggleClass('o_progress_overflow', value > max_value); |
||||
|
if (widthComplete >= result[ranges][0] && widthComplete <= result[ranges][1]){ |
||||
|
console.log(widthComplete) |
||||
|
self.$('.o_progressbar_complete').toggleClass('o_progress_red', result[ranges][2] == 'red').css('width', widthComplete + '%'); |
||||
|
self.$('.o_progressbar_complete').toggleClass('o_progress_pink', result[ranges][2] == 'pink').css('width', widthComplete + '%'); |
||||
|
self.$('.o_progressbar_complete').toggleClass('o_progress_orange', result[ranges][2] == 'orange').css('width', widthComplete + '%'); |
||||
|
self.$('.o_progressbar_complete').toggleClass('o_progress_yellow', result[ranges][2] == 'yellow').css('width', widthComplete + '%'); |
||||
|
self.$('.o_progressbar_complete').toggleClass('o_progress_light_green', result[ranges][2] == 'light_green').css('width', widthComplete + '%'); |
||||
|
self.$('.o_progressbar_complete').toggleClass('o_progress_green', result[ranges][2] == 'green').css('width', widthComplete + '%'); |
||||
|
self.$('.o_progressbar_complete').toggleClass('o_progress_grey', result[ranges][2] == 'grey').css('width', widthComplete + '%'); |
||||
|
self.$('.o_progressbar_complete').toggleClass('o_progress_blue', result[ranges][2] == 'blue').css('width', widthComplete + '%'); |
||||
|
self.$('.o_progressbar_complete').toggleClass('o_progress_purple', result[ranges][2] == 'purple').css('width', widthComplete + '%'); |
||||
|
self.$('.o_progressbar_complete').toggleClass('o_progress_black', result[ranges][2] == 'black').css('width', widthComplete + '%'); |
||||
|
self.$('.o_progressbar_complete').toggleClass('o_progress_brown', result[ranges][2] == 'brown').css('width', widthComplete + '%'); |
||||
|
|
||||
|
break; |
||||
|
} |
||||
|
else if (ranges == (result.length - 1)){ |
||||
|
self.$('.o_progressbar_complete').toggleClass('o_progress_grey', widthComplete != 0).css('width', widthComplete + '%'); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
else{ |
||||
|
self.$('.o_progress').toggleClass('o_progress_overflow', value > max_value); |
||||
|
self.$('.o_progressbar_complete').toggleClass('o_progress_gt_fty', widthComplete > 50).css('width', widthComplete + '%'); |
||||
|
self.$('.o_progressbar_complete').toggleClass('o_progress_lt_fty', widthComplete <= 50).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); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
}); |
@ -0,0 +1,54 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<data> |
||||
|
|
||||
|
<record model="ir.ui.view" id="set_progress_bar_color_tree_view"> |
||||
|
<field name="name">set.progressbar.color.tree</field> |
||||
|
<field name="model">set.progressbar.color</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<tree string="Set Color"> |
||||
|
<field name="range_start"/> |
||||
|
<field name="range_stop"/> |
||||
|
<field name="color"/> |
||||
|
</tree> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<record model="ir.ui.view" id="set_progress_bar_color_form_view"> |
||||
|
<field name="name">set.progressbar.color.form</field> |
||||
|
<field name="model">set.progressbar.color</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<form string="Set Color"> |
||||
|
<sheet> |
||||
|
<group> |
||||
|
<group> |
||||
|
<field name="range_start"/> |
||||
|
<field name="color"/> |
||||
|
</group> |
||||
|
<group> |
||||
|
<field name="range_stop"/> |
||||
|
</group> |
||||
|
</group> |
||||
|
</sheet> |
||||
|
</form> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<record id="set_progressbar_color" model="ir.actions.act_window"> |
||||
|
<field name="name">Set Range</field> |
||||
|
<field name="res_model">set.progressbar.color</field> |
||||
|
<field name="view_type">form</field> |
||||
|
<field name="view_mode">tree,form</field> |
||||
|
<field name="help" type="html"> |
||||
|
<p class="oe_view_nocontent_create"> |
||||
|
Create a new range |
||||
|
</p><p> |
||||
|
Create a new range and assign a color for progress bar |
||||
|
</p> |
||||
|
</field> |
||||
|
</record> |
||||
|
<menuitem id="progress_bar_menu" name="Set Progressbar Color" parent="project.menu_project_config" |
||||
|
action="set_progressbar_color"/> |
||||
|
|
||||
|
</data> |
||||
|
</odoo> |
@ -0,0 +1,13 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<data> |
||||
|
|
||||
|
<template id="assets_backend" name="progress_bar_color" inherit_id="web.assets_backend"> |
||||
|
<xpath expr="." position="inside"> |
||||
|
<link rel="stylesheet" href="/project_lifeline/static/src/css/progress_bar_color.css"/> |
||||
|
<script type="text/javascript" src="/project_lifeline/static/src/js/progress_bar_color.js"></script> |
||||
|
</xpath> |
||||
|
</template> |
||||
|
|
||||
|
</data> |
||||
|
</odoo> |
@ -0,0 +1,39 @@ |
|||||
|
<odoo> |
||||
|
<data> |
||||
|
<record id="ir_cron_scheduler_project_task" model="ir.cron"> |
||||
|
<field name="name">Lifeline scheduler</field> |
||||
|
<field name="user_id" ref="base.user_root"/> |
||||
|
<field name="interval_number">1</field> |
||||
|
<field name="interval_type">minutes</field> |
||||
|
<field name="numbercall">-1</field> |
||||
|
<field eval="False" name="doall"/> |
||||
|
<field eval="'project.task'" name="model"/> |
||||
|
<field eval="'process_lifeline_scheduler'" name="function"/> |
||||
|
</record> |
||||
|
|
||||
|
<record id="project_lifeline_tree_view" model="ir.ui.view"> |
||||
|
<field name="name">project.lifeline.tree</field> |
||||
|
<field name="model">project.task</field> |
||||
|
<field name="inherit_id" ref="project.view_task_tree2"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//field[@name='user_id']" position="after"> |
||||
|
<field name="lifeline" widget="progressbar"/> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<record id="project_lifeline_form_view" model="ir.ui.view"> |
||||
|
<field name="name">project.lifeline.form</field> |
||||
|
<field name="model">project.task</field> |
||||
|
<field name="inherit_id" ref="project.view_task_form2"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//field[@name='date_deadline']" position="replace"> |
||||
|
<field name="date_deadline"/> |
||||
|
</xpath> |
||||
|
<xpath expr="//field[@name='tag_ids']" position="after"> |
||||
|
<field name="lifeline" widget="progressbar"/> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
</data> |
||||
|
</odoo> |