This question has been flagged
2 Replies
6030 Views

Hi All,

I want to generate  QR code for Employee information since im unable to get the information of QR code generation in odoo9.0 for any module..?Can anyone help me with my question.

Avatar
Discard
Best Answer

Hello,

import qrcode
import cStringIO
import base64

qr = qrcode.QRCode(
    version=1,
    error_correction=qrcode.constants.ERROR_CORRECT_L,
    box_size=10,
    border=4,
)
qr.add_data('Employee data')
qr.make(fit=True)

img = qr.make_image()
temp = cStringIO.StringIO()
img.save(temp, format="PNG")
qr_image = base64.b64encode(buffer.getvalue())
self.write({'binary_field': qr_image})
Avatar
Discard