Skip to Content
Menu
This question has been flagged
1 Reply
6490 Views

i have module use odoo 12 function image_resize_image which odoo 13 doesn't use , i want to know which function odoo 13 replace this function

example of using this in my module:

@api.model_create_multi 

 def create(self, vals_list):

 for vals in vals_list:

tools.image_resize_images(vals, big_name='custom_thumbnail', medium_name='custom_thumbnail_medium', small_name='custom_thumbnail_small' ) 

 return super(Thumbnail, self).create(vals_list)

Avatar
Discard

Please stop addressing particular users with your tags. Tags should be related to your content.

Author

ok , sorry

Best Answer

This method in Odoo is replaced by the special field type fields.Image. That field has the special properties max_width & max_height which let automatically resize images without calling the method in create or write of models.

Have a look at the special image mixin model for examples: https://github.com/odoo/odoo/blob/13.0/odoo/addons/base/models/image_mixin.py

By the way, you can inherit this model not to redefine fields (in case 1014, 512, 256, 128px sizes are enough for you).


Avatar
Discard
Author

can you give more detailed example than this

Related Posts Replies Views Activity
2
Sep 23
2103
1
Dec 22
1079
3
Nov 22
2883
1
Nov 22
2938
1
May 22
2649