You can do it by adding the following code to your py and xml
In report.py
from reportlab.graphics.barcode import createBarcodeDrawing
def barcode(self, type, value, width=400, height=100, humanreadable=0):
width, height, humanreadable = int(width), int(height), bool(humanreadable)
barcode_obj = createBarcodeDrawing(type, value=value, format='png', width=width, height=height,humanReadable = humanreadable,quiet=False)
return base64.encodestring(barcode_obj.asString('png'))
In XML
<img t-att-src="'data:image/png;base64,%s' % barcode('Code128',o.name)"/>
Note:
Check whether you have installed report lab
Regards,
Leelapriskila