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}