← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~hirt/ocb-web/6.1_ocb-web_gantt_progress into lp:ocb-web/6.1

 

Etienne Hirt has proposed merging lp:~hirt/ocb-web/6.1_ocb-web_gantt_progress into lp:ocb-web/6.1.

Requested reviews:
  OpenERP Community Backports (ocb)

For more details, see:
https://code.launchpad.net/~hirt/ocb-web/6.1_ocb-web_gantt_progress/+merge/238849

make the progress visible in both the gantt bar and the tooltip

~hirt/ocb-server/6.1_ocb-server_gantt_progress should be merged before with ocb-server backport
-- 
https://code.launchpad.net/~hirt/ocb-web/6.1_ocb-web_gantt_progress/+merge/238849
Your team OpenERP Community Backports is requested to review the proposed merge of lp:~hirt/ocb-web/6.1_ocb-web_gantt_progress into lp:ocb-web/6.1.
=== modified file 'addons/web_gantt/static/lib/dhtmlxGantt/sources/dhtmlxgantt.js'
--- addons/web_gantt/static/lib/dhtmlxGantt/sources/dhtmlxgantt.js	2012-07-02 13:30:16 +0000
+++ addons/web_gantt/static/lib/dhtmlxGantt/sources/dhtmlxgantt.js	2014-10-20 08:03:57 +0000
@@ -3142,7 +3142,7 @@
     tblInfo.rows[0].cells[0].innerHTML += "<span class='st'>Start Date:&nbsp;</span><span class='ut'>" + this.TaskInfo.EST.getDate() + "." + (this.TaskInfo.EST.getMonth() + 1) + "." + this.TaskInfo.EST.getFullYear() + "</span><br/>";
     // Hidden because currently misleading or unavailable:
     //  tblInfo.rows[0].cells[0].innerHTML += "<span class='st'>Duration:&nbsp;</span><span class='ut'>" + this.TaskInfo.Duration + " hours </span><br/>";
-    //  tblInfo.rows[0].cells[0].innerHTML += "<span class='st'>Percent Complete:&nbsp;</span><span class='ut'>" + this.TaskInfo.PercentCompleted + "% </span><br/>";
+    tblInfo.rows[0].cells[0].innerHTML += "<span class='st'>Percent Complete:&nbsp;</span><span class='ut'>" + this.TaskInfo.PercentCompleted + "% </span><br/>";
 
     //show predecessor task
     if (this.predTask)

=== modified file 'addons/web_gantt/static/src/js/gantt.js'
--- addons/web_gantt/static/src/js/gantt.js	2012-01-27 16:06:45 +0000
+++ addons/web_gantt/static/src/js/gantt.js	2014-10-20 08:03:57 +0000
@@ -39,7 +39,7 @@
             n_group_bys = group_bys;
         }
         // gather the fields to get
-        var fields = _.compact(_.map(["date_start", "date_delay", "date_stop"], function(key) {
+        var fields = _.compact(_.map(["date_start", "date_delay", "date_stop", "progress"], function(key) {
             return self.fields_view.arch.attrs[key] || '';
         }));
         fields = _.uniq(fields.concat(n_group_bys));
@@ -109,6 +109,11 @@
         var task_ids = {};
         // creation of the chart
         var generate_task_info = function(task, plevel) {
+            if (_.isNumber(task[self.fields_view.arch.attrs.progress])) {
+                var percent = task[self.fields_view.arch.attrs.progress] || 0;
+            } else {
+                var percent = 100;
+            }
             var level = plevel || 0;
             if (task.__is_group) {
                 var task_infos = _.compact(_.map(task.tasks, function(sub_task) {
@@ -131,7 +136,7 @@
                     });
                     return group;
                 } else {
-                    var group = new GanttTaskInfo(_.uniqueId("gantt_project_task_"), group_name, task_start, duration, 100);
+                    var group = new GanttTaskInfo(_.uniqueId("gantt_project_task_"), group_name, task_start, duration || 1, percent);
                     _.each(task_infos, function(el) {
                         group.addChildTask(el.task_info);
                     });
@@ -156,7 +161,7 @@
                 }
                 var duration = (task_stop.getTime() - task_start.getTime()) / (1000 * 60 * 60);
                 var id = _.uniqueId("gantt_task_");
-                var task_info = new GanttTaskInfo(id, task_name, task_start, ((duration / 24) * 8), 100);
+                var task_info = new GanttTaskInfo(id, task_name, task_start, ((duration / 24) * 8) || 1, percent);
                 task_info.internal_task = task;
                 task_ids[id] = task_info;
                 return {task_info: task_info, task_start: task_start, task_stop: task_stop};