diff --git a/project_report/report/project_budget_hrs_analysis.py b/project_report/report/project_budget_hrs_analysis.py
index 90c5ef6..f3e07e2 100755
--- a/project_report/report/project_budget_hrs_analysis.py
+++ b/project_report/report/project_budget_hrs_analysis.py
@@ -22,7 +22,7 @@ class BudgetHrsAnalysis(models.Model):
employee_id = fields.Many2one('hr.employee', string='Consultant', readonly=True)
hours_type = fields.Char(string="Hours Type", readonly=True)
hours = fields.Float("Number of Hours", digits=(16, 2), readonly=True, group_operator="sum")
- timeline = fields.Float("Timeline", digits=(16, 2), readonly=True, group_operator="sum")
+ #timeline = fields.Float("Timeline", digits=(16, 2), readonly=True, group_operator="sum")
pricing_type = fields.Selection([
('fixed_rate', 'Fixed rate'),
('employee_rate', 'Consultant rate')
@@ -58,8 +58,8 @@ class BudgetHrsAnalysis(models.Model):
partner_id,
employee_id,
hours_type,
- hours,
- timeline
+ hours
+ --timeline
from (
SELECT
pro.id AS project_id,
@@ -67,9 +67,9 @@ class BudgetHrsAnalysis(models.Model):
pro_emp.employee_id AS employee_id,
date_start AS startdate,
date AS enddate,
- 'Budgeted' as hours_type,
+ 'Budgeted Hours' as hours_type,
pro_emp.budgeted_qty as hours,
- pro_emp.budgeted_qty/8 as timeline,
+ --pro_emp.budgeted_qty/8 as timeline,
--(date - date_start) as timeline,
pro.*
FROM
@@ -85,10 +85,10 @@ class BudgetHrsAnalysis(models.Model):
null::int AS employee_id,
date_start AS startdate,
date AS enddate,
- 'Budgeted' as hours_type,
+ 'Budgeted Hours' as hours_type,
pro.budgeted_hours2 as hours,
--(date - date_start) as timeline,
- pro.budgeted_hours2/8 as timeline,
+ --pro.budgeted_hours2/8 as timeline,
pro.*
FROM
project_project PRO
@@ -103,9 +103,9 @@ class BudgetHrsAnalysis(models.Model):
AAL.employee_id AS employee_id,
coalesce(pro.date_start, (select min(al.start_datetime::date) from account_analytic_line as al where pro.id=al.project_id)) AS startdate,
(select max(al.end_datetime::date) from account_analytic_line as al) as enddate,
- 'Actual' as hours_type,
+ 'Actual Hours' as hours_type,
unit_amount as hours,
- unit_amount/8 as timeline,
+ --unit_amount/8 as timeline,
--(select max(al.end_datetime::date) from account_analytic_line as al) -
--coalesce(pro.date_start, (select min(al.start_datetime::date) from account_analytic_line as al where pro.id=al.project_id)) AS timeline,
pro.*
@@ -123,9 +123,9 @@ class BudgetHrsAnalysis(models.Model):
AAL.employee_id AS employee_id,
coalesce(pro.date_start, (select min(al.start_datetime::date) from account_analytic_line as al where pro.id=al.project_id)) AS startdate,
(select max(al.end_datetime::date) from account_analytic_line as al) as enddate,
- 'Actual' as hours_type,
+ 'Actual Hours' as hours_type,
unit_amount as hours,
- unit_amount/8 as timeline,
+ --unit_amount/8 as timeline,
--(select max(al.end_datetime::date) from account_analytic_line as al) -
--(select min(al.start_datetime::date) from account_analytic_line as al where pro.id=al.project_id) AS timeline,
pro.*
@@ -142,9 +142,9 @@ class BudgetHrsAnalysis(models.Model):
AAL.employee_id AS employee_id,
pro.date_start AS startdate,
(select max(al.end_datetime::date) from account_analytic_line as al) as enddate,
- 'Actual' as hours_type,
+ 'Actual Hours' as hours_type,
unit_amount as hours,
- unit_amount/8 as timeline,
+ --unit_amount/8 as timeline,
--(select max(al.end_datetime::date) from account_analytic_line as al) - pro.date_start AS timeline,
--DATE_PART('day', AGE(select max(al.end_datetime::date) from account_analytic_line, pro.date_start)) AS timeline,
pro.*
diff --git a/project_report/report/project_budget_hrs_analysis_views.xml b/project_report/report/project_budget_hrs_analysis_views.xml
index 1ebb611..7feee4e 100755
--- a/project_report/report/project_budget_hrs_analysis_views.xml
+++ b/project_report/report/project_budget_hrs_analysis_views.xml
@@ -37,7 +37,7 @@
-
+
diff --git a/project_report/report/project_timeline_report_views.xml b/project_report/report/project_timeline_report_views.xml
index 2ad626b..a843eca 100755
--- a/project_report/report/project_timeline_report_views.xml
+++ b/project_report/report/project_timeline_report_views.xml
@@ -63,8 +63,8 @@
-
-
+
+
diff --git a/project_report/static/src/js/graph_renderer.js b/project_report/static/src/js/graph_renderer.js
index b363d65..db19740 100755
--- a/project_report/static/src/js/graph_renderer.js
+++ b/project_report/static/src/js/graph_renderer.js
@@ -221,7 +221,8 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
} */
}
var label_res = dataset.label;
- if ((self.resModel == 'project.budget.hrs.report') || (self.resModel == 'project.timeline.report')) {
+ //if ((self.resModel == 'project.budget.hrs.report') || (self.resModel == 'project.timeline.report')) {
+ if (self.resModel == 'project.timeline.report') {
var measure_value = self.fields[self.state.measure].string.split(" ").splice(-1);
label_res = label_res.replace("Actual", "Actual " + measure_value).replace("Budgeted", "Budgeted " + measure_value);
}
@@ -585,7 +586,27 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
var data = this._prepareData(dataPoints);
// this.title = 'Time Line';
- if ((self.resModel == 'project.budget.hrs.report') || (self.resModel == 'project.timeline.report')) {
+ if (self.resModel == 'project.budget.hrs.report') {
+ var groupedData = _.groupBy(data.datasets, x => x.label.replace('Actual Hours', '').replace('Budgeted Hours', ''));
+ _.map(groupedData, (y) => {
+ if (y.length > 1) {
+ var zipped_1 = _.zip.apply(null, [y[0].data, y[1].data]);
+ var maxA = zipped_1.map((a) => {
+ if ((!!a[0] && !!a[1]) && a[0] > a[1]) {
+ return 'red';
+ } else if ((!!a[0] && !!a[1]) && a[0] < a[1]) {
+ return self._getColor(0);
+ }
+ else {
+ return self._getColor(0);
+ }
+ });
+ y[0].backgroundColor = maxA;
+ y[1].backgroundColor = self._getColor(1);
+ }
+ });
+ }
+ if (self.resModel == 'project.timeline.report') {
var groupedData = _.groupBy(data.datasets, x => x.label.replace('Actual', '').replace('Budgeted', '').split("/")[0]);
//var groupedData = _.groupBy(data.datasets, x => x.label.replace('Actual Hours', '').replace('Budgeted Hours', ''));
_.map(groupedData, (y) => {
@@ -665,7 +686,14 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
/* if (self.state.stacked && dataset.label.includes("Actual")) {
dataset.stack = 1;
}*/
- if ((self.resModel == 'project.budget.hrs.report') || (self.resModel == 'project.timeline.report')) {
+ if (self.resModel == 'project.budget.hrs.report') {
+ if (dataset.label.indexOf("Actual Hours") === -1 && dataset.label.toLowerCase().indexOf("Budgeted Hours") === -1) {
+ //if (dataset.label.indexOf("Actual") === -1 && dataset.label.toLowerCase().indexOf("Budgeted") === -1) {
+ var color = self._getColor(index);
+ dataset.backgroundColor = color;
+ }
+ }
+ else if (self.resModel == 'project.timeline.report') {
//if (dataset.label.indexOf("Actual Hours") === -1 && dataset.label.toLowerCase().indexOf("Budgeted Hours") === -1) {
if (dataset.label.indexOf("Actual") === -1 && dataset.label.toLowerCase().indexOf("Budgeted") === -1) {
var color = self._getColor(index);
@@ -724,7 +752,30 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
//console.log("datappppppppppp", dataPoints);
- if ((self.resModel == 'project.budget.hrs.report') || (self.resModel == 'project.timeline.report')) {
+ if (self.resModel == 'project.budget.hrs.report') {
+ var groupedData = _.groupBy(data.datasets, x => x.label.replace('Actual Hours', '').replace('Budgeted Hours', ''));
+ //var groupedData = _.groupBy(data.datasets, x => x.label.replace('Actual', '').replace('Budgeted', '').split("/")[0]);
+ _.map(groupedData, (y) => {
+ if (y.length > 1) {
+ var zipped_1 = _.zip.apply(null, [y[0].data, y[1].data]);
+ var maxA = zipped_1.map((a) => {
+ if ((!!a[0] && !!a[1]) && a[0] > a[1]) {
+ return 'red';
+ } else if ((!!a[0] && !!a[1]) && a[0] < a[1]) {
+ return self._getColor(0);
+ }
+ else {
+ return self._getColor(0);
+ }
+ });
+ y[0].backgroundColor = maxA;
+ y[1].backgroundColor = self._getColor(1);
+ var zipped_2 = _.zip.apply(null, [y[1].data, y[0].data]);
+ }
+ });
+ }
+
+ if (self.resModel == 'project.timeline.report') {
//var groupedData = _.groupBy(data.datasets, x => x.label.replace('Actual Hours', '').replace('Budgeted Hours', '').split("/")[0]);
var groupedData = _.groupBy(data.datasets, x => x.label.replace('Actual', '').replace('Budgeted', '').split("/")[0]);
_.map(groupedData, (y) => {
@@ -797,7 +848,13 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
/*if (self.state.stacked && dataset.label.includes("Actual")) {
dataset.stack = 1;
}*/
- if ((self.resModel == 'project.budget.hrs.report') || (self.resModel == 'project.timeline.report')) {
+ if (self.resModel == 'project.budget.hrs.report') {
+ if (dataset.label.indexOf("Actual Hours") === -1 && dataset.label.toLowerCase().indexOf("Budgeted Hours") === -1) {
+ var color = self._getColor(index);
+ dataset.backgroundColor = color;
+ }
+ }
+ else if (self.resModel == 'project.timeline.report') {
if (dataset.label.indexOf("Actual") === -1 && dataset.label.toLowerCase().indexOf("Budgeted") === -1) {
var color = self._getColor(index);
dataset.backgroundColor = color;