hello .. this is the 3rd time to ask my question ...
i have some images stored in file store .. i want to display them in my form view so how can i do it ?
is there anyway to use image url to display it or not ?
or if any another way
Thank you ~!
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
hello .. this is the 3rd time to ask my question ...
i have some images stored in file store .. i want to display them in my form view so how can i do it ?
is there anyway to use image url to display it or not ?
or if any another way
Thank you ~!
/web/content/<int:id>
<img class="img-url-set"/>
img_attach = fields.Html('Image', compute="_get_img_html")
def _get_img_html(self):
for elem in self:
img_url = '/web/content/%s' % attachment_id
elem.img_attach = '<img src="%s"/>' % img_url
I have been trying to follow along but I do not know how to obtain my attachment_id.. I am using Odoo 13 and my attachment is stored in a fields.Binary with attachment=True. How do I get the img_url?
You could use the same domain that Odoo use to locate the attachment associated with a Binary field with attachment=True
domain = [
('res_model', '=', record._name),
('res_field', '=', field_name),
('res_id', '=', record.id),
]
attach_id = self.env['ir.attachment'].sudo().search(domain)
You can use a python script to read a file and store it in ir_attachments and display in your form or whatever you need. you can also use custom models by inheriting ir_attachments.
use our module it has code and guideline about it https://apps.odoo.com/apps/modules/13.0/ir_attachement_customization/
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
0
Jun 23
|
4301 | ||
|
2
Jul 22
|
11066 | ||
|
1
Aug 20
|
7094 | ||
|
2
Jul 23
|
2831 | ||
Contact image via url
Solved
|
|
2
Sep 21
|
7623 |
H Ahmed, sorry for the delay in responses, please provide more info for a proper answer, there are some ways to get it done