Skip to content

Commit 396bf6a

Browse files
TheMule71jado95
authored andcommitted
[FIX] l10n_it_central_journal_reportlab: escape Paragraph content
1 parent e47b603 commit 396bf6a

File tree

4 files changed

+34
-29
lines changed

4 files changed

+34
-29
lines changed

l10n_it_central_journal_reportlab/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ITA - Libro giornale - Reportlab
77
!! This file is generated by oca-gen-addon-readme !!
88
!! changes will be overwritten. !!
99
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10-
!! source digest: sha256:406c815cf9f5d7858e2354cdb28c41b751c27edacf1b580a4ca626ef2ea10a9a
10+
!! source digest: sha256:91af559133071364b21113152d074c2e22096b825300936d3a24de75f65d2fe9
1111
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1212
1313
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png

l10n_it_central_journal_reportlab/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
{
55
"name": "ITA - Libro giornale - Reportlab",
6-
"version": "16.0.1.0.5",
6+
"version": "16.0.1.0.6",
77
"development_status": "Beta",
88
"category": "Localization/Italy",
99
"author": "Gianmarco Conte - Dinamiche Aziendali srl, "

l10n_it_central_journal_reportlab/static/description/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ <h1 class="title">ITA - Libro giornale - Reportlab</h1>
367367
!! This file is generated by oca-gen-addon-readme !!
368368
!! changes will be overwritten. !!
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370-
!! source digest: sha256:406c815cf9f5d7858e2354cdb28c41b751c27edacf1b580a4ca626ef2ea10a9a
370+
!! source digest: sha256:91af559133071364b21113152d074c2e22096b825300936d3a24de75f65d2fe9
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372372
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_central_journal_reportlab"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-italy-16-0/l10n-italy-16-0-l10n_it_central_journal_reportlab"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373373
<p><strong>Italiano</strong></p>

l10n_it_central_journal_reportlab/wizard/print_giornale.py

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import base64
66
import io
77
from datetime import timedelta
8+
from xml.sax.saxutils import escape
89

910
from reportlab.lib import colors
1011
from reportlab.lib.enums import TA_RIGHT
@@ -308,8 +309,12 @@ def get_initial_balance_data_report_giornale(self):
308309
"",
309310
"",
310311
Paragraph(_("Initial Balance"), style_name),
311-
Paragraph(formatLang(self.env, self.progressive_debit2), style_number),
312-
Paragraph(formatLang(self.env, self.progressive_credit), style_number),
312+
Paragraph(
313+
escape(formatLang(self.env, self.progressive_debit2)), style_number
314+
),
315+
Paragraph(
316+
escape(formatLang(self.env, self.progressive_credit)), style_number
317+
),
313318
]
314319
]
315320
return initial_balance_data
@@ -338,27 +343,28 @@ def get_grupped_final_tables_report_giornale(
338343
)
339344
if not account_name:
340345
continue
341-
# evitiamo che i caratteri < o > vengano interpretato come tag html
342-
# dalla libreria reportlab
343-
account_name = account_name.replace("<", "&lt;").replace(">", "&gt;")
344346

345347
start_row += 1
346-
row = Paragraph(str(start_row), style_name)
347-
date = Paragraph(format_date(self.env, line["date"]), style_name)
348-
move = Paragraph(line["move_name"], style_name)
349-
account = Paragraph(account_name, style_name)
350-
name = Paragraph(line["name"], style_name)
348+
row = Paragraph(escape(str(start_row)), style_name)
349+
date = Paragraph(escape(format_date(self.env, line["date"])), style_name)
350+
move = Paragraph(escape(line["move_name"]), style_name)
351+
account = Paragraph(escape(account_name), style_name)
352+
name = Paragraph(escape(line["name"]), style_name)
351353
# dato che nel SQL ho la somma dei crediti e debiti potrei avere
352354
# che un conto ha sia debito che credito
353355
lines_data = []
354356
if line["debit"] > 0:
355-
debit = Paragraph(formatLang(self.env, line["debit"]), style_number)
356-
credit = Paragraph(formatLang(self.env, 0), style_number)
357+
debit = Paragraph(
358+
escape(formatLang(self.env, line["debit"])), style_number
359+
)
360+
credit = Paragraph(escape(formatLang(self.env, 0)), style_number)
357361
list_balance.append((line["debit"], 0))
358362
lines_data.append([[row, date, move, account, name, debit, credit]])
359363
if line["credit"] > 0:
360-
debit = Paragraph(formatLang(self.env, 0), style_number)
361-
credit = Paragraph(formatLang(self.env, line["credit"]), style_number)
364+
debit = Paragraph(escape(formatLang(self.env, 0)), style_number)
365+
credit = Paragraph(
366+
escape(formatLang(self.env, line["credit"])), style_number
367+
)
362368
list_balance.append((0, line["credit"]))
363369
lines_data.append([[row, date, move, account, name, debit, credit]])
364370
for line_data in lines_data:
@@ -394,25 +400,24 @@ def get_final_tables_report_giornale(
394400

395401
for line in self.env["account.move.line"].browse(move_line_ids):
396402
start_row += 1
397-
row = Paragraph(str(start_row), style_name)
398-
date = Paragraph(format_date(self.env, line.date), style_name)
399-
ref = Paragraph(str(line.ref or ""), style_name)
403+
row = Paragraph(escape(str(start_row)), style_name)
404+
date = Paragraph(escape(format_date(self.env, line.date)), style_name)
405+
ref = Paragraph(escape(str(line.ref or "")), style_name)
400406
move_name = line.move_id.name or ""
401-
move = Paragraph(move_name, style_name)
407+
move = Paragraph(escape(move_name), style_name)
402408
account_name = self._get_account_name_reportlab(line)
403409
# evitiamo che i caratteri < o > vengano interpretato come tag html
404410
# dalla libreria reportlab
405-
account_name = account_name.replace("<", "&lt;").replace(">", "&gt;")
406-
account = Paragraph(account_name, style_name)
411+
account = Paragraph(escape(account_name), style_name)
407412
if line.account_id.account_type in [
408413
"asset_receivable",
409414
"liability_payable",
410415
]:
411-
name = Paragraph(str(line.partner_id.name or ""), style_name)
416+
name = Paragraph(escape(str(line.partner_id.name or "")), style_name)
412417
else:
413-
name = Paragraph(str(line.name or ""), style_name)
414-
debit = Paragraph(formatLang(self.env, line.debit), style_number)
415-
credit = Paragraph(formatLang(self.env, line.credit), style_number)
418+
name = Paragraph(escape(str(line.name or "")), style_name)
419+
debit = Paragraph(escape(formatLang(self.env, line.debit)), style_number)
420+
credit = Paragraph(escape(formatLang(self.env, line.credit)), style_number)
416421
list_balance.append((line.debit, line.credit))
417422
line_data = [[row, date, ref, move, account, name, debit, credit]]
418423
if previous_move_name != move_name:
@@ -441,8 +446,8 @@ def get_balance_data_report_giornale(self, tot_debit, tot_credit, final=False):
441446
"",
442447
"",
443448
name,
444-
Paragraph(formatLang(self.env, tot_debit), style_number),
445-
Paragraph(formatLang(self.env, tot_credit), style_number),
449+
Paragraph(escape(formatLang(self.env, tot_debit)), style_number),
450+
Paragraph(escape(formatLang(self.env, tot_credit)), style_number),
446451
]
447452
]
448453
return balance_data

0 commit comments

Comments
 (0)