India

ZestyBeanz Technologies Pvt Ltd 4th Floor, Nila, Technopark Thiruvananthapuram,
India – 695581
Phone: +91 471 4063254
Fax : +91 471 2700171

   .

ZestyBeanz Technologies Pvt Ltd
61/3236, Manikkath Cross Road
Ravipuram, Kochi, India - 682016
Phone: +91 484 4063254

  UAE

Zesty Labs
Office # 2003, Millennium Plaza Building
Sheikh Zayed Rd, Dubai, UAE
Phone: +971 4333 2222​
Mobile: +971-52-7553466

  Germany​

ZestyBeanz Technologies GmbH
Reuterstraße 1
90408 Nürnberg
Fon: +49 911 4801 444
Fax: +49 911 4801 445

QR code generation in OpenERP

Contact Form


Janeesh A's picture

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.

AttachmentSize
tr_barcode.zip1.33 MB

Anonymous's picture

Traceback (most recent call

Traceback (most recent call last):
File "/home/eagle/openerp/osv/osv.py", line 121, in wrapper
return f(self, dbname, *args, **kwargs)
File "/home/eagle/openerp/osv/osv.py", line 176, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/home/eagle/openerp/osv/osv.py", line 164, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/home/eagle/tr_barcode/tr_barcode.py", line 98, in generate_image
hr=self_obj.hr_form)
File "/home/eagle/tr_barcode/tr_barcode.py", line 86, in get_image
qrCode.encode()
File "/home/eagle/tr_barcode/qrtools.py", line 117, in encode
self.data_to_string()
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

How to solve this error ?? maybe we must set path an image ??

sahad's picture

I got same error as you

I got same error as you got,Please tell me,How can i solve this

tandarts prijzen's picture

Hi! This is my first comment

Hi! This is my first comment here so I just wanted to give a quick shout out and say I truly enjoy reading your blog posts. Can you suggest any other blogs/websites/forums that deal with the same subjects? Thank you!

tandarts apeldoorn loeff's picture

Hi, this weekend is good in

Hi, this weekend is good in support of me, because this occasion i am reading this great educational post here at my residence.

emna's picture

Hello, I have the following

Hello,
I have the following error when i try to generate a QR barcode:
Traceback (most recent call last):
File "netsvc.pyo", line 489, in dispatch
File "service\web_services.pyo", line 599, in dispatch
File "osv\osv.pyo", line 122, in wrapper
File "osv\osv.pyo", line 176, in execute
File "osv\osv.pyo", line 167, in execute_cr
File "C:\Program Files\OpenERP 6.0\Server\addons\tr_barcode\wizard\tr_barcode_wizard.py", line 78, in create_barcode_record
File "C:\Program Files\OpenERP 6.0\Server\addons\tr_barcode\tr_barcode.py", line 53, in generate_image
File "C:\Program Files\OpenERP 6.0\Server\addons\tr_barcode\tr_barcode.py", line 42, 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

can you help me please

regards

Anonymous's picture

hello I have the same error

hello
I have the same error that you ;can you help me if you have to find a solution.

e ziggi günstig's picture

Hi theгe, Ι enjoу

Hi theгe, Ι enjoу reading thгough your artіcle pоst. I liκe to write a little cοmment to suppоrt you.

Yoda's picture

I have installed as described

I have installed as described and can do barcodes all but QR.
When I write a small script using get_codes() QR is not in the list
I am using 10.04.4 LTS
Is this to do with reportlab?

Standard39
Extended39
EAN13
FIM
EAN8
Extended93
USPS_4State
Codabar
MSI
POSTNET
Code11
Standard93
I2of5
Code128

Thanks

Wil's picture

Hi Janeesh, I wanted to

Hi Janeesh,

I wanted to import the tr-barcode zip file and received the following error:

Error !

Can not create the module file: /home/pathofinder/openerp-server-5.0.9/bin/addons/tr_barcode/.bzr/repository/indices.zip !

Any clue on how to solve this?

Thank's for your feedback.

Oswaldo's picture

help pleace .... error

help pleace .... error here

Environment Information :
System : Windows-32bit-SP1,_v.178
OS Name : nt
Operating System Release :
Operating System Version : 32bit
Operating System Architecture : 32bit
Operating System Locale : es_VE.cp1252
Python Version : 2.5.2
OpenERP-Client Version : 6.0.3
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
File "netsvc.pyo", line 489, in dispatch
File "service\web_services.pyo", line 599, in dispatch
File "osv\osv.pyo", line 122, in wrapper
File "osv\osv.pyo", line 176, in execute
File "osv\osv.pyo", line 167, in execute_cr
File "C:\Program Files\OpenERP 6.0\Server\addons\tr_barcode\tr_barcode.py", line 53, in generate_image
File "C:\Program Files\OpenERP 6.0\Server\addons\tr_barcode\tr_barcode.py", line 42, 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

in openerp 6.0.3