Skip to content

Commit 190e45f

Browse files
committed
[FIX] l10n_ch: ensure correct type of drawing
Ensure the type given in parameter is from reportlab. opw-4478396
1 parent d18ba24 commit 190e45f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

addons/l10n_ch/models/ir_actions_report.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from odoo import api, models
55
from odoo.tools.pdf import OdooPdfFileReader, OdooPdfFileWriter
66
from pathlib import Path
7-
from reportlab.graphics.shapes import Image as ReportLabImage
7+
from reportlab.graphics.shapes import Drawing as ReportLabDrawing, Image as ReportLabImage
88
from reportlab.lib.units import mm
99

1010
CH_QR_CROSS_SIZE_RATIO = 0.1522 # Ratio between the side length of the Swiss QR-code cross image and the QR-code's
@@ -21,6 +21,7 @@ def get_available_barcode_masks(self):
2121

2222
@api.model
2323
def apply_qr_code_ch_cross_mask(self, width, height, barcode_drawing):
24+
assert isinstance(barcode_drawing, ReportLabDrawing)
2425
zoom_x = barcode_drawing.transform[0]
2526
zoom_y = barcode_drawing.transform[3]
2627
cross_width = CH_QR_CROSS_SIZE_RATIO * width

0 commit comments

Comments
 (0)