This commit is contained in:
gsinghpal
2026-04-24 21:04:38 -04:00
parent 0eab4b4efb
commit 41d0908ade
4083 changed files with 1230780 additions and 287 deletions

View File

@@ -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'