How To Add Images or Barcodes in Odoo Report

Odoo has several ways to display images or barcodes to report. You can add static images or binary images in the report. Also, in Odoo the barcode is treated like an image. So, you can add images or barcodes in Odoo reports easily.

Odoo Logo

Add static images.

Add static image as image src:

<img t-att-src="'/your_module/static/path_of_image'"/>

Add static image as background-image:

<div t-att-style="background-image: url(/your_module/static/path_of_image)">
	<!-- other element -->

Add binary image (image as field).

Add binary image as image src:

<img t-attf-src="'data:image/*;base64,{{image_field}}'"/>

Add binary image as background-image:

<div t-attf-style="background-image: url(data:image/*;base64,{{image_field}})">
	<!-- other element -->

Add barcode or QR.

For barcode you can use Code128, EAN13 or QR (for QR Code).

<img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('QR', barcode_value, 100, 100)"/>

You can customize barcode_value, heigth & width as you need.

Read also:


1 thought on “How To Add Images or Barcodes in Odoo Report”

  1. Pingback: How To Display Image With URL in Odoo - Cak Juice

Comments are closed.