Merge lp:~openerp-dev/openerp-web/7.0-trunk-opw-576040-port-ggh into lp:openerp-web/7.0

Proposed by Farid Ghanchi on 2013-01-22
Status: Needs review
Proposed branch: lp:~openerp-dev/openerp-web/7.0-trunk-opw-576040-port-ggh
Merge into: lp:openerp-web/7.0
Diff against target: 86 lines (+13/-9)
2 files modified
addons/web_gantt/static/lib/dhtmlxGantt/sources/dhtmlxgantt.js (+2/-2)
addons/web_gantt/static/src/js/gantt.js (+11/-7)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/7.0-trunk-opw-576040-port-ggh
Reviewer Review Type Date Requested Status
OpenERP Core Team 2013-01-22 Pending
Review via email: mp+144261@code.launchpad.net

Description of the change

Hello,

In revision: 3709
step to reproduce:
In messaging >> calender(meeting) >> gantt view
Gantt chart not showing right duration when we provide date_dalay(duration).

when we mouse hover any event bar so in tooltip wrong daration display.when we edit daration time suppose duration=20 hours not same hour in tooltip show.

In revision: 3710
step to reproduce:
setting>>language>> edit English lang. change decimal separator suppose comma(,)
and then again go above step so not display proper gantt view..

format_value change the value from "." to "," when decimal separator "," and duration not set for any event.

In revision: 3711
In Gantt chart default set working hours "8".
we set in xml code day_length='10'

so we set in (day_length=10)hour (working hours).

Thanks.

To post a comment you must log in.

Unmerged revisions

3711. By Farid Ghanchi on 2013-01-22

[Fix] Fixed in Gantt chart day_length attr are used

3710. By Farid Ghanchi on 2013-01-22

[Fix] Fixed the issue of decimal saperator changed so date duration format_value behaviour problem

3709. By Farid Ghanchi on 2013-01-22

[Fix] Fixed the issue of gantt chart not show right duration when date_delay provide

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'addons/web_gantt/static/lib/dhtmlxGantt/sources/dhtmlxgantt.js'
--- addons/web_gantt/static/lib/dhtmlxGantt/sources/dhtmlxgantt.js 2012-01-27 13:35:08 +0000
+++ addons/web_gantt/static/lib/dhtmlxGantt/sources/dhtmlxgantt.js 2013-01-22 10:19:20 +0000
@@ -348,7 +348,7 @@
348 * @type: public348 * @type: public
349 * @topic: 0349 * @topic: 0
350 */350 */
351function GanttChart()351function GanttChart(day_length)
352{352{
353 this.Error = new GanttError();353 this.Error = new GanttError();
354 this.dhtmlXMLSenderObject = new dhtmlXMLSenderObject(this);354 this.dhtmlXMLSenderObject = new dhtmlXMLSenderObject(this);
@@ -356,7 +356,7 @@
356 //settings356 //settings
357 this.heightTaskItem = 12;357 this.heightTaskItem = 12;
358 this.dayInPixels = 24;358 this.dayInPixels = 24;
359 this.hoursInDay = 8;359 this.hoursInDay = day_length;
360 this._showTreePanel = true;360 this._showTreePanel = true;
361 this._showTooltip = true;361 this._showTooltip = true;
362 this.isShowDescTask = false;362 this.isShowDescTask = false;
363363
=== modified file 'addons/web_gantt/static/src/js/gantt.js'
--- addons/web_gantt/static/src/js/gantt.js 2012-12-28 10:31:54 +0000
+++ addons/web_gantt/static/src/js/gantt.js 2013-01-22 10:19:20 +0000
@@ -65,6 +65,7 @@
65 on_data_loaded: function(tasks, group_bys) {65 on_data_loaded: function(tasks, group_bys) {
66 var self = this;66 var self = this;
67 var ids = _.pluck(tasks, "id");67 var ids = _.pluck(tasks, "id");
68 day_length = self.fields_view.arch.attrs.day_length || 8;
68 return this.dataset.name_get(ids).then(function(names) {69 return this.dataset.name_get(ids).then(function(names) {
69 var ntasks = _.map(tasks, function(task) {70 var ntasks = _.map(tasks, function(task) {
70 return _.extend({__name: _.detect(names, function(name) { return name[0] == task.id; })[1]}, task); 71 return _.extend({__name: _.detect(names, function(name) { return name[0] == task.id; })[1]}, task);
@@ -152,26 +153,28 @@
152 task_stop = instance.web.auto_str_to_date(task[self.fields_view.arch.attrs.date_stop]);153 task_stop = instance.web.auto_str_to_date(task[self.fields_view.arch.attrs.date_stop]);
153 if (!task_stop)154 if (!task_stop)
154 return;155 return;
156 var duration = (task_stop.getTime() - task_start.getTime()) / (1000 * 60 * 60);
157 duration = ((duration / 24) * day_length);
155 } else { // we assume date_duration is defined158 } else { // we assume date_duration is defined
156 var tmp = instance.web.format_value(task[self.fields_view.arch.attrs.date_delay],159 var tmp = task[self.fields_view.arch.attrs.date_delay];
157 self.fields[self.fields_view.arch.attrs.date_delay]);
158 if (!tmp)160 if (!tmp)
159 return;161 return;
160 task_stop = task_start.clone().addMilliseconds(tmp * 60 * 60 * 1000);162 task_stop = task_start.clone().addMilliseconds(tmp * 60 * 60 * 1000);
163 var duration = tmp;
161 }164 }
162 var duration = (task_stop.getTime() - task_start.getTime()) / (1000 * 60 * 60);
163 var id = _.uniqueId("gantt_task_");165 var id = _.uniqueId("gantt_task_");
164 var task_info = new GanttTaskInfo(id, task_name, task_start, ((duration / 24) * 8) || 1, 100);166 var task_info = new GanttTaskInfo(id, task_name, task_start, duration, 100);
165 task_info.internal_task = task;167 task_info.internal_task = task;
166 task_ids[id] = task_info;168 task_ids[id] = task_info;
167 return {task_info: task_info, task_start: task_start, task_stop: task_stop};169 return {task_info: task_info, task_start: task_start, task_stop: task_stop};
168 }170 }
169 }171 }
170 var gantt = new GanttChart();172 var gantt = new GanttChart(day_length);
171 _.each(_.compact(_.map(groups, function(e) {return generate_task_info(e, 0);})), function(project) {173 _.each(_.compact(_.map(groups, function(e) {return generate_task_info(e, 0);})), function(project) {
172 gantt.addProject(project);174 gantt.addProject(project);
173 });175 });
174 gantt.setEditable(true);176 gantt.setEditable(true);
177 gantt.showDescTask(true,'s-f');
175 gantt.setImagePath("/web_gantt/static/lib/dhtmlxGantt/codebase/imgs/");178 gantt.setImagePath("/web_gantt/static/lib/dhtmlxGantt/codebase/imgs/");
176 gantt.attachEvent("onTaskEndDrag", function(task) {179 gantt.attachEvent("onTaskEndDrag", function(task) {
177 self.on_task_changed(task);180 self.on_task_changed(task);
@@ -202,15 +205,16 @@
202 var self = this;205 var self = this;
203 var itask = task_obj.TaskInfo.internal_task;206 var itask = task_obj.TaskInfo.internal_task;
204 var start = task_obj.getEST();207 var start = task_obj.getEST();
205 var duration = (task_obj.getDuration() / 8) * 24;
206 var end = start.clone().addMilliseconds(duration * 60 * 60 * 1000);
207 var data = {};208 var data = {};
208 data[self.fields_view.arch.attrs.date_start] =209 data[self.fields_view.arch.attrs.date_start] =
209 instance.web.auto_date_to_str(start, self.fields[self.fields_view.arch.attrs.date_start].type);210 instance.web.auto_date_to_str(start, self.fields[self.fields_view.arch.attrs.date_start].type);
210 if (self.fields_view.arch.attrs.date_stop) {211 if (self.fields_view.arch.attrs.date_stop) {
212 var duration = (task_obj.getDuration() / day_length) * 24;
213 var end = start.clone().addMilliseconds(duration * 60 * 60 * 1000);
211 data[self.fields_view.arch.attrs.date_stop] = 214 data[self.fields_view.arch.attrs.date_stop] =
212 instance.web.auto_date_to_str(end, self.fields[self.fields_view.arch.attrs.date_stop].type);215 instance.web.auto_date_to_str(end, self.fields[self.fields_view.arch.attrs.date_stop].type);
213 } else { // we assume date_duration is defined216 } else { // we assume date_duration is defined
217 var duration = task_obj.getDuration();
214 data[self.fields_view.arch.attrs.date_delay] = duration;218 data[self.fields_view.arch.attrs.date_delay] = duration;
215 }219 }
216 this.dataset.write(itask.id, data);220 this.dataset.write(itask.id, data);