changes
This commit is contained in:
@@ -19,6 +19,8 @@ Two changes:
|
||||
|
||||
Lower sequence = appears higher in the Print dropdown.
|
||||
"""
|
||||
import base64
|
||||
|
||||
from odoo import api, fields, models
|
||||
from odoo.tools import frozendict
|
||||
|
||||
@@ -33,6 +35,20 @@ class IrActionsReport(models.Model):
|
||||
'for both higher and lower priorities.',
|
||||
)
|
||||
|
||||
@api.model
|
||||
def barcode_data_uri(self, barcode_type, value, width=300, height=300):
|
||||
"""Return a data:image/png;base64 URI for a barcode/QR.
|
||||
|
||||
wkhtmltopdf can't always fetch /report/barcode/ over the network
|
||||
during PDF rendering (sandbox/DNS/base-url pitfalls), so reports
|
||||
that embed QR codes on labels inline them as base64 instead.
|
||||
"""
|
||||
png = self.barcode(
|
||||
barcode_type, value,
|
||||
width=width, height=height, humanreadable=0,
|
||||
) or b''
|
||||
return 'data:image/png;base64,' + base64.b64encode(png).decode('ascii')
|
||||
|
||||
|
||||
class IrActionsActions(models.Model):
|
||||
_inherit = 'ir.actions.actions'
|
||||
|
||||
Reference in New Issue
Block a user