Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
1482 Tampilan

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 

Avatar
Buang
Jawaban Terbai

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


Avatar
Buang