diff --git a/doc/reference/javascript_reference.rst b/doc/reference/javascript_reference.rst
index e963cf878f5..2b2b51e4dc8 100644
--- a/doc/reference/javascript_reference.rst
+++ b/doc/reference/javascript_reference.rst
@@ -1763,7 +1763,7 @@ order.
.. code-block:: xml
-
+
- binary (FieldBinaryFile)
Generic widget to allow saving/downloading a binary file.
diff --git a/odoo/addons/base/models/image_mixin.py b/odoo/addons/base/models/image_mixin.py
index 1941ca41774..d7611c895ff 100644
--- a/odoo/addons/base/models/image_mixin.py
+++ b/odoo/addons/base/models/image_mixin.py
@@ -10,33 +10,19 @@ class ImageMixin(models.AbstractModel):
# all image fields are base64 encoded and PIL-supported
- image_original = fields.Image("Original Image", help="Image in its original size, as it was uploaded.")
+ image_1920 = fields.Image("Image", max_width=1920, max_height=1920)
# resized fields stored (as attachment) for performance
- image_big = fields.Image("Big-sized Image", related="image_original", max_width=1024, max_height=1024, store=True, help="1024px * 1024px")
- image_large = fields.Image("Large-sized Image", related="image_original", max_width=256, max_height=256, store=True, help="256px * 256px")
- image_medium = fields.Image("Medium-sized Image", related="image_original", max_width=128, max_height=128, store=True, help="128px * 128px")
- image_small = fields.Image("Small-sized Image", related="image_original", max_width=64, max_height=64, store=True, help="64px * 64px")
+ 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)
+ image_64 = fields.Image("Image 64", related="image_1920", max_width=64, max_height=64, store=True)
can_image_be_zoomed = fields.Boolean("Can image raw be zoomed", compute='_compute_images', store=True)
- image = fields.Image("Image", compute='_compute_image', inverse='_set_image')
-
- @api.depends('image_original')
+ @api.depends('image_1920')
def _compute_images(self):
for record in self:
- image = record.image_original
+ image = record.image_1920
record.can_image_be_zoomed = image and tools.is_image_size_above(image)
-
- @api.depends('image_big')
- def _compute_image(self):
- for record in self:
- record.image = record.image_big
-
- def _set_image(self):
- for record in self:
- record.image_original = record.image
- # We want the image field to be recomputed to have a correct size.
- # Without this `invalidate_cache`, the image field will keep holding the
- # image_original instead of the big-sized image.
- self.invalidate_cache()
diff --git a/odoo/addons/base/models/res_partner.py b/odoo/addons/base/models/res_partner.py
index e9c3f91c44a..9ffacd4913f 100644
--- a/odoo/addons/base/models/res_partner.py
+++ b/odoo/addons/base/models/res_partner.py
@@ -222,11 +222,11 @@ class Partner(models.Model):
# image: all image fields are base64 encoded and PIL-supported
image = fields.Binary("Image")
- image_medium = fields.Binary("Medium-sized image",
+ image_128 = fields.Binary("Medium-sized image",
help="Medium-sized image of this contact. It is automatically "\
"resized as a 128x128px image, with aspect ratio preserved. "\
"Use this field in form views or some kanban views.")
- image_small = fields.Binary("Small-sized image",
+ image_64 = fields.Binary("Small-sized image",
help="Small-sized image of this contact. It is automatically "\
"resized as a 64x64px image, with aspect ratio preserved. "\
"Use this field anywhere a small image is required.")
@@ -348,7 +348,7 @@ class Partner(models.Model):
if image_base64 and colorize:
image_base64 = tools.image_process(image_base64, colorize=True)
- return tools.image_process(image_base64, size=tools.IMAGE_BIG_SIZE)
+ return tools.image_process(image_base64, size=(1024, 1024))
@api.model
def _fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
diff --git a/odoo/addons/base/models/res_users.py b/odoo/addons/base/models/res_users.py
index d7ef51862cd..96d747ecb07 100644
--- a/odoo/addons/base/models/res_users.py
+++ b/odoo/addons/base/models/res_users.py
@@ -201,9 +201,9 @@ class Users(models.Model):
__uid_cache = defaultdict(dict) # {dbname: {uid: password}}
# User can write on a few of his own fields (but not his groups for example)
- SELF_WRITEABLE_FIELDS = ['signature', 'action_id', 'company_id', 'email', 'name', 'image', 'image_medium', 'image_small', 'lang', 'tz']
+ SELF_WRITEABLE_FIELDS = ['signature', 'action_id', 'company_id', 'email', 'name', 'image', 'image_128', 'image_64', 'lang', 'tz']
# User can read a few of his own fields
- SELF_READABLE_FIELDS = ['signature', 'company_id', 'login', 'email', 'name', 'image', 'image_medium', 'image_small', 'lang', 'tz', 'tz_offset', 'groups_id', 'partner_id', '__last_update', 'action_id']
+ SELF_READABLE_FIELDS = ['signature', 'company_id', 'login', 'email', 'name', 'image', 'image_128', 'image_64', 'lang', 'tz', 'tz_offset', 'groups_id', 'partner_id', '__last_update', 'action_id']
def _default_groups(self):
default_user = self.env.ref('base.default_user', raise_if_not_found=False)
diff --git a/odoo/addons/base/tests/test_ir_http.py b/odoo/addons/base/tests/test_ir_http.py
index 6d8f29686b1..19ab037400f 100644
--- a/odoo/addons/base/tests/test_ir_http.py
+++ b/odoo/addons/base/tests/test_ir_http.py
@@ -62,7 +62,7 @@ class test_ir_http_mimetype(common.TransactionCase):
'type': 'binary',
})
- resized = odoo.tools.image_process(prop.value_binary, size=odoo.tools.IMAGE_SMALL_SIZE)
+ resized = odoo.tools.image_process(prop.value_binary, size=(64, 64))
# Simul computed field which resize and that is not attachement=True (E.G. on product)
prop.write({'value_binary': resized})
status, headers, content = self.env['ir.http'].binary_content(
diff --git a/odoo/addons/base/views/res_partner_views.xml b/odoo/addons/base/views/res_partner_views.xml
index ee59fe130c0..15c9a695c2e 100644
--- a/odoo/addons/base/views/res_partner_views.xml
+++ b/odoo/addons/base/views/res_partner_views.xml
@@ -67,7 +67,7 @@