From 72db79a0e1c7f0cc196ff2730fa5b6fe4e3c1443 Mon Sep 17 00:00:00 2001 From: Jordi Ballester Date: Wed, 29 Nov 2017 18:55:59 +0100 Subject: [PATCH] fix multicurrency support --- .../report/general_ledger.py | 9 ++-- .../report/open_items.py | 11 +++-- .../report/templates/general_ledger.xml | 46 ++++++++---------- .../report/templates/open_items.xml | 48 ++++++++----------- 4 files changed, 52 insertions(+), 62 deletions(-) diff --git a/account_financial_report_qweb/report/general_ledger.py b/account_financial_report_qweb/report/general_ledger.py index 8bd8fc25..78023c63 100644 --- a/account_financial_report_qweb/report/general_ledger.py +++ b/account_financial_report_qweb/report/general_ledger.py @@ -976,7 +976,7 @@ INNER JOIN LEFT JOIN account_full_reconcile fr ON ml.full_reconcile_id = fr.id LEFT JOIN - res_currency c ON a.currency_id = c.id + res_currency c ON ml.currency_id = c.id """ if self.filter_cost_center_ids: query_inject_move_line += """ @@ -1086,7 +1086,8 @@ WITH )::date AS date, SUM(ml.debit) AS debit, SUM(ml.credit) AS credit, - SUM(ml.balance) AS balance + SUM(ml.balance) AS balance, + ml.currency_id AS currency_id FROM report_general_ledger_qweb_account ra INNER JOIN @@ -1119,7 +1120,7 @@ WITH """ query_inject_move_line_centralized += """ GROUP BY - ra.id, ml.account_id, a.code, 2 + ra.id, ml.account_id, a.code, 2, ml.currency_id ) INSERT INTO report_general_ledger_qweb_move_line @@ -1154,7 +1155,7 @@ INNER JOIN INNER JOIN account_account a ON ml.account_id = a.id LEFT JOIN - res_currency c ON a.currency_id = c.id + res_currency c ON ml.currency_id = c.id WHERE ra.report_id = %s AND diff --git a/account_financial_report_qweb/report/open_items.py b/account_financial_report_qweb/report/open_items.py index 5265fd00..f787c222 100644 --- a/account_financial_report_qweb/report/open_items.py +++ b/account_financial_report_qweb/report/open_items.py @@ -361,7 +361,8 @@ FROM THEN pr.amount_currency ELSE NULL END - ) AS partial_amount_currency + ) AS partial_amount_currency, + ml.currency_id FROM report_open_items_qweb_partner rp INNER JOIN @@ -469,13 +470,15 @@ WITH ELSE amount_currency + SUM(partial_amount_currency) END ELSE amount_currency - END AS amount_residual_currency + END AS amount_residual_currency, + currency_id FROM move_lines_amount GROUP BY id, balance, - amount_currency + amount_currency, + currency_id ) INSERT INTO report_open_items_qweb_move_line @@ -557,7 +560,7 @@ INNER JOIN LEFT JOIN account_full_reconcile fr ON ml.full_reconcile_id = fr.id LEFT JOIN - res_currency c ON a.currency_id = c.id + res_currency c ON ml2.currency_id = c.id WHERE ra.report_id = %s AND diff --git a/account_financial_report_qweb/report/templates/general_ledger.xml b/account_financial_report_qweb/report/templates/general_ledger.xml index 0cb91502..9d7fa76b 100644 --- a/account_financial_report_qweb/report/templates/general_ledger.xml +++ b/account_financial_report_qweb/report/templates/general_ledger.xml @@ -126,12 +126,10 @@
Credit
Cumul. Bal.
- - -
Cur.
- -
Amount cur.
-
+ +
Cur.
+ +
Amount cur.
@@ -161,12 +159,10 @@
- - -
- -
-
+ +
+ +
@@ -197,17 +193,15 @@
- - -
- - -
-
- - -
-
+ +
+ + +
+
+ + +
@@ -239,10 +233,8 @@
- - -
-
+ +
diff --git a/account_financial_report_qweb/report/templates/open_items.xml b/account_financial_report_qweb/report/templates/open_items.xml index ccdf2e42..69a9a4c6 100644 --- a/account_financial_report_qweb/report/templates/open_items.xml +++ b/account_financial_report_qweb/report/templates/open_items.xml @@ -103,14 +103,12 @@
Original
Residual
- - -
Cur.
- -
Cur. Original
- -
Cur. Residual
-
+ +
Cur.
+ +
Cur. Original
+ +
Cur. Residual
@@ -136,21 +134,19 @@
- - -
- - -
- -
-
- - -
- -
-
+ +
+ + +
+ +
+
+ + +
+ +
@@ -176,10 +172,8 @@
- - -
-
+ +