diff --git a/project_report/report/project_budget_hrs_analysis.py b/project_report/report/project_budget_hrs_analysis.py
index b415a04..f71a2f6 100755
--- a/project_report/report/project_budget_hrs_analysis.py
+++ b/project_report/report/project_budget_hrs_analysis.py
@@ -30,7 +30,7 @@ class BudgetHrsAnalysis(models.Model):
('hours_in_consultant', 'Hours are budgeted according to a consultant'),
('hours_no_limit', 'Total hours are budgeted without division to consultant'),
], string="Project Type", readonly=True)
- timesheet_date = fields.Date(string='Timesheet Date', readonly=True)
+ #timesheet_date = fields.Date(string='Timesheet Date', readonly=True)
#budgeted_hours = fields.Float("Budgeted Hours", digits=(16, 2), readonly=True, group_operator="sum")
#actual_hours = fields.Float("Actual Hours", digits=(16, 2), readonly=True, group_operator="sum")
@@ -52,11 +52,6 @@ class BudgetHrsAnalysis(models.Model):
parent_project,
startdate as start_date,
enddate as end_date,
- --is_sub_project,
- --sub_project,
- --date_start AS start_date,
- --date AS end_date,
- timesheet_date,
pricing_type as pricing_type,
project_type as project_type,
partner_id,
@@ -70,7 +65,6 @@ class BudgetHrsAnalysis(models.Model):
date_start AS startdate,
date AS enddate,
'Budgeted Hours' as hours_type,
- null::date AS timesheet_date,
pro_emp.budgeted_qty as hours,
pro.*
FROM
@@ -87,7 +81,6 @@ class BudgetHrsAnalysis(models.Model):
date_start AS startdate,
date AS enddate,
'Budgeted Hours' as hours_type,
- null::date AS timesheet_date,
pro.budgeted_hours2 as hours,
pro.*
FROM
@@ -101,10 +94,9 @@ class BudgetHrsAnalysis(models.Model):
pro.id AS project_id,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parent_project,
AAL.employee_id AS employee_id,
- start_datetime AS startdate,
- end_datetime AS enddate,
+ 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 Hours' as hours_type,
- AAL.date AS timesheet_date,
unit_amount as hours,
pro.*
FROM project_project PRO
@@ -112,28 +104,40 @@ class BudgetHrsAnalysis(models.Model):
LEFT JOIN account_analytic_account AA ON PRO.analytic_account_id = AA.id
LEFT JOIN account_analytic_line AAL ON AAL.account_id = AA.id and AAL.project_id = PRO.id and AAL.employee_id = pro_emp.employee_id
Where
- PRO.active = 't' and PRO.pricing_type = 'employee_rate'
- --and PRO.project_type = 'hours_in_consultant'
+ PRO.active = 't'
+ and PRO.pricing_type = 'employee_rate' and PRO.project_type = 'hours_in_consultant' and AAL.employee_id is not null
Union all
SELECT
pro.id AS project_id,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parent_project,
AAL.employee_id AS employee_id,
- start_datetime::DATE AS startdate,
- end_datetime::DATE AS enddate,
+ 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 Hours' as hours_type,
+ unit_amount as hours,
+ pro.*
+ FROM project_project PRO
+ LEFT JOIN account_analytic_account AA ON PRO.analytic_account_id = AA.id
+ LEFT JOIN account_analytic_line AAL ON AAL.account_id = AA.id and AAL.project_id = PRO.id
+ Where
+ PRO.active = 't'
+ and PRO.pricing_type = 'employee_rate' and PRO.project_type = 'hours_no_limit' and AAL.employee_id is not null
+ Union all
+ SELECT
+ pro.id AS project_id,
+ (select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parent_project,
+ 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 Hours' as hours_type,
- AAL.date AS timesheet_date,
unit_amount as hours,
pro.*
FROM project_project PRO
- --Left JOIN project_sale_line_employee_map pro_emp ON pro_emp.project_id = pro.id
LEFT JOIN account_analytic_account AA ON PRO.analytic_account_id = AA.id
LEFT JOIN account_analytic_line AAL ON AAL.account_id = AA.id and AAL.project_id = PRO.id
- --and AAL.employee_id = pro_emp.employee_id
Where
PRO.active = 't'
and PRO.pricing_type = 'fixed_rate'
- --and PRO.project_type = 'hours_in_consultant'
) as res
order by
project_id desc,
diff --git a/project_report/report/project_budget_hrs_analysis_views.xml b/project_report/report/project_budget_hrs_analysis_views.xml
index 2928930..9f9ddf3 100755
--- a/project_report/report/project_budget_hrs_analysis_views.xml
+++ b/project_report/report/project_budget_hrs_analysis_views.xml
@@ -34,7 +34,7 @@
-
+
@@ -53,7 +53,7 @@
-
+
@@ -64,7 +64,7 @@
-
+