From 83aaea9e5ce92530875e4fca606a89fe423803ef Mon Sep 17 00:00:00 2001 From: Kevin Baptiste Date: Wed, 29 May 2019 12:57:35 +0000 Subject: [PATCH] [IMP] base: Add option on image widget to enable zoom Purpose ======= As the employee picture on a form view is often too small, it should be possible to zoom on it like for products in eCommerce. Specification ============= Added new bool options on FieldBinaryImage: `zoom` and `background`. `zoom` will call zoomOdoo.js and display a popup with the zoomed out image. `background` is used to either display the image as a div element with a background-url (to be used e.g. in a kanban view) or as a standard img element. closes odoo/odoo#33839 Signed-off-by: Yannick Tivisse (yti) --- addons/hr/models/hr_employee.py | 13 +-- addons/hr/views/hr_employee_public_views.xml | 6 +- addons/hr/views/hr_employee_views.xml | 6 +- addons/hr/views/hr_templates.xml | 1 - addons/hr/views/res_users.xml | 2 +- .../web/static/src/js/fields/basic_fields.js | 87 +++++++++++++++++-- .../static/src/js/libs}/zoomodoo.js | 55 +++++++++++- .../static/src/scss/web.zoomodoo.scss} | 0 addons/web/views/webclient_templates.xml | 3 + .../static/src/js/content/website_root.js | 2 +- addons/website/views/website_templates.xml | 2 - .../static/src/js/website_sale.js | 2 +- odoo/addons/base/models/res_partner.py | 3 +- odoo/addons/base/views/res_users_views.xml | 2 +- 14 files changed, 149 insertions(+), 35 deletions(-) rename addons/{website/static/src/js/content => web/static/src/js/libs}/zoomodoo.js (76%) rename addons/{website/static/src/scss/website.zoomodoo.scss => web/static/src/scss/web.zoomodoo.scss} (100%) diff --git a/addons/hr/models/hr_employee.py b/addons/hr/models/hr_employee.py index 8746e3ecc06..a197d9dc7a4 100644 --- a/addons/hr/models/hr_employee.py +++ b/addons/hr/models/hr_employee.py @@ -92,18 +92,11 @@ class HrEmployeePrivate(models.Model): # image: all image fields are base64 encoded and PIL-supported image = fields.Binary( - "Photo", default=_default_image, - help="This field holds the image used as photo for the employee, limited to 1024x1024px.") + "Photo", default=_default_image) image_medium = fields.Binary( - "Medium-sized photo", - help="Medium-sized photo of the employee. It is automatically " - "resized as a 128x128px image, with aspect ratio preserved. " - "Use this field in form views or some kanban views.") + "Medium-sized photo") image_small = fields.Binary( - "Small-sized photo", - help="Small-sized photo of the employee. It is automatically " - "resized as a 64x64px image, with aspect ratio preserved. " - "Use this field anywhere a small image is required.") + "Small-sized photo") phone = fields.Char(related='address_home_id.phone', related_sudo=False, string="Private Phone", groups="hr.group_hr_user") # employee in company parent_id = fields.Many2one('hr.employee', 'Manager') diff --git a/addons/hr/views/hr_employee_public_views.xml b/addons/hr/views/hr_employee_public_views.xml index a97c63c3feb..d6a97209f11 100644 --- a/addons/hr/views/hr_employee_public_views.xml +++ b/addons/hr/views/hr_employee_public_views.xml @@ -23,7 +23,7 @@
- +