You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
493 B
17 lines
493 B
from odoo import api, models
|
|
import qrcode
|
|
import io
|
|
|
|
|
|
class IrActionsReport(models.Model):
|
|
_inherit = 'ir.actions.report'
|
|
|
|
@api.model
|
|
def qr_generate(self, value, box_size=3, border=5, **kwargs):
|
|
try:
|
|
qr = qrcode.make(value, box_size=box_size, border=border, **kwargs)
|
|
arr = io.BytesIO()
|
|
qr.save(arr, format='png')
|
|
return arr.getvalue()
|
|
except Exception:
|
|
raise ValueError("Cannot convert into barcode.")
|