image_mixin.py 860 B

1234567891011121314151617181920
  1. # -*- coding: utf-8 -*-
  2. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  3. from odoo import models, fields
  4. class ImageMixin(models.AbstractModel):
  5. _name = 'image.mixin'
  6. _description = "Image Mixin"
  7. # all image fields are base64 encoded and PIL-supported
  8. image_1920 = fields.Image("Image", max_width=1920, max_height=1920)
  9. # resized fields stored (as attachment) for performance
  10. image_1024 = fields.Image("Image 1024", related="image_1920", max_width=1024, max_height=1024, store=True)
  11. image_512 = fields.Image("Image 512", related="image_1920", max_width=512, max_height=512, store=True)
  12. image_256 = fields.Image("Image 256", related="image_1920", max_width=256, max_height=256, store=True)
  13. image_128 = fields.Image("Image 128", related="image_1920", max_width=128, max_height=128, store=True)