This question has been flagged
9 Replies
35282 Views
Avatar
Discard

If u need to print single barcode then go for qweb.. else use use rml beacuse qweb is slow for enormous process...

Good Questions.

How to generate different barcode in qweb template
https://youtu.be/xCwSbP0XqiA

Best Answer

Add barcodes

  • Barcodes are images returned by a controller
  • Quite easy 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)"/>

Accepted Types:

  • 'Codabar', 'Code11', 'Code128', 'EAN13', 'EAN8', 'Extended39', 'Extended93', 'FIM', 'I2of5', 'MSI', 'POSTNET', 'QR', 'Standard39', 'Standard93', 'UPCA', 'USPS_4State'

img/func7.png

From OpenDays 2014 presentation by Simon Lejeune.

See a live demonstration on: demo.odoo.com/report/barcode/Code128/AZWERTY

or demo.odoo.com/report/barcode/?type=QR&value=text&width=200&height=200

Avatar
Discard

In my case, I had to update the reportlab package to get it to work. Get pip, if you don't have it already, then try "pip install reportlab --update".

Hey Jeff, i think you mean "pip install reportlab --upgrade" :). But thank you for solving my Problem. I also need to run "apt-get install python-dev".

Jeff n Andre @thanks a lot! you saved my day!

This link is also helpful nad works for me: https://github.com/odoo/odoo/issues/3234

Very useful

Best Answer

@Stephen Mack

 The way you mentioned is fine for a single barcode image to be inserted in the report but what to do if we want to add a dynamic barcode and image for every new order ?

I need to do that for the purpose of scanning a customer order in a tailor shop when he comes to collect his order. When a customer comes, he take a reciept of his order and then when he come back to collect the completed order after a mentioned time, then we should be able to search the order through barcode scanner. For that every order must have a unique barcode. 

Avatar
Discard
Best Answer

<img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN13', move.product_id.ean13, 600, 100)" style="width:300px;height:50px"/>

Avatar
Discard