Recent Bloggers

Ankit Prajapati
Posts: 5
Stars: 0
Date: 9/18/17
Chirag Patel
Posts: 4
Stars: 0
Date: 9/15/17
Rahul Joshi
Posts: 5
Stars: 0
Date: 9/15/17
Jiten Vaghela
Posts: 1
Stars: 0
Date: 8/23/17
Kuldeep Acharya
Posts: 1
Stars: 0
Date: 8/16/17
Saurang Suthar
Posts: 5
Stars: 0
Date: 7/5/17
Jyoti Verma
Posts: 3
Stars: 0
Date: 6/29/17
Pankti Patel
Posts: 1
Stars: 0
Date: 5/27/17
Chandrika Baraiya
Posts: 5
Stars: 0
Date: 5/27/17
Atith Patel
Posts: 5
Stars: 0
Date: 5/23/17
« Back

Barcode and QR code on Odoo v9

Barcode is a machine-readable code in the form of numbers and a pattern of parallel lines of varying widths, printed on a commodity and used especially for stock control. In other terms we can say Barcodes are images returned by a controller and can easily be embedded in reports. 
 
QR code (abbreviated from Quick Response Code) is the trademark for a type of matrix barcode (or two-dimensional barcode). A QR code uses four standardized encoding modes (numeric, alphanumeric, byte/binary, and kanji) to efficiently store data.
 
To generate a barcode or QR code you have to first configure your system by following steps:
 
Step 1: Update reportlab using following command:
  • sudo pip install reportlab --upgrade
Step 2: Load fonts by following below mentioned steps:
  • Go to path /usr/lib/python2.7/dist-packages/reportlab
  • Create a new folder named fonts.
  • Download fonts using from here: http://www.reportlab.com/ftp/fonts/pfbfer.zip
  • Extract this zip file in: /usr/lib/python2.7/dist-packages/reportlab/fonts
  • Use this command to unzip it: unzip pfbfer.zip -d /usr/lib/python2.7/dist-packages/reportlab/fonts
Step 3: Now go to report template xml file in which you have created template for the report and just write this tag at the place where you want to display code in report: 
 
  • For Barcode:
<img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', o.name, 50, 50)" style="width:50px;height:50px;"/> 
 
  • For QRCode:
<img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('QR', o.name, 50, 50)" style="width:50px;height:50px;"/>
 
Step 4: Restart server, upgrade related module from database and print report.
Comments
Trackback URL:

Dennis Boy Silva
Hi, Can I use this on version 8?
Thanks..
Posted on 1/30/17 5:56 AM.
Janarthanan Ramu
thanks its working on odoo10 also
Posted on 6/16/17 6:50 AM.

Contact Us

Loading

Get in touch

Headquarter :
302, Landmark,
Nr. Titanium City Center,
Prahlad Nagar Road,
Ahmedabad, India - 380015.