Merge lp:~openerp-dev/openerp-web/7.0-gantt-percent-chm6 into lp:openerp-web/7.0

Proposed by Christophe Matthieu (OpenERP)
Status: Rejected
Rejected by: Thibault Delavallée (OpenERP)
Proposed branch: lp:~openerp-dev/openerp-web/7.0-gantt-percent-chm6
Merge into: lp:openerp-web/7.0
Diff against target: 99 lines (+15/-7)
2 files modified
addons/web_gantt/static/lib/dhtmlxGantt/sources/dhtmlxgantt.js (+2/-1)
addons/web_gantt/static/src/js/gantt.js (+13/-6)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/7.0-gantt-percent-chm6
Reviewer Review Type Date Requested Status
Thibault Delavallée (OpenERP) (community) Disapprove
Review via email: mp+141514@code.launchpad.net
To post a comment you must log in.
3670. By Christophe Matthieu (OpenERP)

[IMP] view gantt: model can use quantity_current attribute without the quantity_desired attribute

3671. By Christophe Matthieu (OpenERP)

[IMP] view gantt: change name of attribute 'quantity_current' into 'progress'

3672. By Christophe Matthieu (OpenERP)

[MERGE] from 7.0

Revision history for this message
Thibault Delavallée (OpenERP) (tde-openerp) wrote :

IMHO, the whole proposal (server/addons/web) are more related to a new feature than to bug fixing. The branches should be proposed for merging into trunk, not into 7.0.

However the IE fix should be merged into 7.0.

review: Disapprove
Revision history for this message
Christophe Matthieu (OpenERP) (chm-openerp) wrote :

OK, wait for 7.1

Unmerged revisions

3673. By Christophe Matthieu (OpenERP)

[MERGE] from 7.0

3672. By Christophe Matthieu (OpenERP)

[MERGE] from 7.0

3671. By Christophe Matthieu (OpenERP)

[IMP] view gantt: change name of attribute 'quantity_current' into 'progress'

3670. By Christophe Matthieu (OpenERP)

[IMP] view gantt: model can use quantity_current attribute without the quantity_desired attribute

3669. By Christophe Matthieu (OpenERP)

[IMP] gantt: no reset percent if there are no date_end

3668. By Christophe Matthieu (OpenERP)

[IMP] view gantt: add optional attribute in the gantt view: quantity_desired and quantity_current. when this values are set, the gantt view display the percent of completion.

3667. By Christophe Matthieu (OpenERP)

[IMP] view gant: dhtmlxgantt add a default minWidthResize param and set the value to one hour in place of one day

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-02 13:51:23 +0000
4@@ -386,6 +386,7 @@
5
6 this.hourInPixelsWork = this.dayInPixels / this.hoursInDay;
7 this.hourInPixels = this.dayInPixels / 24;
8+ this.minWidthResize = this.hourInPixels;
9 this.countDays = 0;
10 this.startDate = null;
11 this.initialPos = 0;
12@@ -4812,7 +4813,7 @@
13 childParentPosX = posChildTaskItem;
14 }
15
16- this.minWidthResize = this.Chart.dayInPixels;
17+ this.minWidthResize = this.Chart.minWidthResize;
18
19 if (this.childTask.length > 0)
20 {
21
22=== modified file 'addons/web_gantt/static/src/js/gantt.js'
23--- addons/web_gantt/static/src/js/gantt.js 2012-12-13 14:09:14 +0000
24+++ addons/web_gantt/static/src/js/gantt.js 2013-01-02 13:51:23 +0000
25@@ -44,7 +44,7 @@
26 n_group_bys = group_bys;
27 }
28 // gather the fields to get
29- var fields = _.compact(_.map(["date_start", "date_delay", "date_stop"], function(key) {
30+ var fields = _.compact(_.map(["date_start", "date_delay", "date_stop", "progress"], function(key) {
31 return self.fields_view.arch.attrs[key] || '';
32 }));
33 fields = _.uniq(fields.concat(n_group_bys));
34@@ -75,7 +75,7 @@
35 on_data_loaded_2: function(tasks, group_bys) {
36 var self = this;
37 $(".oe_gantt", this.$el).html("");
38-
39+
40 //prevent more that 1 group by
41 if (group_bys.length > 0) {
42 group_bys = [group_bys[0]];
43@@ -114,6 +114,11 @@
44 var task_ids = {};
45 // creation of the chart
46 var generate_task_info = function(task, plevel) {
47+ if (_.isNumber(task[self.fields_view.arch.attrs.progress])) {
48+ var percent = task[self.fields_view.arch.attrs.progress] || 0;
49+ } else {
50+ var percent = 100;
51+ }
52 var level = plevel || 0;
53 if (task.__is_group) {
54 var task_infos = _.compact(_.map(task.tasks, function(sub_task) {
55@@ -128,7 +133,7 @@
56 return memo === undefined || date > memo ? date : memo;
57 }, undefined);
58 var duration = (task_stop.getTime() - task_start.getTime()) / (1000 * 60 * 60);
59- var group_name = instance.web.format_value(task.name, self.fields[group_bys[level]]);
60+ var group_name = task.name ? instance.web.format_value(task.name, self.fields[group_bys[level]]) : "-";
61 if (level == 0) {
62 var group = new GanttProjectInfo(_.uniqueId("gantt_project_"), group_name, task_start);
63 _.each(task_infos, function(el) {
64@@ -136,7 +141,7 @@
65 });
66 return group;
67 } else {
68- var group = new GanttTaskInfo(_.uniqueId("gantt_project_task_"), group_name, task_start, duration, 100);
69+ var group = new GanttTaskInfo(_.uniqueId("gantt_project_task_"), group_name, task_start, duration || 1, percent);
70 _.each(task_infos, function(el) {
71 group.addChildTask(el.task_info);
72 });
73@@ -151,7 +156,7 @@
74 if (self.fields_view.arch.attrs.date_stop) {
75 task_stop = instance.web.auto_str_to_date(task[self.fields_view.arch.attrs.date_stop]);
76 if (!task_stop)
77- return;
78+ task_stop = task_start;
79 } else { // we assume date_duration is defined
80 var tmp = instance.web.format_value(task[self.fields_view.arch.attrs.date_delay],
81 self.fields[self.fields_view.arch.attrs.date_delay]);
82@@ -161,7 +166,7 @@
83 }
84 var duration = (task_stop.getTime() - task_start.getTime()) / (1000 * 60 * 60);
85 var id = _.uniqueId("gantt_task_");
86- var task_info = new GanttTaskInfo(id, task_name, task_start, ((duration / 24) * 8), 100);
87+ var task_info = new GanttTaskInfo(id, task_name, task_start, ((duration / 24) * 8) || 1, percent);
88 task_info.internal_task = task;
89 task_ids[id] = task_info;
90 return {task_info: task_info, task_start: task_start, task_stop: task_stop};
91@@ -195,6 +200,8 @@
92 $(rendered).prependTo(td);
93 $(".oe_gantt_button_create", this.$el).click(this.on_task_create);
94 }
95+ // Fix for IE to display the content of gantt view.
96+ this.$el.find(".oe_gantt td:first > div, .oe_gantt td:eq(1) > div > div").css("overflow", "");
97 },
98 on_task_changed: function(task_obj) {
99 var self = this;