[FIX] report add the humanreadable option to barcode image generator
Closes #4334
This commit is contained in:
parent
7c54c54f9f
commit
e0d482968d
|
@ -72,7 +72,7 @@ class ReportController(Controller):
|
||||||
# Misc. route utils
|
# Misc. route utils
|
||||||
#------------------------------------------------------
|
#------------------------------------------------------
|
||||||
@route(['/report/barcode', '/report/barcode/<type>/<path:value>'], type='http', auth="user")
|
@route(['/report/barcode', '/report/barcode/<type>/<path:value>'], type='http', auth="user")
|
||||||
def report_barcode(self, type, value, width=600, height=100):
|
def report_barcode(self, type, value, width=600, height=100, humanreadable=0):
|
||||||
"""Contoller able to render barcode images thanks to reportlab.
|
"""Contoller able to render barcode images thanks to reportlab.
|
||||||
Samples:
|
Samples:
|
||||||
<img t-att-src="'/report/barcode/QR/%s' % o.name"/>
|
<img t-att-src="'/report/barcode/QR/%s' % o.name"/>
|
||||||
|
@ -82,11 +82,14 @@ class ReportController(Controller):
|
||||||
:param type: Accepted types: 'Codabar', 'Code11', 'Code128', 'EAN13', 'EAN8', 'Extended39',
|
:param type: Accepted types: 'Codabar', 'Code11', 'Code128', 'EAN13', 'EAN8', 'Extended39',
|
||||||
'Extended93', 'FIM', 'I2of5', 'MSI', 'POSTNET', 'QR', 'Standard39', 'Standard93',
|
'Extended93', 'FIM', 'I2of5', 'MSI', 'POSTNET', 'QR', 'Standard39', 'Standard93',
|
||||||
'UPCA', 'USPS_4State'
|
'UPCA', 'USPS_4State'
|
||||||
|
:param humanreadable: Accepted values: 0 (default) or 1. 1 will insert the readable value
|
||||||
|
at the bottom of the output image
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
width, height = int(width), int(height)
|
width, height = int(width), int(height)
|
||||||
barcode = createBarcodeDrawing(
|
barcode = createBarcodeDrawing(
|
||||||
type, value=value, format='png', width=width, height=height
|
type, value=value, format='png', width=width, height=height,
|
||||||
|
humanReadable = humanreadable
|
||||||
)
|
)
|
||||||
barcode = barcode.asString('png')
|
barcode = barcode.asString('png')
|
||||||
except (ValueError, AttributeError):
|
except (ValueError, AttributeError):
|
||||||
|
|
Loading…
Reference in New Issue