From 77b49e1e3a514fbc423d59d79aa18ebb79f87b85 Mon Sep 17 00:00:00 2001 From: projectsodoo Date: Thu, 31 Dec 2020 11:54:34 +0530 Subject: [PATCH] Two bar chart report updated --- .../report/project_budget_amt_analysis.py | 29 ++++++++++++++--- .../project_budget_amt_analysis_views.xml | 19 ++++++------ .../report/project_budget_hrs_analysis.py | 31 +++++++++++++++---- .../project_budget_hrs_analysis_views.xml | 20 ++++++------ 4 files changed, 67 insertions(+), 32 deletions(-) diff --git a/project_report/report/project_budget_amt_analysis.py b/project_report/report/project_budget_amt_analysis.py index 48f6ed8..078e7f1 100755 --- a/project_report/report/project_budget_amt_analysis.py +++ b/project_report/report/project_budget_amt_analysis.py @@ -8,15 +8,17 @@ class BudgetAmtAnalysis(models.Model): _name = "project.budget.amt.report" _description = "Project budget amount analysis report" - _order = 'project_id' + #_order = 'project_id' _auto = False #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) + amount_type = fields.Char(string="Amount Type") + revenue = fields.Float("Revenue", digits=(16, 2), readonly=True, group_operator="sum") #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") + #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") def init(self): '''Create the view''' @@ -26,15 +28,32 @@ class BudgetAmtAnalysis(models.Model): SELECT row_number() OVER() AS id, PRO.id AS project_id, + PRO.create_date AS create_date, PRO.partner_id AS partner_id, - PRO.budgeted_revenue AS budgeted_revenue, - SO.amount_total AS actual_revenue + 'Budgeted Revenue' as amount_type, + PRO.budgeted_revenue AS 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.pricing_type!='fixed_rate' group by Pro.id, PRO.partner_id, Pro.budgeted_revenue, so.amount_total + union + SELECT + row_number() OVER() AS id, + PRO.id AS project_id, + PRO.create_date AS create_date, + PRO.partner_id AS partner_id, + 'Actual Revenue' as amount_type, + SO.amount_total AS 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.pricing_type!='fixed_rate' + group by Pro.id, PRO.partner_id, Pro.budgeted_revenue, so.amount_total + order by create_date desc, project_id, amount_type desc )""" % (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 90701ab..c5bde16 100755 --- a/project_report/report/project_budget_amt_analysis_views.xml +++ b/project_report/report/project_budget_amt_analysis_views.xml @@ -6,9 +6,9 @@ project.budget.amt.report - - - + + + @@ -17,10 +17,11 @@ project.budget.amt.report.graph project.budget.amt.report - - + + - + + @@ -37,6 +38,7 @@ + @@ -48,10 +50,7 @@ project.budget.amt.report pivot,graph - { - 'group_by_no_leaf':1, - 'group_by':[], - } + {'search_default_group_by_project': 1,'search_default_group_by_amount_type': 1} project.budget.hrs.report.pivot project.budget.hrs.report - - - - + + + + @@ -17,10 +17,10 @@ project.budget.hrs.report.graph project.budget.hrs.report - - + - + + @@ -38,6 +38,7 @@ + @@ -49,10 +50,7 @@ project.budget.hrs.report pivot,graph - { - 'group_by_no_leaf':1, - 'group_by':[], - } + {'search_default_group_by_project': 1,'search_default_group_by_hours_type': 1}