Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
10417 Переглядів

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.

Related Posts Відповіді Переглядів Дія
5
серп. 19
9279
3
квіт. 19
6583
3
лют. 24
14195
3
квіт. 19
5842
4
бер. 19
7602