Odoo Help

0
1
Axel Mendoza
On 10/3/15, 2:52 PM

There is an Odoo controller for reports barcode images, as docs says at: https://www.odoo.com/documentation/8.0/reference/reports.html


Barcodes are images returned by a controller and can easily be embedded in reports thanks to the QWeb syntax:
<img t-att-src="'/report/barcode/QR/%s' % 'My text in qr code'"/>
More parameters can be passed as a query string
<img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s'%('QR', 'text', 200, 200)"/>

That controller accepts this types of barcodes: 

:param type: Accepted types: 'Codabar', 'Code11', 'Code128', 'EAN13', 'EAN8', 'Extended39', 'Extended93', 'FIM', 'I2of5', 'MSI', 'POSTNET', 'QR', 'Standard39', 'Standard93', 'UPCA', 'USPS_4State'

Your image could be defined like:

<img t-att-src="'/report/barcode/EAN13/%s' % prod.ean13"/>

0
Jordy Blankestijn
On 7/18/18, 10:53 AM

Answer by @Axel Mendoza still works like a charm on Odoo 11. 

If you run into parse errors on the '&' char you should change this for unicode. So the code should be like:

 <img t-att-src="'/report/barcode/?type=%s&#38;value=%s&#38;width=%s&#38;height=%s' % ('QR', 'text', 200, 200)"/>

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 10/3/15, 2:38 PM
Seen: 3499 times
Last updated: 7/18/18, 10:53 AM