Browse Source

[10.0] AFR Aged partner balance : columns and datas consistency. (#383)

pull/439/head
Adrien Peiffer (ACSONE) 7 years ago
committed by Florian da Costa
parent
commit
1a4180cd56
  1. 2
      account_financial_report_qweb/__openerp__.py
  2. 54
      account_financial_report_qweb/report/aged_partner_balance.py
  3. 12
      account_financial_report_qweb/report/templates/aged_partner_balance.xml

2
account_financial_report_qweb/__openerp__.py

@ -5,7 +5,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{ {
'name': 'QWeb Financial Reports', 'name': 'QWeb Financial Reports',
'version': '9.0.1.0.2',
'version': '9.0.1.0.3',
'category': 'Reporting', 'category': 'Reporting',
'summary': 'OCA Financial Reports', 'summary': 'OCA Financial Reports',
'author': 'Camptocamp SA,' 'author': 'Camptocamp SA,'

54
account_financial_report_qweb/report/aged_partner_balance.py

@ -307,12 +307,11 @@ WITH
date_range AS date_range AS
( (
SELECT SELECT
%s AS date_current,
DATE %s AS date_current,
DATE %s - INTEGER '30' AS date_less_30_days, DATE %s - INTEGER '30' AS date_less_30_days,
DATE %s - INTEGER '60' AS date_less_60_days, DATE %s - INTEGER '60' AS date_less_60_days,
DATE %s - INTEGER '90' AS date_less_90_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 INSERT INTO
report_aged_partner_balance_qweb_line report_aged_partner_balance_qweb_line
@ -337,45 +336,45 @@ SELECT
SUM(rlo.amount_residual) AS amount_residual, SUM(rlo.amount_residual) AS amount_residual,
SUM( SUM(
CASE CASE
WHEN rlo.date_due > date_range.date_less_30_days
WHEN rlo.date_due >= date_range.date_current
THEN rlo.amount_residual THEN rlo.amount_residual
END END
) AS current, ) AS current,
SUM( SUM(
CASE CASE
WHEN 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 THEN rlo.amount_residual
END END
) AS age_30_days, ) AS age_30_days,
SUM( SUM(
CASE CASE
WHEN 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 THEN rlo.amount_residual
END END
) AS age_60_days, ) AS age_60_days,
SUM( SUM(
CASE CASE
WHEN 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 THEN rlo.amount_residual
END END
) AS age_90_days, ) AS age_90_days,
SUM( SUM(
CASE CASE
WHEN 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 THEN rlo.amount_residual
END END
) AS age_120_days, ) AS age_120_days,
SUM( SUM(
CASE CASE
WHEN rlo.date_due <= date_range.date_older
WHEN rlo.date_due < date_range.date_less_120_days
THEN rlo.amount_residual THEN rlo.amount_residual
END END
) AS older ) AS older
@ -409,7 +408,7 @@ AND ra.report_id = %s
GROUP BY GROUP BY
rp.id rp.id
""" """
query_inject_line_params = (self.date_at,) * 6
query_inject_line_params = (self.date_at,) * 5
query_inject_line_params += ( query_inject_line_params += (
self.env.uid, self.env.uid,
self.open_items_id.id, self.open_items_id.id,
@ -428,12 +427,11 @@ WITH
date_range AS date_range AS
( (
SELECT SELECT
%s AS date_current,
DATE %s AS date_current,
DATE %s - INTEGER '30' AS date_less_30_days, DATE %s - INTEGER '30' AS date_less_30_days,
DATE %s - INTEGER '60' AS date_less_60_days, DATE %s - INTEGER '60' AS date_less_60_days,
DATE %s - INTEGER '90' AS date_less_90_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 INSERT INTO
report_aged_partner_balance_qweb_move_line report_aged_partner_balance_qweb_move_line
@ -469,35 +467,35 @@ SELECT
rlo.label, rlo.label,
rlo.amount_residual AS amount_residual, rlo.amount_residual AS amount_residual,
CASE CASE
WHEN rlo.date_due > date_range.date_less_30_days
WHEN rlo.date_due >= date_range.date_current
THEN rlo.amount_residual THEN rlo.amount_residual
END AS current, END AS current,
CASE CASE
WHEN 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 THEN rlo.amount_residual
END AS age_30_days, END AS age_30_days,
CASE CASE
WHEN 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 THEN rlo.amount_residual
END AS age_60_days, END AS age_60_days,
CASE CASE
WHEN 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 THEN rlo.amount_residual
END AS age_90_days, END AS age_90_days,
CASE CASE
WHEN 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 THEN rlo.amount_residual
END AS age_120_days, END AS age_120_days,
CASE CASE
WHEN rlo.date_due <= date_range.date_older
WHEN rlo.date_due < date_range.date_less_120_days
THEN rlo.amount_residual THEN rlo.amount_residual
END AS older END AS older
FROM FROM
@ -528,7 +526,7 @@ WHERE
rao.report_id = %s rao.report_id = %s
AND ra.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 += ( query_inject_move_line_params += (
self.env.uid, self.env.uid,
self.open_items_id.id, self.open_items_id.id,

12
account_financial_report_qweb/report/templates/aged_partner_balance.xml

@ -100,17 +100,17 @@
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell" style="width: 110px;">Residual</div> <div class="act_as_cell" style="width: 110px;">Residual</div>
<!--## current--> <!--## current-->
<div class="act_as_cell" style="width: 110px;">Current</div>
<div class="act_as_cell" style="width: 110px;">Not due</div>
<!--## age_30_days--> <!--## age_30_days-->
<div class="act_as_cell" style="width: 110px;">Age ≤ 30 d.</div>
<div class="act_as_cell" style="width: 110px;">1 - 30 d.</div>
<!--## age_60_days--> <!--## age_60_days-->
<div class="act_as_cell" style="width: 110px;">Age ≤ 60 d.</div>
<div class="act_as_cell" style="width: 110px;">31 - 60 d.</div>
<!--## age_90_days--> <!--## age_90_days-->
<div class="act_as_cell" style="width: 110px;">Age ≤ 90 d.</div>
<div class="act_as_cell" style="width: 110px;">61 - 90 d.</div>
<!--## age_120_days--> <!--## age_120_days-->
<div class="act_as_cell" style="width: 110px;">Age ≤ 120 d.</div>
<div class="act_as_cell" style="width: 110px;">91 - 120 d.</div>
<!--## older--> <!--## older-->
<div class="act_as_cell" style="width: 110px;">Older</div>
<div class="act_as_cell" style="width: 110px;"> > 120 d.</div>
</div> </div>
</div> </div>
</template> </template>

Loading…
Cancel
Save