Hello,
I have 1 custom class which have minimum 30000 record which have images are stored.
Now, I want to resize all the images which is stored and also creating new record with image.
First image field is like as below
variants_image_medium = fields.Binary('Product Image', store=True, attachment=True)
Now, I converted image field as shown below
variants_image_medium = fields.Binary('Product Image', inverse='_compute_images', store=True, attachment=True, readonly=False)
@api.multi
def _compute_images(self):
for rec in self:
if rec.variants_image_medium:
image = tools.image_resize_image_small(rec.variants_image_medium)
rec.variants_image_medium = image
return rec
It gives me error,
RuntimeError: maximum recursion depth exceeded
How to Solve that error ?
Thanks in Advance,
Reference: http://learnopenerp.blogspot.com/2020/07/how-to-resize-image-on-saving-records-in-odoo.html
In Odoo14 you can resize image like this: https://learnopenerp.blogspot.com/2021/09/dynamically-image-resizing-save-write-odoo14.html