diff --git a/project_report/report/project_budget_amt_analysis.py b/project_report/report/project_budget_amt_analysis.py index 35a5b26..7147d48 100755 --- a/project_report/report/project_budget_amt_analysis.py +++ b/project_report/report/project_budget_amt_analysis.py @@ -14,7 +14,7 @@ class BudgetAmtAnalysis(models.Model): #analytic_account_id = fields.Many2one('account.analytic.account', string='Analytic Account', readonly=True) project_id = fields.Many2one('project.project', string='Project', readonly=True) partner_id = fields.Many2one('res.partner', string='Client', readonly=True) - employee_id = fields.Many2one('hr.employee', string='Employee', readonly=True) + #employee_id = fields.Many2one('hr.employee', string='Employee', readonly=True) budgeted_revenue = fields.Float("Budgeted Revenue", digits=(16, 2), readonly=True, group_operator="sum") actual_revenue = fields.Float("Actual Revenue", digits=(16, 2), readonly=True, group_operator="sum") @@ -27,15 +27,14 @@ class BudgetAmtAnalysis(models.Model): row_number() OVER() AS id, PRO.id AS project_id, PRO.partner_id AS partner_id, - AAL.employee_id AS employee_id, PRO.budgeted_revenue AS budgeted_revenue, SO.amount_total AS actual_revenue FROM project_project PRO LEFT JOIN sale_order SO ON PRO.sale_order_id = SO.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 - WHERE PRO.active = 't' AND PRO.allow_timesheets = 't' - group by Pro.id, PRO.partner_id, AAL.employee_id, Pro.budgeted_revenue, so.amount_total + WHERE PRO.active = 't' + group by Pro.id, PRO.partner_id, Pro.budgeted_revenue, so.amount_total )""" % (self._table,)) diff --git a/project_report/report/project_budget_amt_analysis_views.xml b/project_report/report/project_budget_amt_analysis_views.xml index 44c17c0..90701ab 100755 --- a/project_report/report/project_budget_amt_analysis_views.xml +++ b/project_report/report/project_budget_amt_analysis_views.xml @@ -33,11 +33,11 @@ - + - + diff --git a/project_report/report/project_budget_hrs_analysis.py b/project_report/report/project_budget_hrs_analysis.py index d5fbdb6..ffaee73 100755 --- a/project_report/report/project_budget_hrs_analysis.py +++ b/project_report/report/project_budget_hrs_analysis.py @@ -15,7 +15,8 @@ class BudgetHrsAnalysis(models.Model): project_id = fields.Many2one('project.project', string='Project', readonly=True) partner_id = fields.Many2one('res.partner', string='Client', readonly=True) employee_id = fields.Many2one('hr.employee', string='Employee', readonly=True) - budgeted_hours = fields.Float("Budgeted Hours", digits=(16, 2), readonly=True, group_operator="sum") + project_budgeted_hours = fields.Float("Project Budgeted Hours", digits=(16, 2), readonly=True, group_operator="sum") + cons_budgeted_hours = fields.Float("Consultant Budgeted Hours", digits=(16, 2), readonly=True, group_operator="sum") actual_hours = fields.Float("Actual Hours", digits=(16, 2), readonly=True, group_operator="sum") def init(self): @@ -23,18 +24,20 @@ class BudgetHrsAnalysis(models.Model): tools.drop_view_if_exists(self._cr, self._table) self._cr.execute(""" CREATE OR REPLACE VIEW %s AS ( - SELECT row_number() OVER() AS id, - PRO.id AS project_id, - PRO.partner_id AS partner_id, - AAL.employee_id AS employee_id, - PRO.budgeted_hours AS budgeted_hours, + SELECT row_number() OVER() AS id, + Pro.id AS project_id, + Pro.partner_id AS partner_id, + Pro_emp.budgeted_qty AS cons_budgeted_hours, + Pro.budgeted_hours AS project_budgeted_hours, + AAL.employee_id as employee_id, sum(AAL.unit_amount) AS actual_hours - 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 AAL.amount < 0.0 AND AAL.project_id IS NOT NULL AND - Where PRO.active = 't' AND PRO.allow_timesheets = 't' - group by Pro.id, PRO.partner_id, AAL.employee_id, AAL.unit_amount,PRO.budgeted_hours + 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' + group by Pro.id, PRO.partner_id, AAL.employee_id, AAL.unit_amount, PRO.budgeted_hours, Pro_emp.budgeted_qty )""" % (self._table,)) diff --git a/project_report/report/project_budget_hrs_analysis_views.xml b/project_report/report/project_budget_hrs_analysis_views.xml index ae29b1e..44a0a52 100755 --- a/project_report/report/project_budget_hrs_analysis_views.xml +++ b/project_report/report/project_budget_hrs_analysis_views.xml @@ -7,7 +7,7 @@ - + @@ -18,7 +18,7 @@ project.budget.hrs.report - +