Skip to content

Commit 13bd065

Browse files
committed
Merge PR #1232 into 16.0
Signed-off-by pedrobaeza
2 parents 01f1dce + 699d386 commit 13bd065

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

account_financial_report/report/general_ledger_xlsx.py

+23-8
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,11 @@ def _generate_report_content(self, workbook, report, data, report_data):
142142
analytic_data = res_data["analytic_data"]
143143
filter_partner_ids = res_data["filter_partner_ids"]
144144
foreign_currency = res_data["foreign_currency"]
145+
company_currency = res_data["company_currency"]
145146
# For each account
146147
for account in general_ledger:
147148
# Write account title
148-
total_bal_curr = account["init_bal"].get("bal_curr", 0)
149+
total_bal_curr = 0
149150
self.write_array_title(
150151
account["code"] + " - " + accounts_data[account["id"]]["name"],
151152
report_data,
@@ -163,7 +164,7 @@ def _generate_report_content(self, workbook, report, data, report_data):
163164
"initial_balance": account["init_bal"]["balance"],
164165
}
165166
)
166-
if foreign_currency:
167+
if foreign_currency and account["currency_id"]:
167168
account.update(
168169
{"initial_bal_curr": account["init_bal"]["bal_curr"]}
169170
)
@@ -177,7 +178,10 @@ def _generate_report_content(self, workbook, report, data, report_data):
177178
"journal": journals_data[line["journal_id"]]["code"],
178179
}
179180
)
180-
if line["currency_id"]:
181+
line_currency_id = (
182+
line["currency_id"][0] if line["currency_id"] else False
183+
)
184+
if line_currency_id and line_currency_id != company_currency.id:
181185
line.update(
182186
{
183187
"currency_name": line["currency_id"][1],
@@ -207,7 +211,11 @@ def _generate_report_content(self, workbook, report, data, report_data):
207211
"analytic_distribution": analytic_distribution,
208212
}
209213
)
210-
if foreign_currency:
214+
if (
215+
foreign_currency
216+
and line_currency_id
217+
and line_currency_id != company_currency.id
218+
):
211219
total_bal_curr += line["bal_curr"]
212220
line.update({"total_bal_curr": total_bal_curr})
213221
self.write_line_from_dict(line, report_data)
@@ -219,7 +227,7 @@ def _generate_report_content(self, workbook, report, data, report_data):
219227
"final_balance": account["fin_bal"]["balance"],
220228
}
221229
)
222-
if foreign_currency:
230+
if foreign_currency and account["currency_id"]:
223231
account.update(
224232
{
225233
"final_bal_curr": account["fin_bal"]["bal_curr"],
@@ -262,7 +270,7 @@ def _generate_report_content(self, workbook, report, data, report_data):
262270
],
263271
}
264272
)
265-
if foreign_currency:
273+
if foreign_currency and account["currency_id"]:
266274
group_item.update(
267275
{
268276
"initial_bal_curr": group_item["init_bal"]["bal_curr"],
@@ -278,7 +286,10 @@ def _generate_report_content(self, workbook, report, data, report_data):
278286
"journal": journals_data[line["journal_id"]]["code"],
279287
}
280288
)
281-
if line["currency_id"]:
289+
line_currency_id = (
290+
line["currency_id"][0] if line["currency_id"] else False
291+
)
292+
if line_currency_id and line_currency_id != company_currency.id:
282293
line.update(
283294
{
284295
"currency_name": line["currency_id"][1],
@@ -310,7 +321,11 @@ def _generate_report_content(self, workbook, report, data, report_data):
310321
"analytic_distribution": analytic_distribution,
311322
}
312323
)
313-
if foreign_currency:
324+
if (
325+
foreign_currency
326+
and line_currency_id
327+
and line_currency_id != company_currency.id
328+
):
314329
total_bal_curr += line["bal_curr"]
315330
line.update({"total_bal_curr": total_bal_curr})
316331
self.write_line_from_dict(line, report_data)

account_financial_report/report/templates/general_ledger.xml

+1-4
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,7 @@
367367
</t>
368368
</div>
369369
<!-- Display each lines -->
370-
<t
371-
t-set="total_bal_curr"
372-
t-value="account_or_group_item_object['init_bal'].get('bal_curr', 0)"
373-
/>
370+
<t t-set="total_bal_curr" t-value="0" />
374371
<t t-foreach="account_or_group_item_object['move_lines']" t-as="line">
375372
<!-- # lines or centralized lines -->
376373
<div class="act_as_row lines">

0 commit comments

Comments
 (0)