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 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_account ra report_general_ledger_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_move_line report_general_ledger_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/report/open_items.py

@ -362,7 +362,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_partner rp report_open_items_partner rp
INNER JOIN INNER JOIN
@ -470,13 +471,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_move_line report_open_items_move_line
@ -558,7 +561,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

4
account_financial_report/report/templates/aged_partner_balance.xml

@ -286,7 +286,7 @@
<!--## total--> <!--## total-->
<div class="act_as_cell right" style="width: 370px;">Percents</div> <div class="act_as_cell right" style="width: 370px;">Percents</div>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell amount" style="width: 110px;"></div>
<div class="act_as_cell amount" style="width: 110px;"/>
<!--## current--> <!--## current-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_current"/>%</div> <div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_current"/>%</div>
<!--## age_30_days--> <!--## age_30_days-->
@ -306,7 +306,7 @@
<!--## date_due--> <!--## date_due-->
<div class="act_as_cell" style="width: 60px;"/> <div class="act_as_cell" style="width: 60px;"/>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell amount" style="width: 70px;"></div>
<div class="act_as_cell amount" style="width: 70px;"/>
<!--## current--> <!--## current-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_current"/>%</div> <div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_current"/>%</div>
<!--## age_30_days--> <!--## 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> <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-->
<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>
</div> </div>
<!-- Display first line with initial balance --> <!-- Display first line with initial balance -->
<div class="act_as_row lines"> <div class="act_as_row lines">
<!--## date--> <!--## date-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
<!--## move--> <!--## move-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
<!--## journal--> <!--## journal-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
<!--## account code--> <!--## account code-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
<!--## partner--> <!--## partner-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
<!--## ref - label--> <!--## ref - label-->
<div class="act_as_cell amount">Initial balance</div> <div class="act_as_cell amount">Initial balance</div>
<t t-if="show_cost_center"> <t t-if="show_cost_center">
<!--## cost_center--> <!--## cost_center-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
</t> </t>
<!--## matching_number--> <!--## matching_number-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
<!--## debit--> <!--## debit-->
<div class="act_as_cell amount"><span t-field="account_or_partner_object.initial_debit"/></div> <div class="act_as_cell amount"><span t-field="account_or_partner_object.initial_debit"/></div>
<!--## credit--> <!--## credit-->
<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-->
<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> </div>
<!-- Display each lines --> <!-- Display each lines -->
@ -196,17 +192,15 @@
<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-->
<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> </t>
</div> </div>
</t> </t>
@ -223,25 +217,24 @@
<div class="act_as_cell right" style="width: 290px;">Ending balance</div> <div class="act_as_cell right" style="width: 290px;">Ending balance</div>
</t> </t>
<t t-if='type == "partner_type"'> <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> <div class="act_as_cell right" style="width: 290px;">Partner ending balance</div>
</t> </t>
<t t-if="show_cost_center"> <t t-if="show_cost_center">
<!--## cost_center--> <!--## cost_center-->
<div class="act_as_cell" style="width: 100px;"></div>
<div class="act_as_cell" style="width: 100px;"/>
</t> </t>
<!--## matching_number--> <!--## matching_number-->
<div class="act_as_cell" style="width: 25px;"></div>
<div class="act_as_cell" style="width: 25px;"/>
<!--## debit--> <!--## debit-->
<div class="act_as_cell amount" style="width: 75px;"><span t-field="account_or_partner_object.final_debit"/></div> <div class="act_as_cell amount" style="width: 75px;"><span t-field="account_or_partner_object.final_debit"/></div>
<!--## credit--> <!--## credit-->
<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-->
<div class="act_as_cell" style="width: 110px;"></div>
</t>
<!--## currency_name + amount_currency-->
<div class="act_as_cell" style="width: 110px;"/>
</div> </div>
</div> </div>
</template> </template>

54
account_financial_report/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-->
<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>
</div> </div>
@ -136,21 +134,19 @@
<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-->
<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> </t>
</div> </div>
</t> </t>
@ -167,19 +163,17 @@
<div class="act_as_cell right" style="width: 290px;">Ending balance</div> <div class="act_as_cell right" style="width: 290px;">Ending balance</div>
</t> </t>
<t t-if='type == "partner_type"'> <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> <div class="act_as_cell right" style="width: 290px;">Partner ending balance</div>
</t> </t>
<!--## date_due--> <!--## date_due-->
<div class="act_as_cell" style="width: 60px;"></div>
<div class="act_as_cell" style="width: 60px;"/>
<!--## amount_total_due--> <!--## amount_total_due-->
<div class="act_as_cell amount" style="width: 75px;"></div>
<div class="act_as_cell amount" style="width: 75px;"/>
<!--## 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 -->
<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>
</div> </div>
</template> </template>

Loading…
Cancel
Save