Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
1479 Lượt xem

Hi.


I have a field called image_banner

and an image at this url: https://mydomain.com/my_image.jpg


im trying to make a servers action and i wanna set the image of that url to the image_banner field.


Im using the built in servers actions of odoo 15.


Any help appreciated, thank you 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

For this, we can use  ' ImageFromURLMixin'   Mixin includes the method  get_image_from_url() It takes the URL as the function parameter and returns the string in the proper format for saving in the database.
To access this method in our custom model, we have to create the model by inheriting the Mixin class and Model class.
For more details, refer to the blog:


https://www.cybrosys.com/blog/how-to-load-the-images-from-url-in-odoo-15

Hope it helps


Ảnh đại diện
Huỷ bỏ