Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
1472 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit