Skip to Content
Menu
This question has been flagged
1 Reply
9061 Views

Hi,

I want a custom image to be displayed in the invoice so I have created a custom field (Binary) and asked the user to upload an image. The field shows up in ir_attachment table which is fine but the column db_datas is null and yet the image is being displayed in the UI. I want to know where is the image getting stored when uploaded and how can i put/refer to them in the qweb report?

Thanks

Avatar
Discard
Best Answer

Database can only store text in the columns. So inorder to convert binary data into text like data to storein DB binary data is converted by using Base64 encoding. you can see the binary field in the Table as some random strings.

You can use the widget='image' to see the binary field as an image.

Avatar
Discard
Author

Hi Pablo,

As mentioned in the question, the column db_datas is binary and I'm assuming when i upload a image binary data gets stored in this column but it's not happening and column stays as null even after uploading the image and yet in the UI i could view the image as i mentioned in the question. I want to know what's happening and why is that happening

you can see the image base64 data in the custom binary field you created in the account.invoice model.

Although the field is named as db_datas in the database, in odoo you can access it using the field 'datas', instead of 'db_datas'.

Author

how can i access that image in qweb report? Any idea??

<span t-field="your_binary_field" t-field-options="{&quot;widget&quot;: &quot;image&quot;, &quot;class&quot;: &quot;img-rounded&quot;}"/>

just add the field in the report qweb view with widget=image.

Related Posts Replies Views Activity
5
Aug 19
8017
3
Apr 19
5381
3
Feb 24
12352
3
Apr 19
4687
4
Mar 19
6661