Browse Source

fix multicurrency support

pull/368/head
Jordi Ballester 7 years ago
parent
commit
72db79a0e1
  1. 9
      account_financial_report_qweb/report/general_ledger.py
  2. 11
      account_financial_report_qweb/report/open_items.py
  3. 8
      account_financial_report_qweb/report/templates/general_ledger.xml
  4. 6
      account_financial_report_qweb/report/templates/open_items.xml

9
account_financial_report_qweb/report/general_ledger.py

@ -976,7 +976,7 @@ INNER JOIN
LEFT JOIN LEFT JOIN
account_full_reconcile fr ON ml.full_reconcile_id = fr.id account_full_reconcile fr ON ml.full_reconcile_id = fr.id
LEFT JOIN 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: if self.filter_cost_center_ids:
query_inject_move_line += """ query_inject_move_line += """
@ -1086,7 +1086,8 @@ WITH
)::date AS date, )::date AS date,
SUM(ml.debit) AS debit, SUM(ml.debit) AS debit,
SUM(ml.credit) AS credit, SUM(ml.credit) AS credit,
SUM(ml.balance) AS balance
SUM(ml.balance) AS balance,
ml.currency_id AS currency_id
FROM FROM
report_general_ledger_qweb_account ra report_general_ledger_qweb_account ra
INNER JOIN INNER JOIN
@ -1119,7 +1120,7 @@ WITH
""" """
query_inject_move_line_centralized += """ query_inject_move_line_centralized += """
GROUP BY GROUP BY
ra.id, ml.account_id, a.code, 2
ra.id, ml.account_id, a.code, 2, ml.currency_id
) )
INSERT INTO INSERT INTO
report_general_ledger_qweb_move_line report_general_ledger_qweb_move_line
@ -1154,7 +1155,7 @@ INNER JOIN
INNER JOIN INNER JOIN
account_account a ON ml.account_id = a.id account_account a ON ml.account_id = a.id
LEFT JOIN LEFT JOIN
res_currency c ON a.currency_id = c.id
res_currency c ON ml.currency_id = c.id
WHERE WHERE
ra.report_id = %s ra.report_id = %s
AND AND

11
account_financial_report_qweb/report/open_items.py

@ -361,7 +361,8 @@ FROM
THEN pr.amount_currency THEN pr.amount_currency
ELSE NULL ELSE NULL
END END
) AS partial_amount_currency
) AS partial_amount_currency,
ml.currency_id
FROM FROM
report_open_items_qweb_partner rp report_open_items_qweb_partner rp
INNER JOIN INNER JOIN
@ -469,13 +470,15 @@ WITH
ELSE amount_currency + SUM(partial_amount_currency) ELSE amount_currency + SUM(partial_amount_currency)
END END
ELSE amount_currency ELSE amount_currency
END AS amount_residual_currency
END AS amount_residual_currency,
currency_id
FROM FROM
move_lines_amount move_lines_amount
GROUP BY GROUP BY
id, id,
balance, balance,
amount_currency
amount_currency,
currency_id
) )
INSERT INTO INSERT INTO
report_open_items_qweb_move_line report_open_items_qweb_move_line
@ -557,7 +560,7 @@ INNER JOIN
LEFT JOIN LEFT JOIN
account_full_reconcile fr ON ml.full_reconcile_id = fr.id account_full_reconcile fr ON ml.full_reconcile_id = fr.id
LEFT JOIN LEFT JOIN
res_currency c ON a.currency_id = c.id
res_currency c ON ml2.currency_id = c.id
WHERE WHERE
ra.report_id = %s ra.report_id = %s
AND AND

8
account_financial_report_qweb/report/templates/general_ledger.xml

@ -126,12 +126,10 @@
<div class="act_as_cell amount" style="width: 75px;">Credit</div> <div class="act_as_cell amount" style="width: 75px;">Credit</div>
<!--## balance cumulated--> <!--## balance cumulated-->
<div class="act_as_cell amount" style="width: 75px;">Cumul. Bal.</div> <div class="act_as_cell amount" style="width: 75px;">Cumul. Bal.</div>
<t t-if="has_second_currency">
<!--## currency_name--> <!--## currency_name-->
<div class="act_as_cell" style="width: 35px;">Cur.</div> <div class="act_as_cell" style="width: 35px;">Cur.</div>
<!--## amount_currency--> <!--## amount_currency-->
<div class="act_as_cell amount" style="width: 75px;">Amount cur.</div> <div class="act_as_cell amount" style="width: 75px;">Amount cur.</div>
</t>
</div> </div>
</div> </div>
@ -161,12 +159,10 @@
<div class="act_as_cell amount"><span t-field="account_or_partner_object.initial_credit"/></div> <div class="act_as_cell amount"><span t-field="account_or_partner_object.initial_credit"/></div>
<!--## balance cumulated--> <!--## balance cumulated-->
<div class="act_as_cell amount"><span t-field="account_or_partner_object.initial_balance"/></div> <div class="act_as_cell amount"><span t-field="account_or_partner_object.initial_balance"/></div>
<t t-if="has_second_currency">
<!--## currency_name--> <!--## currency_name-->
<div class="act_as_cell"></div> <div class="act_as_cell"></div>
<!--## amount_currency--> <!--## amount_currency-->
<div class="act_as_cell"></div> <div class="act_as_cell"></div>
</t>
</div> </div>
<!-- Display each lines --> <!-- Display each lines -->
@ -197,7 +193,6 @@
<div class="act_as_cell amount"><span t-field="line.credit"/></div> <div class="act_as_cell amount"><span t-field="line.credit"/></div>
<!--## balance cumulated--> <!--## balance cumulated-->
<div class="act_as_cell amount"><span t-field="line.cumul_balance"/></div> <div class="act_as_cell amount"><span t-field="line.cumul_balance"/></div>
<t t-if="has_second_currency">
<!--## currency_name--> <!--## currency_name-->
<div class="act_as_cell"><span t-field="line.currency_name"/></div> <div class="act_as_cell"><span t-field="line.currency_name"/></div>
<t t-if="line.currency_name"> <t t-if="line.currency_name">
@ -208,7 +203,6 @@
<!--## amount_currency--> <!--## amount_currency-->
<div class="act_as_cell"></div> <div class="act_as_cell"></div>
</t> </t>
</t>
</div> </div>
</t> </t>
</div> </div>
@ -239,10 +233,8 @@
<div class="act_as_cell amount" style="width: 75px;"><span t-field="account_or_partner_object.final_credit"/></div> <div class="act_as_cell amount" style="width: 75px;"><span t-field="account_or_partner_object.final_credit"/></div>
<!--## balance cumulated--> <!--## balance cumulated-->
<div class="act_as_cell amount" style="width: 75px; padding-right: 1px;"><span t-field="account_or_partner_object.final_balance"/></div> <div class="act_as_cell amount" style="width: 75px; padding-right: 1px;"><span t-field="account_or_partner_object.final_balance"/></div>
<t t-if="has_second_currency">
<!--## currency_name + amount_currency--> <!--## currency_name + amount_currency-->
<div class="act_as_cell" style="width: 110px;"></div> <div class="act_as_cell" style="width: 110px;"></div>
</t>
</div> </div>
</div> </div>
</template> </template>

6
account_financial_report_qweb/report/templates/open_items.xml

@ -103,14 +103,12 @@
<div class="act_as_cell" style="width: 75px;">Original</div> <div class="act_as_cell" style="width: 75px;">Original</div>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell" style="width: 75px;">Residual</div> <div class="act_as_cell" style="width: 75px;">Residual</div>
<t t-if="has_second_currency">
<!--## currency_name--> <!--## currency_name-->
<div class="act_as_cell" style="width: 35px;">Cur.</div> <div class="act_as_cell" style="width: 35px;">Cur.</div>
<!--## amount_total_due_currency--> <!--## amount_total_due_currency-->
<div class="act_as_cell amount" style="width: 75px;">Cur. Original</div> <div class="act_as_cell amount" style="width: 75px;">Cur. Original</div>
<!--## amount_residual_currency--> <!--## amount_residual_currency-->
<div class="act_as_cell amount" style="width: 75px;">Cur. Residual</div> <div class="act_as_cell amount" style="width: 75px;">Cur. Residual</div>
</t>
</div> </div>
</div> </div>
@ -136,7 +134,6 @@
<div class="act_as_cell amount"><span t-field="line.amount_total_due"/></div> <div class="act_as_cell amount"><span t-field="line.amount_total_due"/></div>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell amount"><span t-field="line.amount_residual"/></div> <div class="act_as_cell amount"><span t-field="line.amount_residual"/></div>
<t t-if="has_second_currency">
<!--## currency_name--> <!--## currency_name-->
<div class="act_as_cell"><span t-field="line.currency_name"/></div> <div class="act_as_cell"><span t-field="line.currency_name"/></div>
<t t-if="line.currency_name"> <t t-if="line.currency_name">
@ -151,7 +148,6 @@
<!--## amount_residual_currency--> <!--## amount_residual_currency-->
<div class="act_as_cell"></div> <div class="act_as_cell"></div>
</t> </t>
</t>
</div> </div>
</t> </t>
</div> </div>
@ -176,10 +172,8 @@
<div class="act_as_cell amount" style="width: 75px;"></div> <div class="act_as_cell amount" style="width: 75px;"></div>
<!--## amount_currency--> <!--## amount_currency-->
<div class="act_as_cell amount" style="width: 75px;"><span t-field="account_or_partner_object.final_amount_residual"/></div> <div class="act_as_cell amount" style="width: 75px;"><span t-field="account_or_partner_object.final_amount_residual"/></div>
<t t-if="has_second_currency">
<!--## currency_name + amount_total_due_currency + amount_residual_currency --> <!--## currency_name + amount_total_due_currency + amount_residual_currency -->
<div class="act_as_cell" style="width: 185px;"></div> <div class="act_as_cell" style="width: 185px;"></div>
</t>
</div> </div>
</div> </div>
</template> </template>

Loading…
Cancel
Save