跳至内容
菜单
此问题已终结
1 回复
10406 查看

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

形象
丢弃
最佳答案

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.

形象
丢弃
编写者

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

编写者

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.

相关帖文 回复 查看 活动
5
8月 19
9268
3
4月 19
6575
3
2月 24
14180
3
4月 19
5834
4
3月 19
7593