Kunal Chavda (OpenERP) has proposed merging 
lp:~openerp-dev/openerp-web/trunk-bug-908764-kch into lp:openerp-web.

Requested reviews:
  OpenERP R&D Web Team (openerp-dev-web)
Related bugs:
  Bug #908764 in OpenERP Web: "web gantt view"
  https://bugs.launchpad.net/openerp-web/+bug/908764

For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-bug-908764-kch/+merge/87001

Hello,
I have coded for showing progress information in gantt view tooltip.
For this i have added attribute in view.rng file at server.
Also from addons side there should be pass that attribute from gantt view(xml).

Thanks,
Kunal Chavda
-- 
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-bug-908764-kch/+merge/87001
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openerp-web/trunk-bug-908764-kch.
=== modified file 'addons/web_gantt/static/src/js/gantt.js'
--- addons/web_gantt/static/src/js/gantt.js	2011-12-16 13:00:00 +0000
+++ addons/web_gantt/static/src/js/gantt.js	2011-12-28 10:24:24 +0000
@@ -26,31 +26,31 @@
     },
 
     on_loaded: function(data) {
-
         this.fields_view = data,
         this.name =  this.fields_view.arch.attrs.string,
         this.view_id = this.fields_view.view_id,
         this.fields = this.fields_view.fields;
-        
+
         this.date_start = this.fields_view.arch.attrs.date_start,
         this.date_delay = this.fields_view.arch.attrs.date_delay,
         this.date_stop = this.fields_view.arch.attrs.date_stop,
         this.day_length = this.fields_view.arch.attrs.day_length || 8;
+		this.process_completed = this.fields_view.arch.attrs.process_completed;
 
         this.color_field = this.fields_view.arch.attrs.color,
         this.colors = this.fields_view.arch.attrs.colors;
-        
+
         if (this.fields_view.arch.children.length) {
             var level = this.fields_view.arch.children[0];
             this.parent = level.attrs.link, this.text = level.children.length ? level.children[0].attrs.name : level.attrs.name;
         } else {
             this.text = 'name';
         }
-        
+
         if (!this.date_start) {
             return self.do_warn(_t("date_start is not defined "))
         }
-        
+
         this.$element.html(QWeb.render("GanttView", {'height': $('.oe-application-container').height(), 'width': $('.oe-application-container').width()}));
         this.has_been_loaded.resolve();
     },
@@ -66,7 +66,7 @@
         ganttChartControl.showDescProject(true,'n,d');
 
     },
-    
+
     project_starting_date : function() {
         var self = this,
             projects = this.database_projects,
@@ -74,11 +74,11 @@
                 return self.format_date(prj[self.date_start]);
             });
         if (min_date) this.project_start_date = this.format_date(min_date[self.date_start]);
-        else 
+        else
             this.project_start_date = Date.today();
         return $.Deferred().resolve().promise();
     },
-    
+
     format_date : function(date) {
         var datetime_regex = /^(\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d)(?:\.\d+)?$/,
             date_regex = /^\d\d\d\d-\d\d-\d\d$/,
@@ -97,18 +97,18 @@
     },
 
     on_project_loaded: function(events) {
-        
+
         if(!events.length) return;
         var self = this,
             started_projects = _.filter(events, function(res) {
             return res[self.date_start];
         });
-        
+
         this.database_projects = started_projects;
-        
+
         if(!started_projects.length)
             return self.do_warn(_t("date_start is not defined"));
-            
+
         if(!self.name && started_projects.length) {
             var name = started_projects[0][self.parent];
             self.name = name instanceof Array? name[name.length - 1] : name;
@@ -116,7 +116,7 @@
         this.$element.find('#add_task').click(function(){
             self.editTask();
         });
-        
+
         $.when(this.project_starting_date())
             .then(function() {
                 if(self.ganttChartControl) {
@@ -125,7 +125,7 @@
                 }
             })
             .done(this.init_gantt_view());
-        
+
         var self = this;
         var show_event = started_projects;
         _.each(show_event, function(evt) {evt[self.date_start] = self.format_date(evt[self.date_start])});
@@ -139,6 +139,7 @@
         var child_event = {};
         var temp_id = "";
         var final_events = [];
+
         for (var i in show_event) {
 
             var res = show_event[i];
@@ -146,6 +147,7 @@
             var id = res['id'];
             var text = res[this.text];
             var start_date = res[this.date_start];
+			var progress = res[this.process_completed];
 
             if (this.date_stop != undefined){
                 if (res[this.date_stop] != false){
@@ -181,7 +183,7 @@
                             var mod_id = i+ "_" +j;
                             parents[grp_key] = mod_id;
                             child_event[mod_id] = {};
-                            all_events[mod_id] = {'parent': "", 'evt':[mod_id , grp_key, start_date, start_date, 100, ""]};
+                            all_events[mod_id] = {'parent': "", 'evt':[mod_id , grp_key, start_date, start_date, progress, ""]};
                         }
                         else{
                             mod_id = parents[grp_key];
@@ -193,7 +195,7 @@
                             child_event[mod_id][grp_key] = ch_mod_id;
                             child_event[ch_mod_id] = {};
                             temp_id = ch_mod_id;
-                            all_events[ch_mod_id] = {'parent': mod_id, 'evt':[ch_mod_id , grp_key, start_date, start_date, 100, ""]};
+                            all_events[ch_mod_id] = {'parent': mod_id, 'evt':[ch_mod_id , grp_key, start_date, start_date, progress, ""]};
                             mod_id = ch_mod_id;
                         }
                         else{
@@ -202,15 +204,15 @@
                         }
                     }
                 }
-                all_events[id] = {'parent': temp_id, 'evt':[id , text, start_date, duration, 100, ""]};
+                all_events[id] = {'parent': temp_id, 'evt':[id , text, start_date, duration, progress, ""]};
                 final_events.push(id);
             }
             else {
                 if (i == 0) {
                     var mod_id = "_" + i;
-                    all_events[mod_id] = {'parent': "", 'evt': [mod_id, this.name, start_date, start_date, 100, ""]};
+                    all_events[mod_id] = {'parent': "", 'evt': [mod_id, this.name, start_date, start_date, progress, ""]};
                 }
-                all_events[id] = {'parent': mod_id, 'evt':[id , text, start_date, duration, 100, ""]};
+                all_events[id] = {'parent': mod_id, 'evt':[id , text, start_date, duration, progress, ""]};
                 final_events.push(id);
             }
         }
@@ -277,7 +279,7 @@
         }
 
         self.ganttChartControl.create("GanttView");
-        
+
         // Setup Events
         self.ganttChartControl.attachEvent("onTaskStartDrag", function(task) {
             if (task.parentTask) {
@@ -293,7 +295,7 @@
         });
         self.ganttChartControl.attachEvent("onTaskEndResize", function(task) {return self.resizeTask(task);});
         self.ganttChartControl.attachEvent("onTaskEndDrag", function(task) {return self.resizeTask(task);});
-        
+
         var taskdiv = $("div.taskPanel").parent();
         taskdiv.addClass('ganttTaskPanel');
         taskdiv.prev().addClass('ganttDayPanel');
@@ -313,13 +315,13 @@
                 self.reloadView();
             }, 200);
         });
-        
+
         var project = self.ganttChartControl.getProjectById("_1");
         if (project) {
             $(project.projectItem[0]).hide();
             $(project.projectNameItem).hide();
             $(project.descrProject).hide();
-            
+
             _.each(final_events, function(id) {
                 var Task = project.getTaskById(id);
                 $(Task.cTaskNameItem[0]).click(function() {
@@ -328,16 +330,16 @@
             });
         }
     },
-    
+
     resizeTask: function(task) {
         var self = this,
             event_id = task.getId();
         if(task.childTask.length)
             return;
-        
+
         var data = {};
         data[this.date_start] = task.getEST().toString(this.date_format);
-        
+
         if(this.date_stop) {
             var diff = task.getDuration() % this.day_length,
                 finished_date = task.getFinishDate().add({hours: diff});
@@ -353,7 +355,7 @@
                 self.reloadView();
             });
     },
-    
+
     editTask: function(task) {
         var self = this,
             event_id;
@@ -365,11 +367,11 @@
                 return false;
         }
         if(event_id) event_id = parseInt(event_id, 10);
-        
+
         var pop = new openerp.web.form.FormOpenPopup(this);
-        
+
         pop.show_element(this.model, event_id, this.context || this.dataset.context, {});
-        
+
         pop.on_write.add(function(id, data) {
             var get_project = _.find(self.database_projects, function(project){ return project.id == id});
             if (get_project) {
@@ -467,12 +469,12 @@
                 this.date_format = "yyyy-MM-dd HH:mm:ss";
                 return openerp.web.str_to_datetime(str);
             }
-            else 
+            else
                 if (str.length == 10) {
                     this.date_format = "yyyy-MM-dd";
                     return openerp.web.str_to_date(str);
                 }
-                else 
+                else
                     if (str.length == 8) {
                         this.date_format = "HH:mm:ss";
                         return openerp.web.str_to_time(str);
@@ -493,7 +495,7 @@
         }
         throw "Unrecognized date/time format";
     },
-    
+
     reloadView: function() {
        return this.on_project_loaded(this.database_projects);
     },
@@ -504,11 +506,11 @@
         if (this.fields_view.arch.attrs.default_group_by) {
             this.group_by = this.fields_view.arch.attrs.default_group_by.split(',');
         }
-        
+
         if (groupbys.length) {
             this.group_by = groupbys;
         }
-        
+
         $.when(this.has_been_loaded).then(function() {
                 self.dataset.read_slice([], {
                     domain: domains,

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to