Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
1473 Vistas

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
Descartar
Mejor respuesta

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
Descartar