20 lines
860 B
Python
20 lines
860 B
Python
|
# -*- coding: utf-8 -*-
|
||
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||
|
|
||
|
from odoo import models, fields
|
||
|
|
||
|
|
||
|
class ImageMixin(models.AbstractModel):
|
||
|
_name = 'image.mixin'
|
||
|
_description = "Image Mixin"
|
||
|
|
||
|
# all image fields are base64 encoded and PIL-supported
|
||
|
|
||
|
image_1920 = fields.Image("Image", max_width=1920, max_height=1920)
|
||
|
|
||
|
# resized fields stored (as attachment) for performance
|
||
|
image_1024 = fields.Image("Image 1024", related="image_1920", max_width=1024, max_height=1024, store=True)
|
||
|
image_512 = fields.Image("Image 512", related="image_1920", max_width=512, max_height=512, store=True)
|
||
|
image_256 = fields.Image("Image 256", related="image_1920", max_width=256, max_height=256, store=True)
|
||
|
image_128 = fields.Image("Image 128", related="image_1920", max_width=128, max_height=128, store=True)
|