From e606053a76233558417a0e2773b60c55b9c2fdbc Mon Sep 17 00:00:00 2001 From: projectsodoo Date: Wed, 27 Jan 2021 12:27:54 +0530 Subject: [PATCH 1/5] Report updated subproject --- project_report/__manifest__.py | 2 +- .../report/project_budget_amt_analysis.py | 22 ++++++++++++++++--- .../project_budget_amt_analysis_views.xml | 3 +++ .../report/project_budget_hrs_analysis.py | 12 +++++++++- .../project_budget_hrs_analysis_views.xml | 3 +++ 5 files changed, 37 insertions(+), 5 deletions(-) diff --git a/project_report/__manifest__.py b/project_report/__manifest__.py index dccee08..8d26622 100755 --- a/project_report/__manifest__.py +++ b/project_report/__manifest__.py @@ -10,7 +10,7 @@ 'author': "SunArc Technologies", 'website': "http://www.sunarctechnologies.com", 'depends': [ - 'cor_custom' + 'cor_custom','sub_project' ], 'data': [ 'security/ir.model.access.csv', diff --git a/project_report/report/project_budget_amt_analysis.py b/project_report/report/project_budget_amt_analysis.py index 03af6a0..b20a4ed 100755 --- a/project_report/report/project_budget_amt_analysis.py +++ b/project_report/report/project_budget_amt_analysis.py @@ -13,6 +13,8 @@ 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) + is_sub_project = fields.Boolean("Is Sub Project", readonly=True) + parent_project = fields.Many2one('project.project', string='Parent Project', readonly=True) partner_id = fields.Many2one('res.partner', string='Client', readonly=True) amount_type = fields.Char(string="Amount Type") revenue = fields.Float("Revenue", digits=(16, 2), readonly=True, group_operator="sum") @@ -36,9 +38,11 @@ class BudgetAmtAnalysis(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, project_id, start_date, end_date, timesheet_date, partner_id, employee_id, amount_type, pricing_type, project_type, revenue from ( + SELECT ROW_NUMBER() OVER() as id, project_id, is_sub_project, parent_project, start_date, end_date, timesheet_date, partner_id, employee_id, amount_type, pricing_type, project_type, revenue from ( SELECT pro.id AS project_id, + pro.is_sub_project as is_sub_project, + pro.parent_project as parent_project, pro.date_start AS start_date, pro.date AS end_date, pro.partner_id AS partner_id, @@ -54,6 +58,8 @@ class BudgetAmtAnalysis(models.Model): union SELECT pro.id AS project_id, + pro.is_sub_project as is_sub_project, + pro.parent_project as parent_project, pro.date_start AS start_date, pro.date AS end_date, pro.partner_id AS partner_id, @@ -71,6 +77,8 @@ class BudgetAmtAnalysis(models.Model): union SELECT pro.id AS project_id, + pro.is_sub_project as is_sub_project, + pro.parent_project as parent_project, pro.date_start AS start_date, pro.date AS end_date, pro.partner_id AS partner_id, @@ -79,13 +87,15 @@ class BudgetAmtAnalysis(models.Model): pro.pricing_type as pricing_type, pro.project_type as project_type, null::date AS timesheet_date, - pro.budgeted_hours2 AS revenue + pro.budgeted_revenue AS revenue FROM project_project pro --Left JOIN project_sale_line_employee_map pro_emp ON pro_emp.project_id = pro.id WHERE PRO.active = 't' and pro.pricing_type = 'employee_rate' and pro.project_type = 'hours_no_limit' union SELECT pro.id AS project_id, + pro.is_sub_project as is_sub_project, + pro.parent_project as parent_project, pro.date_start AS start_date, pro.date AS end_date, pro.partner_id AS partner_id, @@ -94,7 +104,8 @@ class BudgetAmtAnalysis(models.Model): pro.pricing_type as pricing_type, pro.project_type as project_type, null::date AS timesheet_date, - (AAL.unit_amount) AS revenue + (pro.hourly_rate * sum(AAL.unit_amount)) AS revenue + --(AAL.unit_amount) AS revenue --(AAL.unit_amount * pro_emp.price_unit) AS revenue FROM project_project PRO --Left JOIN project_sale_line_employee_map pro_emp ON pro_emp.project_id = pro.id @@ -102,9 +113,12 @@ class BudgetAmtAnalysis(models.Model): 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_no_limit' + group by pro.id union SELECT pro.id AS project_id, + pro.is_sub_project as is_sub_project, + pro.parent_project as parent_project, pro.date_start AS start_date, pro.date AS end_date, pro.partner_id AS partner_id, @@ -124,6 +138,8 @@ class BudgetAmtAnalysis(models.Model): union SELECT pro.id AS project_id, + pro.is_sub_project as is_sub_project, + pro.parent_project as parent_project, pro.date_start AS start_date, pro.date AS end_date, pro.partner_id AS partner_id, diff --git a/project_report/report/project_budget_amt_analysis_views.xml b/project_report/report/project_budget_amt_analysis_views.xml index e29f9f4..1ac245d 100755 --- a/project_report/report/project_budget_amt_analysis_views.xml +++ b/project_report/report/project_budget_amt_analysis_views.xml @@ -38,6 +38,8 @@ + + @@ -58,6 +60,7 @@ + diff --git a/project_report/report/project_budget_hrs_analysis.py b/project_report/report/project_budget_hrs_analysis.py index 994a394..cbdc478 100755 --- a/project_report/report/project_budget_hrs_analysis.py +++ b/project_report/report/project_budget_hrs_analysis.py @@ -13,6 +13,8 @@ class BudgetHrsAnalysis(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) + is_sub_project = fields.Boolean("Is Sub Project", readonly=True) + parent_project = fields.Many2one('project.project', string='Parent Project', readonly=True) start_date = fields.Date(string='Start Date', readonly=True) end_date = fields.Date(string='End Date', readonly=True) partner_id = fields.Many2one('res.partner', string='Client', readonly=True) @@ -43,10 +45,12 @@ 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, project_id, start_date, end_date, timesheet_date, pricing_type, project_type, partner_id, employee_id, hours_type, + SELECT ROW_NUMBER() OVER() as id, project_id, is_sub_project, parent_project, start_date, end_date, timesheet_date, pricing_type, project_type, partner_id, employee_id, hours_type, hours from ( SELECT pro.id AS project_id, + pro.is_sub_project as is_sub_project, + pro.parent_project as parent_project, pro.date_start AS start_date, pro.date AS end_date, pro.pricing_type as pricing_type, @@ -65,6 +69,8 @@ class BudgetHrsAnalysis(models.Model): Union SELECT pro.id AS project_id, + pro.is_sub_project as is_sub_project, + pro.parent_project as parent_project, pro.date_start AS start_date, pro.date AS end_date, pro.pricing_type as pricing_type, @@ -83,6 +89,8 @@ class BudgetHrsAnalysis(models.Model): Union SELECT pro.id AS project_id, + pro.is_sub_project as is_sub_project, + pro.parent_project as parent_project, pro.date_start AS start_date, pro.date AS end_date, pro.pricing_type as pricing_type, @@ -102,6 +110,8 @@ class BudgetHrsAnalysis(models.Model): Union SELECT pro.id AS project_id, + pro.is_sub_project as is_sub_project, + pro.parent_project as parent_project, pro.date_start AS start_date, pro.date AS end_date, pro.pricing_type as pricing_type, diff --git a/project_report/report/project_budget_hrs_analysis_views.xml b/project_report/report/project_budget_hrs_analysis_views.xml index e830e06..b998f6b 100755 --- a/project_report/report/project_budget_hrs_analysis_views.xml +++ b/project_report/report/project_budget_hrs_analysis_views.xml @@ -37,6 +37,8 @@ + + @@ -56,6 +58,7 @@ + From acbb48375cf370e5ab8beb52e0ad3c6f2b9c94f8 Mon Sep 17 00:00:00 2001 From: projectsodoo Date: Wed, 27 Jan 2021 12:40:19 +0530 Subject: [PATCH 2/5] Report updated --- project_report/report/project_budget_amt_analysis.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/project_report/report/project_budget_amt_analysis.py b/project_report/report/project_budget_amt_analysis.py index b20a4ed..37b64aa 100755 --- a/project_report/report/project_budget_amt_analysis.py +++ b/project_report/report/project_budget_amt_analysis.py @@ -104,16 +104,17 @@ class BudgetAmtAnalysis(models.Model): pro.pricing_type as pricing_type, pro.project_type as project_type, null::date AS timesheet_date, - (pro.hourly_rate * sum(AAL.unit_amount)) AS revenue + (pro.hourly_rate * pro.timesheet_hour) AS revenue + --(pro.hourly_rate * sum(AAL.unit_amount)) AS revenue --(AAL.unit_amount) AS revenue --(AAL.unit_amount * pro_emp.price_unit) AS revenue 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 + --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_no_limit' - group by pro.id + --group by pro.id union SELECT pro.id AS project_id, From 9795f8e56dfeac4467a9ec0232adcf78446bd7a0 Mon Sep 17 00:00:00 2001 From: projectsodoo Date: Wed, 27 Jan 2021 12:55:44 +0530 Subject: [PATCH 3/5] view allocation graph view updated --- cor_custom/__manifest__.py | 2 +- cor_custom/report/project_hours_report_view.xml | 5 +++-- cor_custom/views/project_hours_view.xml | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cor_custom/__manifest__.py b/cor_custom/__manifest__.py index 6d0d653..0ee51e1 100755 --- a/cor_custom/__manifest__.py +++ b/cor_custom/__manifest__.py @@ -29,7 +29,7 @@ 'views/crm_view.xml', 'views/sale_views.xml', 'views/project_view.xml', - 'views/project_hours_view.xml', + #'views/project_hours_view.xml', 'views/hr_employee_views.xml', 'views/hr_timesheet_templates.xml', 'views/analytic_view.xml', diff --git a/cor_custom/report/project_hours_report_view.xml b/cor_custom/report/project_hours_report_view.xml index 07026d7..1e35e2e 100755 --- a/cor_custom/report/project_hours_report_view.xml +++ b/cor_custom/report/project_hours_report_view.xml @@ -58,7 +58,7 @@ project.consultant.hrs.report.graph project.consultant.hrs.report - + @@ -74,6 +74,7 @@ { 'search_default_project': 1, 'search_default_consultant': 1, + 'search_default_group_by_hours_type': 1, } @@ -88,7 +89,7 @@ diff --git a/cor_custom/views/project_hours_view.xml b/cor_custom/views/project_hours_view.xml index b10b53a..ff44311 100755 --- a/cor_custom/views/project_hours_view.xml +++ b/cor_custom/views/project_hours_view.xml @@ -67,7 +67,7 @@ - + From 864f2d516cb5762da09dfc7323bbdc0bf8becf57 Mon Sep 17 00:00:00 2001 From: projectsodoo Date: Wed, 27 Jan 2021 13:05:37 +0530 Subject: [PATCH 4/5] Horizontal bar default updated --- cor_custom/report/project_hours_report_view.xml | 2 +- project_report/report/project_budget_amt_analysis_views.xml | 2 +- project_report/report/project_budget_hrs_analysis_views.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cor_custom/report/project_hours_report_view.xml b/cor_custom/report/project_hours_report_view.xml index 1e35e2e..dbc16a9 100755 --- a/cor_custom/report/project_hours_report_view.xml +++ b/cor_custom/report/project_hours_report_view.xml @@ -58,7 +58,7 @@ project.consultant.hrs.report.graph project.consultant.hrs.report - + diff --git a/project_report/report/project_budget_amt_analysis_views.xml b/project_report/report/project_budget_amt_analysis_views.xml index 1ac245d..77836a3 100755 --- a/project_report/report/project_budget_amt_analysis_views.xml +++ b/project_report/report/project_budget_amt_analysis_views.xml @@ -17,7 +17,7 @@ project.budget.amt.report.graph project.budget.amt.report - + diff --git a/project_report/report/project_budget_hrs_analysis_views.xml b/project_report/report/project_budget_hrs_analysis_views.xml index b998f6b..b84ab1f 100755 --- a/project_report/report/project_budget_hrs_analysis_views.xml +++ b/project_report/report/project_budget_hrs_analysis_views.xml @@ -17,7 +17,7 @@ project.budget.hrs.report.graph project.budget.hrs.report - + From 3e4c65b280f212d5402c85361435b001240cd58f Mon Sep 17 00:00:00 2001 From: projectsodoo Date: Wed, 27 Jan 2021 13:11:33 +0530 Subject: [PATCH 5/5] Horizontal bar default issue updated --- cor_custom/report/project_hours_report_view.xml | 2 +- project_report/report/project_budget_amt_analysis_views.xml | 2 +- project_report/report/project_budget_hrs_analysis_views.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cor_custom/report/project_hours_report_view.xml b/cor_custom/report/project_hours_report_view.xml index dbc16a9..1e35e2e 100755 --- a/cor_custom/report/project_hours_report_view.xml +++ b/cor_custom/report/project_hours_report_view.xml @@ -58,7 +58,7 @@ project.consultant.hrs.report.graph project.consultant.hrs.report - + diff --git a/project_report/report/project_budget_amt_analysis_views.xml b/project_report/report/project_budget_amt_analysis_views.xml index 77836a3..1ac245d 100755 --- a/project_report/report/project_budget_amt_analysis_views.xml +++ b/project_report/report/project_budget_amt_analysis_views.xml @@ -17,7 +17,7 @@ project.budget.amt.report.graph project.budget.amt.report - + diff --git a/project_report/report/project_budget_hrs_analysis_views.xml b/project_report/report/project_budget_hrs_analysis_views.xml index b84ab1f..b998f6b 100755 --- a/project_report/report/project_budget_hrs_analysis_views.xml +++ b/project_report/report/project_budget_hrs_analysis_views.xml @@ -17,7 +17,7 @@ project.budget.hrs.report.graph project.budget.hrs.report - +