Is there any way to set a contact image by specifying an url in res_partner form view?
For example: i want to use an image located in path-to-image/image.png and i want to set it by modifying a field in res_partner form view.
I'm using odoo v11.0
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Is there any way to set a contact image by specifying an url in res_partner form view?
For example: i want to use an image located in path-to-image/image.png and i want to set it by modifying a field in res_partner form view.
I'm using odoo v11.0
Hi Patrick Galletti,
@api.model
def _default_image(self):
image_path = get_module_resource('module_name', 'path-to-image/image.png', 'name_img.jpg')
return tools.image_resize_image_big(base64.b64encode(open(image_path, 'rb').read()))
define the field in res.partner.
image = fields.Binary("Image", attachment=True, default=_default_image, help="This field holds the image used as image for the product, limited to 1024x1024px.")
From your question, I just understand that you need a field with an image and that image from a particular path. This may help you. If you have any another question free to contact us.
Thanks
Nikhilkrishnan
image= base64.b64encode(requests.get(url.strip()).content).replace(b'\n', b'')
相關帖文 | 回覆 | 瀏覽次數 | 活動 | |
---|---|---|---|---|
|
2
7月 22
|
11093 | ||
|
2
7月 23
|
2856 | ||
|
3
7月 20
|
9666 | ||
|
1
10月 18
|
6826 | ||
|
2
6月 24
|
6901 |
There is free module in odoo v10 for importing image from url: https://www.odoo.com/apps/modules/10.0/partner_image_url/