From cabe54efb0915de67b124ea79eb750c076d86e8d Mon Sep 17 00:00:00 2001 From: "Adrien Peiffer (ACSONE)" Date: Thu, 22 Feb 2018 14:10:19 +0100 Subject: [PATCH] [10.0] AFR Aged partner balance : columns and datas consistency. (#383) --- account_financial_report_qweb/__manifest__.py | 2 +- .../report/aged_partner_balance.py | 54 +++++++++---------- .../report/templates/aged_partner_balance.xml | 12 ++--- 3 files changed, 33 insertions(+), 35 deletions(-) diff --git a/account_financial_report_qweb/__manifest__.py b/account_financial_report_qweb/__manifest__.py index eae96f5e..e3ae53df 100644 --- a/account_financial_report_qweb/__manifest__.py +++ b/account_financial_report_qweb/__manifest__.py @@ -5,7 +5,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'QWeb Financial Reports', - 'version': '10.0.1.2.0', + 'version': '10.0.1.3.0', 'category': 'Reporting', 'summary': 'OCA Financial Reports', 'author': 'Camptocamp SA,' diff --git a/account_financial_report_qweb/report/aged_partner_balance.py b/account_financial_report_qweb/report/aged_partner_balance.py index e174bb54..80be5b1c 100644 --- a/account_financial_report_qweb/report/aged_partner_balance.py +++ b/account_financial_report_qweb/report/aged_partner_balance.py @@ -307,12 +307,11 @@ WITH date_range AS ( SELECT - %s AS date_current, + DATE %s AS date_current, DATE %s - INTEGER '30' AS date_less_30_days, DATE %s - INTEGER '60' AS date_less_60_days, DATE %s - INTEGER '90' AS date_less_90_days, - DATE %s - INTEGER '120' AS date_less_120_days, - DATE %s - INTEGER '150' AS date_older + DATE %s - INTEGER '120' AS date_less_120_days ) INSERT INTO report_aged_partner_balance_qweb_line @@ -337,45 +336,45 @@ SELECT SUM(rlo.amount_residual) AS amount_residual, SUM( CASE - WHEN rlo.date_due > date_range.date_less_30_days + WHEN rlo.date_due >= date_range.date_current THEN rlo.amount_residual END ) AS current, SUM( CASE WHEN - rlo.date_due > date_range.date_less_60_days - AND rlo.date_due <= date_range.date_less_30_days + rlo.date_due >= date_range.date_less_30_days + AND rlo.date_due < date_range.date_current THEN rlo.amount_residual END ) AS age_30_days, SUM( CASE WHEN - rlo.date_due > date_range.date_less_90_days - AND rlo.date_due <= date_range.date_less_60_days + rlo.date_due >= date_range.date_less_60_days + AND rlo.date_due < date_range.date_less_30_days THEN rlo.amount_residual END ) AS age_60_days, SUM( CASE WHEN - rlo.date_due > date_range.date_less_120_days - AND rlo.date_due <= date_range.date_less_90_days + rlo.date_due >= date_range.date_less_90_days + AND rlo.date_due < date_range.date_less_60_days THEN rlo.amount_residual END ) AS age_90_days, SUM( CASE WHEN - rlo.date_due > date_range.date_older - AND rlo.date_due <= date_range.date_less_120_days + rlo.date_due >= date_range.date_less_120_days + AND rlo.date_due < date_range.date_less_90_days THEN rlo.amount_residual END ) AS age_120_days, SUM( CASE - WHEN rlo.date_due <= date_range.date_older + WHEN rlo.date_due < date_range.date_less_120_days THEN rlo.amount_residual END ) AS older @@ -409,7 +408,7 @@ AND ra.report_id = %s GROUP BY rp.id """ - query_inject_line_params = (self.date_at,) * 6 + query_inject_line_params = (self.date_at,) * 5 query_inject_line_params += ( self.env.uid, self.open_items_id.id, @@ -428,12 +427,11 @@ WITH date_range AS ( SELECT - %s AS date_current, + DATE %s AS date_current, DATE %s - INTEGER '30' AS date_less_30_days, DATE %s - INTEGER '60' AS date_less_60_days, DATE %s - INTEGER '90' AS date_less_90_days, - DATE %s - INTEGER '120' AS date_less_120_days, - DATE %s - INTEGER '150' AS date_older + DATE %s - INTEGER '120' AS date_less_120_days ) INSERT INTO report_aged_partner_balance_qweb_move_line @@ -469,35 +467,35 @@ SELECT rlo.label, rlo.amount_residual AS amount_residual, CASE - WHEN rlo.date_due > date_range.date_less_30_days + WHEN rlo.date_due >= date_range.date_current THEN rlo.amount_residual END AS current, CASE WHEN - rlo.date_due > date_range.date_less_60_days - AND rlo.date_due <= date_range.date_less_30_days + rlo.date_due >= date_range.date_less_30_days + AND rlo.date_due < date_range.date_current THEN rlo.amount_residual END AS age_30_days, CASE WHEN - rlo.date_due > date_range.date_less_90_days - AND rlo.date_due <= date_range.date_less_60_days + rlo.date_due >= date_range.date_less_60_days + AND rlo.date_due < date_range.date_less_30_days THEN rlo.amount_residual END AS age_60_days, CASE WHEN - rlo.date_due > date_range.date_less_120_days - AND rlo.date_due <= date_range.date_less_90_days + rlo.date_due >= date_range.date_less_90_days + AND rlo.date_due < date_range.date_less_60_days THEN rlo.amount_residual END AS age_90_days, CASE WHEN - rlo.date_due > date_range.date_older - AND rlo.date_due <= date_range.date_less_120_days + rlo.date_due >= date_range.date_less_120_days + AND rlo.date_due < date_range.date_less_90_days THEN rlo.amount_residual END AS age_120_days, CASE - WHEN rlo.date_due <= date_range.date_older + WHEN rlo.date_due < date_range.date_less_120_days THEN rlo.amount_residual END AS older FROM @@ -528,7 +526,7 @@ WHERE rao.report_id = %s AND ra.report_id = %s """ - query_inject_move_line_params = (self.date_at,) * 6 + query_inject_move_line_params = (self.date_at,) * 5 query_inject_move_line_params += ( self.env.uid, self.open_items_id.id, diff --git a/account_financial_report_qweb/report/templates/aged_partner_balance.xml b/account_financial_report_qweb/report/templates/aged_partner_balance.xml index 50edb5a6..b146731d 100644 --- a/account_financial_report_qweb/report/templates/aged_partner_balance.xml +++ b/account_financial_report_qweb/report/templates/aged_partner_balance.xml @@ -100,17 +100,17 @@
Residual
-
Current
+
Not due
-
Age ≤ 30 d.
+
1 - 30 d.
-
Age ≤ 60 d.
+
31 - 60 d.
-
Age ≤ 90 d.
+
61 - 90 d.
-
Age ≤ 120 d.
+
91 - 120 d.
-
Older
+
> 120 d.