Browse Source

fix issue with currency in general ledger

pull/367/head
Jordi Ballester 7 years ago
committed by hveficent
parent
commit
8dd2f770d7
  1. 9
      account_financial_report/report/general_ledger.py
  2. 11
      account_financial_report/report/open_items.py
  3. 4
      account_financial_report/report/templates/aged_partner_balance.xml
  4. 67
      account_financial_report/report/templates/general_ledger.xml
  5. 54
      account_financial_report/report/templates/open_items.xml

9
account_financial_report/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_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_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

11
account_financial_report/report/open_items.py

@ -362,7 +362,8 @@ FROM
THEN pr.amount_currency
ELSE NULL
END
) AS partial_amount_currency
) AS partial_amount_currency,
ml.currency_id
FROM
report_open_items_partner rp
INNER JOIN
@ -470,13 +471,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_move_line
@ -558,7 +561,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

4
account_financial_report/report/templates/aged_partner_balance.xml

@ -286,7 +286,7 @@
<!--## total-->
<div class="act_as_cell right" style="width: 370px;">Percents</div>
<!--## amount_residual-->
<div class="act_as_cell amount" style="width: 110px;"></div>
<div class="act_as_cell amount" style="width: 110px;"/>
<!--## current-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_current"/>%</div>
<!--## age_30_days-->
@ -306,7 +306,7 @@
<!--## date_due-->
<div class="act_as_cell" style="width: 60px;"/>
<!--## amount_residual-->
<div class="act_as_cell amount" style="width: 70px;"></div>
<div class="act_as_cell amount" style="width: 70px;"/>
<!--## current-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_current"/>%</div>
<!--## age_30_days-->

67
account_financial_report/report/templates/general_ledger.xml

@ -125,47 +125,43 @@
<div class="act_as_cell amount" style="width: 75px;">Credit</div>
<!--## balance cumulated-->
<div class="act_as_cell amount" style="width: 75px;">Cumul. Bal.</div>
<t t-if="has_second_currency">
<!--## currency_name-->
<div class="act_as_cell" style="width: 35px;">Cur.</div>
<!--## amount_currency-->
<div class="act_as_cell amount" style="width: 75px;">Amount cur.</div>
</t>
<!--## currency_name-->
<div class="act_as_cell" style="width: 35px;">Cur.</div>
<!--## amount_currency-->
<div class="act_as_cell amount" style="width: 75px;">Amount cur.</div>
</div>
</div>
<!-- Display first line with initial balance -->
<div class="act_as_row lines">
<!--## date-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
<!--## move-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
<!--## journal-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
<!--## account code-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
<!--## partner-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
<!--## ref - label-->
<div class="act_as_cell amount">Initial balance</div>
<t t-if="show_cost_center">
<!--## cost_center-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
</t>
<!--## matching_number-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
<!--## debit-->
<div class="act_as_cell amount"><span t-field="account_or_partner_object.initial_debit"/></div>
<!--## credit-->
<div class="act_as_cell amount"><span t-field="account_or_partner_object.initial_credit"/></div>
<!--## balance cumulated-->
<div class="act_as_cell amount"><span t-field="account_or_partner_object.initial_balance"/></div>
<t t-if="has_second_currency">
<!--## currency_name-->
<div class="act_as_cell"></div>
<!--## amount_currency-->
<div class="act_as_cell"></div>
</t>
<!--## currency_name-->
<div class="act_as_cell"/>
<!--## amount_currency-->
<div class="act_as_cell"/>
</div>
<!-- Display each lines -->
@ -196,17 +192,15 @@
<div class="act_as_cell amount"><span t-field="line.credit"/></div>
<!--## balance cumulated-->
<div class="act_as_cell amount"><span t-field="line.cumul_balance"/></div>
<t t-if="has_second_currency">
<!--## currency_name-->
<div class="act_as_cell"><span t-field="line.currency_name"/></div>
<t t-if="line.currency_name">
<!--## amount_currency-->
<div class="act_as_cell amount"><span t-field="line.amount_currency"/></div>
</t>
<t t-if="not line.currency_name">
<!--## amount_currency-->
<div class="act_as_cell"></div>
</t>
<!--## currency_name-->
<div class="act_as_cell"><span t-field="line.currency_name"/></div>
<t t-if="line.currency_name">
<!--## amount_currency-->
<div class="act_as_cell amount"><span t-field="line.amount_currency"/></div>
</t>
<t t-if="not line.currency_name">
<!--## amount_currency-->
<div class="act_as_cell"/>
</t>
</div>
</t>
@ -223,25 +217,24 @@
<div class="act_as_cell right" style="width: 290px;">Ending balance</div>
</t>
<t t-if='type == "partner_type"'>
<div class="act_as_cell first_column" style="width: 380px;"></div>
<div class="act_as_cell first_column" style="width: 380px;"/>
<div class="act_as_cell right" style="width: 290px;">Partner ending balance</div>
</t>
<t t-if="show_cost_center">
<!--## cost_center-->
<div class="act_as_cell" style="width: 100px;"></div>
<div class="act_as_cell" style="width: 100px;"/>
</t>
<!--## matching_number-->
<div class="act_as_cell" style="width: 25px;"></div>
<div class="act_as_cell" style="width: 25px;"/>
<!--## debit-->
<div class="act_as_cell amount" style="width: 75px;"><span t-field="account_or_partner_object.final_debit"/></div>
<!--## credit-->
<div class="act_as_cell amount" style="width: 75px;"><span t-field="account_or_partner_object.final_credit"/></div>
<!--## balance cumulated-->
<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-->
<div class="act_as_cell" style="width: 110px;"></div>
</t>
<!--## currency_name + amount_currency-->
<div class="act_as_cell" style="width: 110px;"/>
</div>
</div>
</template>

54
account_financial_report/report/templates/open_items.xml

@ -103,14 +103,12 @@
<div class="act_as_cell" style="width: 75px;">Original</div>
<!--## amount_residual-->
<div class="act_as_cell" style="width: 75px;">Residual</div>
<t t-if="has_second_currency">
<!--## currency_name-->
<div class="act_as_cell" style="width: 35px;">Cur.</div>
<!--## amount_total_due_currency-->
<div class="act_as_cell amount" style="width: 75px;">Cur. Original</div>
<!--## amount_residual_currency-->
<div class="act_as_cell amount" style="width: 75px;">Cur. Residual</div>
</t>
<!--## currency_name-->
<div class="act_as_cell" style="width: 35px;">Cur.</div>
<!--## amount_total_due_currency-->
<div class="act_as_cell amount" style="width: 75px;">Cur. Original</div>
<!--## amount_residual_currency-->
<div class="act_as_cell amount" style="width: 75px;">Cur. Residual</div>
</div>
</div>
@ -136,21 +134,19 @@
<div class="act_as_cell amount"><span t-field="line.amount_total_due"/></div>
<!--## amount_residual-->
<div class="act_as_cell amount"><span t-field="line.amount_residual"/></div>
<t t-if="has_second_currency">
<!--## currency_name-->
<div class="act_as_cell"><span t-field="line.currency_name"/></div>
<t t-if="line.currency_name">
<!--## amount_total_due_currency-->
<div class="act_as_cell amount"><span t-field="line.amount_total_due_currency"/></div>
<!--## amount_residual_currency-->
<div class="act_as_cell amount"><span t-field="line.amount_residual_currency"/></div>
</t>
<t t-if="not line.currency_name">
<!--## amount_total_due_currency-->
<div class="act_as_cell"></div>
<!--## amount_residual_currency-->
<div class="act_as_cell"></div>
</t>
<!--## currency_name-->
<div class="act_as_cell"><span t-field="line.currency_name"/></div>
<t t-if="line.currency_name">
<!--## amount_total_due_currency-->
<div class="act_as_cell amount"><span t-field="line.amount_total_due_currency"/></div>
<!--## amount_residual_currency-->
<div class="act_as_cell amount"><span t-field="line.amount_residual_currency"/></div>
</t>
<t t-if="not line.currency_name">
<!--## amount_total_due_currency-->
<div class="act_as_cell"/>
<!--## amount_residual_currency-->
<div class="act_as_cell"/>
</t>
</div>
</t>
@ -167,19 +163,17 @@
<div class="act_as_cell right" style="width: 290px;">Ending balance</div>
</t>
<t t-if='type == "partner_type"'>
<div class="act_as_cell first_column" style="width: 380px;"></div>
<div class="act_as_cell first_column" style="width: 380px;"/>
<div class="act_as_cell right" style="width: 290px;">Partner ending balance</div>
</t>
<!--## date_due-->
<div class="act_as_cell" style="width: 60px;"></div>
<div class="act_as_cell" style="width: 60px;"/>
<!--## amount_total_due-->
<div class="act_as_cell amount" style="width: 75px;"></div>
<div class="act_as_cell amount" style="width: 75px;"/>
<!--## amount_currency-->
<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 -->
<div class="act_as_cell" style="width: 185px;"></div>
</t>
<!--## currency_name + amount_total_due_currency + amount_residual_currency -->
<div class="act_as_cell" style="width: 185px;"/>
</div>
</div>
</template>

Loading…
Cancel
Save