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
1=== modified file 'addons/web_gantt/static/lib/dhtmlxGantt/sources/dhtmlxgantt.js'
2--- addons/web_gantt/static/lib/dhtmlxGantt/sources/dhtmlxgantt.js 2012-01-27 13:35:08 +0000
3+++ addons/web_gantt/static/lib/dhtmlxGantt/sources/dhtmlxgantt.js 2013-01-22 10:19:20 +0000
4@@ -348,7 +348,7 @@
5 * @type: public
6 * @topic: 0
7 */
8-function GanttChart()
9+function GanttChart(day_length)
10 {
11 this.Error = new GanttError();
12 this.dhtmlXMLSenderObject = new dhtmlXMLSenderObject(this);
13@@ -356,7 +356,7 @@
14 //settings
15 this.heightTaskItem = 12;
16 this.dayInPixels = 24;
17- this.hoursInDay = 8;
18+ this.hoursInDay = day_length;
19 this._showTreePanel = true;
20 this._showTooltip = true;
21 this.isShowDescTask = false;
22
23=== modified file 'addons/web_gantt/static/src/js/gantt.js'
24--- addons/web_gantt/static/src/js/gantt.js 2012-12-28 10:31:54 +0000
25+++ addons/web_gantt/static/src/js/gantt.js 2013-01-22 10:19:20 +0000
26@@ -65,6 +65,7 @@
27 on_data_loaded: function(tasks, group_bys) {
28 var self = this;
29 var ids = _.pluck(tasks, "id");
30+ day_length = self.fields_view.arch.attrs.day_length || 8;
31 return this.dataset.name_get(ids).then(function(names) {
32 var ntasks = _.map(tasks, function(task) {
33 return _.extend({__name: _.detect(names, function(name) { return name[0] == task.id; })[1]}, task);
34@@ -152,26 +153,28 @@
35 task_stop = instance.web.auto_str_to_date(task[self.fields_view.arch.attrs.date_stop]);
36 if (!task_stop)
37 return;
38+ var duration = (task_stop.getTime() - task_start.getTime()) / (1000 * 60 * 60);
39+ duration = ((duration / 24) * day_length);
40 } else { // we assume date_duration is defined
41- var tmp = instance.web.format_value(task[self.fields_view.arch.attrs.date_delay],
42- self.fields[self.fields_view.arch.attrs.date_delay]);
43+ var tmp = task[self.fields_view.arch.attrs.date_delay];
44 if (!tmp)
45 return;
46 task_stop = task_start.clone().addMilliseconds(tmp * 60 * 60 * 1000);
47+ var duration = tmp;
48 }
49- var duration = (task_stop.getTime() - task_start.getTime()) / (1000 * 60 * 60);
50 var id = _.uniqueId("gantt_task_");
51- var task_info = new GanttTaskInfo(id, task_name, task_start, ((duration / 24) * 8) || 1, 100);
52+ var task_info = new GanttTaskInfo(id, task_name, task_start, duration, 100);
53 task_info.internal_task = task;
54 task_ids[id] = task_info;
55 return {task_info: task_info, task_start: task_start, task_stop: task_stop};
56 }
57 }
58- var gantt = new GanttChart();
59+ var gantt = new GanttChart(day_length);
60 _.each(_.compact(_.map(groups, function(e) {return generate_task_info(e, 0);})), function(project) {
61 gantt.addProject(project);
62 });
63 gantt.setEditable(true);
64+ gantt.showDescTask(true,'s-f');
65 gantt.setImagePath("/web_gantt/static/lib/dhtmlxGantt/codebase/imgs/");
66 gantt.attachEvent("onTaskEndDrag", function(task) {
67 self.on_task_changed(task);
68@@ -202,15 +205,16 @@
69 var self = this;
70 var itask = task_obj.TaskInfo.internal_task;
71 var start = task_obj.getEST();
72- var duration = (task_obj.getDuration() / 8) * 24;
73- var end = start.clone().addMilliseconds(duration * 60 * 60 * 1000);
74 var data = {};
75 data[self.fields_view.arch.attrs.date_start] =
76 instance.web.auto_date_to_str(start, self.fields[self.fields_view.arch.attrs.date_start].type);
77 if (self.fields_view.arch.attrs.date_stop) {
78+ var duration = (task_obj.getDuration() / day_length) * 24;
79+ var end = start.clone().addMilliseconds(duration * 60 * 60 * 1000);
80 data[self.fields_view.arch.attrs.date_stop] =
81 instance.web.auto_date_to_str(end, self.fields[self.fields_view.arch.attrs.date_stop].type);
82 } else { // we assume date_duration is defined
83+ var duration = task_obj.getDuration();
84 data[self.fields_view.arch.attrs.date_delay] = duration;
85 }
86 this.dataset.write(itask.id, data);