Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
4708 Lượt xem

I am creating a report to print as a pdf. In this report I am generating some QR codes from strings of product data that most generate working QR codes as intended, but some of the strings with special characters, specifically commas "," will make the QR code not generate at all. Taking the commas out makes the code generate but we need the commas in the QR codes. Here is the code I'm using to generate the QR codes. This is the string that sometimes has commas in it: o.product_id.name.


<img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('QR', o.name, 100, 100)" style="display:inline;width:50px;height:50px;"/>








 
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

You don't specify the version of Odoo, so for v15:

Use /report/barcode/QR instead:



Example report scanned via my phone:

Ảnh đại diện
Huỷ bỏ
Tác giả

Hey Ray thanks for the response. The version is Odoo 10.0+e (Enterprise Edition), we are in the process of upgrading to a newer version. I tried what you suggested but it seems to do the same thing. It produces QR codes normally for most strings, but once there is a comma in the string the QR code is not generated. This is the code I used any other suggestions would be appreciated.

<img t-att-src="'/report/barcode/QR/%s' % o.x_mpn" t-att-width="50" t-att-height="50"/>

I don't have access to Odoo 10 as we stopped supporting it in 2020. You can try opening a ticket with Support.

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 5 24
1737
2
thg 5 24
3459
3
thg 2 24
2960
2
thg 11 22
5822
0
thg 4 24
1671