Merge lp:~openerp-dev/openerp-web/6.1-opw-576040-cpa into lp:openerp-web/6.1

Proposed by Chirag Patel (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openerp-web/6.1-opw-576040-cpa
Merge into: lp:openerp-web/6.1
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/6.1-opw-576040-cpa
Reviewer Review Type Date Requested Status
Jiten (OpenERP) (community) Approve
OpenERP Core Team Pending
Review via email: mp+112550@code.launchpad.net

Description of the change

Hello,

Gantt chart not show right duration when date_delay provide.

Demo: Sales > Meetings > Meetings
1) Switch to Gantt view.

Observed: Event bar show wrong duration.
Observed: Tooltip not show when mouse hover on event bar and event duration < 4 hours

For tooltip

Add event description (displayed right after the event bar).
Tooltip show when mouse hover on event description.

Thanks

To post a comment you must log in.
2379. By Chirag Patel (OpenERP)

[FIX] Fixed format_value change the duration decimal separator.

Revision history for this message
Chirag Patel (OpenERP) (cpa-openerp) wrote :

In revision : 2379

format_value change the value from "." to "," when decimal separator "," and duration not set for any event.
Here no need to change format of duration.

2380. By Chirag Patel (OpenERP)

[FIX] Fixed Gantt chart support day_length attr.

Revision history for this message
Chirag Patel (OpenERP) (cpa-openerp) wrote :

In revision : 2380

Gantt chart default set "8" as working hours(day_length)
and not support day_length, set by the user in xml.

Revision history for this message
Jiten (OpenERP) (jiten-openerp) :
review: Approve

Unmerged revisions

2380. By Chirag Patel (OpenERP)

[FIX] Fixed Gantt chart support day_length attr.

2379. By Chirag Patel (OpenERP)

[FIX] Fixed format_value change the duration decimal separator.

2378. By Chirag Patel (OpenERP)

[FIX] Fixed 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-07-02 13:30:16 +0000
3+++ addons/web_gantt/static/lib/dhtmlxGantt/sources/dhtmlxgantt.js 2012-07-16 09:04:21 +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-01-27 16:06:45 +0000
25+++ addons/web_gantt/static/src/js/gantt.js 2012-07-16 09:04:21 +0000
26@@ -60,6 +60,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).pipe(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@@ -147,26 +148,28 @@
35 task_stop = openerp.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 = openerp.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), 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@@ -194,15 +197,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 openerp.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 openerp.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).then(function() {