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 |
same error found. i'm using
same error found.
i'm using openerp 6.1
OS windows 7
here's error
Environment Information :
System : Windows-post2008Server-6.1.7600
OS Name : nt
Operating System Release : post2008Server
Operating System Version : 6.1.7600
Operating System Architecture : 32bit
Operating System Locale : en_US.cp1252
Python Version : 2.6.5
OpenERP-Client Version : 6.1.1
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
File "C:\Program Files\OpenERP 6.1-20121208-001656\Server\server\.\openerp\service\netrpc_server.py", line 64, in run
File "C:\Program Files\OpenERP 6.1-20121208-001656\Server\server\.\openerp\netsvc.py", line 360, in dispatch_rpc
File "C:\Program Files\OpenERP 6.1-20121208-001656\Server\server\.\openerp\service\web_services.py", line 586, in dispatch
File "C:\Program Files\OpenERP 6.1-20121208-001656\Server\server\.\openerp\osv\osv.py", line 121, in wrapper
File "C:\Program Files\OpenERP 6.1-20121208-001656\Server\server\.\openerp\osv\osv.py", line 176, in execute
File "C:\Program Files\OpenERP 6.1-20121208-001656\Server\server\.\openerp\osv\osv.py", line 164, in execute_cr
File "C:\Program Files\OpenERP 6.1-20121208-001656\Server\server\openerp\addons\tr_barcode.zip\tr_barcode\wizard\tr_barcode_wizard.py", line 98, in create_barcode_record
File "C:\Program Files\OpenERP 6.1-20121208-001656\Server\server\openerp\addons\tr_barcode.zip\tr_barcode\tr_barcode.py", line 73, in generate_image
File "C:\Program Files\OpenERP 6.1-20121208-001656\Server\server\openerp\addons\tr_barcode.zip\tr_barcode\tr_barcode.py", line 62, in get_image
File "reportlab\graphics\shapes.pyo", line 780, in asString
File "reportlab\graphics\renderPM.pyo", line 656, in drawToString
File "reportlab\graphics\renderPM.pyo", line 651, in drawToFile
File "reportlab\graphics\renderPM.pyo", line 637, in drawToPMCanvas
File "reportlab\graphics\renderPM.pyo", line 50, in draw
File "reportlab\graphics\renderbase.pyo", line 198, in draw
File "reportlab\graphics\renderPM.pyo", line 93, in initState
File "reportlab\graphics\renderPM.pyo", line 87, in applyState
File "reportlab\graphics\renderPM.pyo", line 368, in setFont
File "reportlab\graphics\renderPM.pyo", line 221, in _setFont
RenderPMError: Can't setFont(Times-Roman) missing the T1 files?
Originally : makeT1Font() argument 2 must be string, not None
The solution is to download
The solution is to download the fonts from the reportlab site Or use the link below.
http://www.findthatfile.com/search-11092018-hZIP/winrar-winzip-download-...
Now, unzip the files to the fonts directory in reportlab.
I am using Ubuntu10.04. In my case the path is /usr/lib/python2.6/dist-packages/reportlab/fonts
Extract the pfbfer.zip file
Extract the pfbfer.zip file in the attached module to the fonts directory in reportlab. In ubuntu the path is /usr/lib/python2.6/dist-packages/reportlab/fonts.
Hi Janeesh, I already
Hi Janeesh, I already download pfbfer.zip and extract under C:\Program Files\OpenERP 7.0alpha-20121206-000102\Server\server\reportlab\fonts directory but error still the same. i'm using windows 7 and openerp 6.1 thanks and hope to hear solution regarding this issue.
Hello i don't inderstand
Hello i don't inderstand where i'll extract the pfbfer.zip in windows
can you help me please
regards
Your approach to this topic
Your approach to this topic is unique and informative. I am writing an article for our school paper and this post has helped me. Thanks.