QR code generation in OpenERP
What is QR code ???
A QR code (Quick Response code) is a type of matrix barcode or two-dimensional code designed to be read by smartphones. The code consists of black modules arranged in a square pattern on a white background. The information encoded may be text, a URL, or other data. The QR code is one of the most popular types of two-dimensional barcodes. The QR code was designed to allow its contents to be decoded at high speed. The reason why they are more useful than a standard barcode is that they can store (and digitally present) much more data, including url links, geo coordinates, and text. The other key feature of QR Codes is that instead of requiring a chunky hand-held scanner to scan them, many modern cell phones can scan them.
How QR code can be generated using a python script ?????
First of all you need the python file qrtools.py, copy it in the folder where you running the code. You can get this file at http://code.google.com/p/qtqr/source/browse/qrtools.py. QR code can be generated by a simple python script. To generate a qrcode, create a python file , eg: qrgenerate.py, with the code given below and run the code.
from qrtools import QR code = u"A QR code is a type of matrix barcode designed to be read by smartphones" qrCode = QR(data=code) qrCode.encode() print qrCode.filename
You can run the code by typing 'python qrgenerate.py' in the terminal. Please note that the data argument must be a unicode object if you are going to use non-ascii characters. To encode the text we need to call the encode() method of our new QR object. By printing the filename attribute, we can get path of the created file.
You can modify the attributes of the generated QR Code by passing personalized values to the other parameters of the __init__ method, such as pixel_size, margin_size.
ie, qrCode = QR(data=code, pixel_size=10, margin_size=4 )
How QR code is incorporated in OpenERP ?????
QR code can also be generated with OpenERP. To generate a QRcode in OpenERP, install the module tr_barcode. On installing this module, there will be a new menu Barcode. Goto the menu Barcode/Barcode/Barcode and Create a new record by entering the text at Barcode field and select Type as 'QR'. On pressing the button "Generate Barcode Image", the image will be created at the Data field. The module tr_barcode is attached.
Attachment | Size |
---|---|
tr_barcode.zip | 1.33 MB |