İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
10571 Görünümler

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
Vazgeç
En İyi Yanıt

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
Vazgeç
Üretici

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

Üretici

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.

İlgili Gönderiler Cevaplar Görünümler Aktivite
5
Ağu 19
9489
3
Nis 19
6721
3
Şub 24
14409
3
Nis 19
6011
4
Mar 19
7723