コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
1475 ビュー

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 

アバター
破棄
最善の回答

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


アバター
破棄