Hello,
I created a module that should contain 4 images and I will like these images have a resolution of 700X255px (it can be crop) but I do not know how.
I looked in the product class, but I do not understand how it's make:
'image': fields.binary("Image",
help="This field holds the image used as image for the product, limited to 1024x1024px."),
'image_medium': fields.function(_get_image, fnct_inv=_set_image,
string="Medium-sized image", type="binary", multi="_get_image",
store={
'product.template': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
}
Nowhere in code, I see that where is specify the size
Could you help me, here is my model:
class Room(models.Model):
_name = my.room'
visual1_id = fields.Many2one('ir.attachment', ondelete='cascade', string="Image 1")
visual2_id = fields.Many2one('ir.attachment', ondelete='cascade', string="Image 2")
visual3_id = fields.Many2one('ir.attachment', ondelete='cascade', string="Image 3")
visual4_id = fields.Many2one('ir.attachment', ondelete='cascade', string="Image 4")
and this is my view
<field name="visual1_id" widget="image"/>
<field name="visual2_id" widget="image"/>
<field name="visual3_id" widget="image"/>
<field name="visual4_id" widget="image"/>
Thanks
Hope this will solve your problem: http://learnopenerp.blogspot.com/2020/07/how-to-resize-image-on-saving-records-in-odoo.html