From ff30928786961efef66706729286e7f48c754bbd Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Tue, 8 Aug 2017 16:08:10 +0200 Subject: [PATCH] [FIX] account_budget: clearer analytic budget report Before this commit there were two issues: - The date "from and to" set in the wizard weren't working, as in not used at all - The lines in the report did not have a date range, making the understanding of the report difficult after this commit, only the budget lines which dates overlap at least one day of the report's dates will be selected. Also, the first line of the report, containing the budget name also contains the dates on which it applies OPW 743441 Closes #18737 --- .../report/analytic_account_budget_report.py | 11 ++++++++--- addons/account_budget/report/budget_report.py | 7 +++++-- .../views/report_analyticaccountbudget.xml | 4 ++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/addons/account_budget/report/analytic_account_budget_report.py b/addons/account_budget/report/analytic_account_budget_report.py index 4e3feaf06b7..8bd15aeacba 100644 --- a/addons/account_budget/report/analytic_account_budget_report.py +++ b/addons/account_budget/report/analytic_account_budget_report.py @@ -78,11 +78,16 @@ class analytic_account_budget_report(report_sxw.rml_parse): 'theo':0.00, 'pln':0.00, 'prac':0.00, - 'perc':0.00 + 'perc':0.00, + 'date_from': budget_name[0].date_from, + 'date_to': budget_name[0].date_to, } result.append(res) - - line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', b_line_ids), ('crossovered_budget_id','=',budget_ids[i][0])]) + domain_lines = [('id', 'in', b_line_ids), + ('crossovered_budget_id', '=', budget_ids[i][0]), + ('date_from', '<=', d_to), + ('date_to', '>=', d_from)] + line_ids = c_b_lines_obj.search(self.cr, self.uid, domain_lines) line_id = c_b_lines_obj.browse(self.cr, self.uid, line_ids) tot_theo = tot_pln = tot_prac = tot_perc = 0 diff --git a/addons/account_budget/report/budget_report.py b/addons/account_budget/report/budget_report.py index f8f812639b0..ba4da51d8c7 100644 --- a/addons/account_budget/report/budget_report.py +++ b/addons/account_budget/report/budget_report.py @@ -84,8 +84,11 @@ class budget_report(report_sxw.rml_parse): 'perc': 0.00 } result.append(res) - - line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', budget_ids), ('analytic_account_id','=',an_ids[i][0])]) + domain_lines = [('id', 'in', budget_ids), + ('analytic_account_id','=',an_ids[i][0]), + ('date_from', '<=', d_to), + ('date_to', '>=', d_from)] + line_ids = c_b_lines_obj.search(self.cr, self.uid, domain_lines) line_id = c_b_lines_obj.browse(self.cr, self.uid, line_ids) tot_theo = tot_pln = tot_prac = tot_perc = 0.00 diff --git a/addons/account_budget/views/report_analyticaccountbudget.xml b/addons/account_budget/views/report_analyticaccountbudget.xml index dab987d6099..9f6e31aa258 100644 --- a/addons/account_budget/views/report_analyticaccountbudget.xml +++ b/addons/account_budget/views/report_analyticaccountbudget.xml @@ -32,6 +32,8 @@ Planned Amt Practical Amt Perc(%) + Start date + End Date @@ -42,6 +44,8 @@ % + +