summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorRobot Odoo <xmo+roboto@odoo.com>2019-08-02 20:36:51 +0200
committerGitHub <noreply@github.com>2019-08-02 20:36:51 +0200
commit6df11fc42d965940e3dcdd64b5a197a60bb6f4e4 (patch)
treeeee38b8192d49fc2c3525b5ce21b80d9d3acc500 /addons
parentec32fd54595614ee8763ba82c5862d79a3e21897 (diff)
parent45e3be94c0095b0814690de3cac9ab56afe32368 (diff)
[MERGE] *: rename image fields and use image.mixin
Merge commit for PR #34925 Related enterprise PR odoo/enterprise/pull/4865 The goal is to: - Use `image.mixin` on the models currently storing multiple image sizes. - Create Image field and use it on models where mixin is overkill. - Rename the image fields to contain the pixel number in the name. - Add 512 size. - Clean up `image.mixin`, zoom field, variant fields. Note: models that currently store only a single size image will not be changed in this PR. Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/account/views/account_move_views.xml2
-rw-r--r--addons/account/views/account_portal_templates.xml2
-rw-r--r--addons/account_analytic_default/views/account_analytic_default_view.xml2
-rw-r--r--addons/calendar/views/calendar_views.xml2
-rw-r--r--addons/crm/models/crm_lead.py2
-rw-r--r--addons/crm/views/crm_lead_views.xml6
-rw-r--r--addons/event_sale/models/event.py4
-rw-r--r--addons/fleet/data/fleet_cars_data.xml132
-rw-r--r--addons/fleet/models/fleet_vehicle.py11
-rw-r--r--addons/fleet/models/fleet_vehicle_model.py34
-rw-r--r--addons/fleet/views/fleet_vehicle_cost_views.xml2
-rw-r--r--addons/fleet/views/fleet_vehicle_model_views.xml7
-rw-r--r--addons/fleet/views/fleet_vehicle_views.xml7
-rw-r--r--addons/gamification/data/badge.xml10
-rw-r--r--addons/gamification/data/gamification_karma_rank_data.xml10
-rw-r--r--addons/gamification/data/goal_base.xml2
-rw-r--r--addons/gamification/models/badge.py25
-rw-r--r--addons/gamification/models/gamification_karma_rank.py17
-rw-r--r--addons/gamification/views/badge.xml9
-rw-r--r--addons/gamification/views/challenge.xml2
-rw-r--r--addons/gamification/views/gamification_karma_rank_views.xml2
-rw-r--r--addons/gamification/views/goal.xml2
-rw-r--r--addons/gamification/views/mail_templates.xml2
-rw-r--r--addons/google_calendar/static/tests/google_calendar_tests.js6
-rw-r--r--addons/hr/data/hr_data.xml2
-rw-r--r--addons/hr/data/hr_demo.xml38
-rw-r--r--addons/hr/models/hr_employee.py18
-rw-r--r--addons/hr/models/hr_employee_public.py18
-rw-r--r--addons/hr/models/res_users.py2
-rw-r--r--addons/hr/report/hr_employee_badge.xml2
-rw-r--r--addons/hr/views/hr_employee_public_views.xml6
-rw-r--r--addons/hr/views/hr_employee_views.xml8
-rw-r--r--addons/hr/views/res_users.xml4
-rw-r--r--addons/hr_attendance/static/src/xml/attendance.xml6
-rw-r--r--addons/hr_attendance/views/hr_attendance_view.xml2
-rw-r--r--addons/hr_attendance/views/hr_employee_view.xml2
-rw-r--r--addons/hr_contract/views/hr_contract_views.xml4
-rw-r--r--addons/hr_expense/data/hr_expense_demo.xml4
-rw-r--r--addons/hr_expense/views/hr_expense_views.xml6
-rw-r--r--addons/hr_holidays/report/hr_leave_reports.xml2
-rw-r--r--addons/hr_holidays/views/hr_leave_allocation_views.xml4
-rw-r--r--addons/hr_holidays/views/hr_leave_views.xml4
-rw-r--r--addons/hr_maintenance/views/maintenance_views.xml2
-rw-r--r--addons/hr_org_chart/static/src/xml/hr_org_chart.xml6
-rw-r--r--addons/hr_recruitment/data/hr_recruitment_data.xml4
-rw-r--r--addons/hr_recruitment/views/hr_recruitment_views.xml2
-rw-r--r--addons/hr_timesheet/views/hr_timesheet_views.xml2
-rw-r--r--addons/hr_work_entry/views/hr_work_entry_views.xml2
-rw-r--r--addons/im_livechat/models/im_livechat_channel.py25
-rw-r--r--addons/im_livechat/views/im_livechat_channel_views.xml6
-rw-r--r--addons/im_livechat/views/mail_channel_views.xml2
-rw-r--r--addons/lunch/controllers/main.py2
-rw-r--r--addons/lunch/data/lunch_demo.xml44
-rw-r--r--addons/lunch/models/lunch_product.py28
-rw-r--r--addons/lunch/report/lunch_cashmove_report_views.xml2
-rw-r--r--addons/lunch/views/lunch_cashmove_views.xml2
-rw-r--r--addons/lunch/views/lunch_orders_views.xml2
-rw-r--r--addons/lunch/views/lunch_product_views.xml6
-rw-r--r--addons/lunch/wizard/lunch_line_wizard.py5
-rw-r--r--addons/lunch/wizard/lunch_line_wizard_views.xml2
-rw-r--r--addons/mail/controllers/main.py2
-rw-r--r--addons/mail/models/mail_channel.py23
-rw-r--r--addons/mail/models/mail_message.py2
-rw-r--r--addons/mail/static/src/js/composers/basic_composer.js2
-rw-r--r--addons/mail/static/src/js/followers.js4
-rw-r--r--addons/mail/static/src/js/models/messages/message.js2
-rw-r--r--addons/mail/static/src/js/models/threads/channel.js2
-rw-r--r--addons/mail/static/src/js/models/threads/dm_chat.js2
-rw-r--r--addons/mail/static/src/xml/activity.xml6
-rw-r--r--addons/mail/views/mail_channel_views.xml4
-rw-r--r--addons/mail/views/mail_message_views.xml2
-rw-r--r--addons/mail/views/res_partner_views.xml2
-rw-r--r--addons/mail_bot/data/mailbot_data.xml2
-rw-r--r--addons/mail_bot/views/res_users_views.xml2
-rw-r--r--addons/maintenance/views/maintenance_views.xml6
-rw-r--r--addons/mrp/data/mrp_demo.xml26
-rw-r--r--addons/mrp/views/ir_attachment_view.xml2
-rw-r--r--addons/mrp/views/mrp_workorder_views.xml2
-rw-r--r--addons/note/views/note_views.xml2
-rw-r--r--addons/partner_autocomplete/static/src/js/partner_autocomplete_fieldchar.js2
-rw-r--r--addons/partner_autocomplete/static/tests/partner_autocomplete_tests.js10
-rw-r--r--addons/payment/data/payment_acquirer_data.xml22
-rw-r--r--addons/payment/models/payment_acquirer.py17
-rw-r--r--addons/payment/views/payment_portal_templates.xml2
-rw-r--r--addons/payment/views/payment_views.xml4
-rw-r--r--addons/payment_adyen/data/payment_acquirer_data.xml2
-rw-r--r--addons/payment_authorize/data/payment_acquirer_data.xml2
-rw-r--r--addons/payment_buckaroo/data/payment_acquirer_data.xml2
-rw-r--r--addons/payment_ogone/data/payment_acquirer_data.xml2
-rw-r--r--addons/payment_paypal/data/payment_acquirer_data.xml2
-rw-r--r--addons/payment_payumoney/data/payment_acquirer_data.xml2
-rw-r--r--addons/payment_sips/data/payment_acquirer_data.xml2
-rw-r--r--addons/payment_stripe/data/payment_acquirer_data.xml2
-rw-r--r--addons/payment_transfer/data/payment_acquirer_data.xml2
-rw-r--r--addons/point_of_sale/data/point_of_sale_data.xml2
-rw-r--r--addons/point_of_sale/data/point_of_sale_demo.xml22
-rw-r--r--addons/point_of_sale/models/pos_category.py27
-rw-r--r--addons/point_of_sale/models/res_partner.py4
-rw-r--r--addons/point_of_sale/static/src/js/models.js2
-rw-r--r--addons/point_of_sale/static/src/js/screens.js6
-rw-r--r--addons/point_of_sale/views/pos_category_view.xml5
-rw-r--r--addons/point_of_sale/views/pos_session_view.xml2
-rw-r--r--addons/portal/static/src/xml/portal_chatter.xml2
-rw-r--r--addons/pos_restaurant/data/pos_restaurant_demo.xml36
-rw-r--r--addons/product/data/product_demo.xml52
-rw-r--r--addons/product/models/product.py103
-rw-r--r--addons/product/models/product_template.py17
-rw-r--r--addons/product/tests/test_variants.py24
-rw-r--r--addons/product/views/product_template_views.xml5
-rw-r--r--addons/product/views/product_views.xml9
-rw-r--r--addons/project/views/project_portal_templates.xml8
-rw-r--r--addons/project/views/project_rating_templates.xml8
-rw-r--r--addons/project/views/project_views.xml6
-rw-r--r--addons/purchase/views/portal_templates.xml2
-rw-r--r--addons/purchase_requisition/views/purchase_requisition_views.xml2
-rw-r--r--addons/sale/data/mail_data.xml2
-rw-r--r--addons/sale/data/sale_demo.xml2
-rw-r--r--addons/sale/models/product_template.py4
-rw-r--r--addons/sale/static/src/js/variant_mixin.js2
-rw-r--r--addons/sale/views/sale_portal_templates.xml4
-rw-r--r--addons/sale_product_configurator/data/sale_demo.xml2
-rw-r--r--addons/sale_product_configurator/static/src/js/product_configurator_modal.js4
-rw-r--r--addons/sale_product_configurator/views/templates.xml12
-rw-r--r--addons/sales_team/views/crm_team_views.xml2
-rw-r--r--addons/stock/data/stock_demo.xml2
-rw-r--r--addons/stock/data/stock_demo2.xml2
-rw-r--r--addons/stock_landed_costs/views/stock_landed_cost_views.xml2
-rw-r--r--addons/stock_picking_batch/views/stock_picking_batch_views.xml2
-rw-r--r--addons/survey/views/gamification_badge_views.xml2
-rw-r--r--addons/survey/views/survey_templates.xml2
-rw-r--r--addons/web/controllers/main.py2
-rw-r--r--addons/web/static/src/js/chrome/user_menu.js2
-rw-r--r--addons/web/static/src/js/fields/basic_fields.js2
-rw-r--r--addons/web/static/src/js/views/calendar/calendar_view.js2
-rw-r--r--addons/web/tests/test_image.py6
-rw-r--r--addons/website/tests/template_qweb_test.xml2
-rw-r--r--addons/website/tests/test_qweb.py2
-rw-r--r--addons/website_blog/models/website_blog.py2
-rw-r--r--addons/website_blog/static/src/js/website_blog.editor.js2
-rw-r--r--addons/website_blog/views/website_blog_views.xml2
-rw-r--r--addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml4
-rw-r--r--addons/website_customer/views/website_customer_templates.xml6
-rw-r--r--addons/website_event_track/models/event_track.py4
-rw-r--r--addons/website_event_track/views/event_track_templates.xml6
-rw-r--r--addons/website_event_track/views/event_track_views.xml2
-rw-r--r--addons/website_forum/models/forum.py2
-rw-r--r--addons/website_forum/views/forum.xml2
-rw-r--r--addons/website_forum/views/website_forum.xml12
-rw-r--r--addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml2
-rw-r--r--addons/website_livechat/views/website_livechat.xml8
-rw-r--r--addons/website_mail_channel/views/website_mail_channel_templates.xml2
-rw-r--r--addons/website_membership/views/website_membership_templates.xml2
-rw-r--r--addons/website_partner/views/website_partner_templates.xml2
-rw-r--r--addons/website_profile/controllers/main.py4
-rw-r--r--addons/website_profile/views/website_profile.xml20
-rw-r--r--addons/website_sale/data/mail_template_data.xml2
-rw-r--r--addons/website_sale/models/product.py31
-rw-r--r--addons/website_sale/models/product_image.py11
-rw-r--r--addons/website_sale/static/src/js/website_sale.js4
-rw-r--r--addons/website_sale/static/src/scss/website_sale_frontend.scss2
-rw-r--r--addons/website_sale/static/src/xml/website_sale_utils.xml2
-rw-r--r--addons/website_sale/tests/test_website_sale_image.py106
-rw-r--r--addons/website_sale/views/product_views.xml14
-rw-r--r--addons/website_sale/views/templates.xml20
-rw-r--r--addons/website_sale_comparison/views/website_sale_comparison_template.xml4
-rw-r--r--addons/website_sale_digital/data/product_demo.xml2
-rw-r--r--addons/website_sale_slides/data/website_sale_slides_demo.xml8
-rw-r--r--addons/website_sale_wishlist/views/website_sale_wishlist_template.xml2
-rw-r--r--addons/website_slides/controllers/main.py8
-rw-r--r--addons/website_slides/data/gamification_data.xml10
-rw-r--r--addons/website_slides/data/mail_data.xml4
-rw-r--r--addons/website_slides/data/slide_channel_demo.xml14
-rw-r--r--addons/website_slides/data/slide_slide_demo.xml30
-rw-r--r--addons/website_slides/models/slide_slide.py16
-rw-r--r--addons/website_slides/static/src/js/slides_course_fullscreen_player.js2
-rw-r--r--addons/website_slides/static/src/xml/website_slides_fullscreen.xml2
-rw-r--r--addons/website_slides/views/slide_channel_views.xml2
-rw-r--r--addons/website_slides/views/slide_slide_views.xml2
-rw-r--r--addons/website_slides/views/website_slides_templates_course.xml8
-rw-r--r--addons/website_slides/views/website_slides_templates_homepage.xml12
-rw-r--r--addons/website_slides/views/website_slides_templates_lesson.xml6
-rw-r--r--addons/website_slides/views/website_slides_templates_lesson_embed.xml6
-rw-r--r--addons/website_slides/views/website_slides_templates_profile.xml2
-rw-r--r--addons/website_slides_survey/data/slide_slide_demo.xml4
-rw-r--r--addons/website_slides_survey/views/website_profile.xml2
185 files changed, 699 insertions, 877 deletions
diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml
index a59a00f0e8d..11e539aa60b 100644
--- a/addons/account/views/account_move_views.xml
+++ b/addons/account/views/account_move_views.xml
@@ -103,7 +103,7 @@
<span t-esc="record.name.value"/>
</div>
<div class="col-2 text-right">
- <img t-att-src="kanban_image('res.partner', 'image_small', record.partner_id.raw_value)" t-att-title="record.partner_id.value" t-att-alt="record.partner_id.value" width="24" height="24" class="oe_kanban_avatar"/>
+ <img t-att-src="kanban_image('res.partner', 'image_64', record.partner_id.raw_value)" t-att-title="record.partner_id.value" t-att-alt="record.partner_id.value" width="24" height="24" class="oe_kanban_avatar"/>
</div>
</div>
</div>
diff --git a/addons/account/views/account_portal_templates.xml b/addons/account/views/account_portal_templates.xml
index 25cd8c84e34..e4705746870 100644
--- a/addons/account/views/account_portal_templates.xml
+++ b/addons/account/views/account_portal_templates.xml
@@ -108,7 +108,7 @@
<div class="small mb-1"><strong class="text-muted">Salesperson</strong></div>
<div class="row">
<div class="col flex-grow-0 pr-2">
- <img t-if="invoice.invoice_user_id.image" class="rounded-circle mt-1 o_portal_contact_img" t-att-src="image_data_uri(invoice.invoice_user_id.image)" alt="Contact"/>
+ <img t-if="invoice.invoice_user_id.image_1024" class="rounded-circle mt-1 o_portal_contact_img" t-att-src="image_data_uri(invoice.invoice_user_id.image_1024)" alt="Contact"/>
<img t-else="" class="rounded-circle mt-1 o_portal_contact_img" src="/web/static/src/img/user_menu_avatar.png" alt="Contact"/>
</div>
<div class="col pl-0">
diff --git a/addons/account_analytic_default/views/account_analytic_default_view.xml b/addons/account_analytic_default/views/account_analytic_default_view.xml
index f86ba13a513..ab568e3cd96 100644
--- a/addons/account_analytic_default/views/account_analytic_default_view.xml
+++ b/addons/account_analytic_default/views/account_analytic_default_view.xml
@@ -59,7 +59,7 @@
<div t-attf-class="oe_kanban_card oe_kanban_global_click">
<div>
<strong><span><field name="analytic_id"/></span></strong>
- <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
+ <img t-att-src="kanban_image('res.users', 'image_64', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
</div>
<div t-if="record.date_start.value"><i class="fa fa-calendar"></i> From <field name="date_start"/> <t t-if="record.date_stop.value">to <field name="date_stop"/></t></div>
<div t-if="record.product_id.value"><strong>Product</strong> <field name="product_id"/> </div>
diff --git a/addons/calendar/views/calendar_views.xml b/addons/calendar/views/calendar_views.xml
index ff19273d798..e6845169f79 100644
--- a/addons/calendar/views/calendar_views.xml
+++ b/addons/calendar/views/calendar_views.xml
@@ -275,7 +275,7 @@
event_limit="3"
color="partner_id">
<field name="name"/>
- <field name="partner_ids" write_model="calendar.contacts" write_field="partner_id" avatar_field="image_small"/>
+ <field name="partner_ids" write_model="calendar.contacts" write_field="partner_id" avatar_field="image_64"/>
<field name="is_highlighted" invisible="1"/>
</calendar>
</field>
diff --git a/addons/crm/models/crm_lead.py b/addons/crm/models/crm_lead.py
index d033a750ed2..cbc347a6675 100644
--- a/addons/crm/models/crm_lead.py
+++ b/addons/crm/models/crm_lead.py
@@ -532,7 +532,7 @@ class Lead(models.Model):
'effect': {
'fadeout': 'slow',
'message': message,
- 'img_url': '/web/image/%s/%s/image' % (self.team_id.user_id._name, self.team_id.user_id.id) if self.team_id.user_id.image else '/web/static/src/img/smile.svg',
+ 'img_url': '/web/image/%s/%s/image_1024' % (self.team_id.user_id._name, self.team_id.user_id.id) if self.team_id.user_id.image_1024 else '/web/static/src/img/smile.svg',
'type': 'rainbow_man',
}
}
diff --git a/addons/crm/views/crm_lead_views.xml b/addons/crm/views/crm_lead_views.xml
index a10ba85000f..56822dfe6c3 100644
--- a/addons/crm/views/crm_lead_views.xml
+++ b/addons/crm/views/crm_lead_views.xml
@@ -247,7 +247,7 @@
</div>
</div>
<div class="oe_kanban_bottom_right">
- <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
+ <img t-att-src="kanban_image('res.users', 'image_64', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
</div>
</div>
</div>
@@ -355,7 +355,7 @@
<field name="company_currency"/>
<templates>
<div t-name="activity-box">
- <img t-att-src="activity_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value"/>
+ <img t-att-src="activity_image('res.users', 'image_64', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value"/>
<div>
<field name="name" display="full"/>
<field name="planned_revenue" widget="monetary" display="full" muted="1"/>
@@ -424,7 +424,7 @@
<field name="activity_ids" widget="kanban_activity"/>
</div>
<div class="oe_kanban_bottom_right">
- <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar"/>
+ <img t-att-src="kanban_image('res.users', 'image_64', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar"/>
</div>
</div>
</div>
diff --git a/addons/event_sale/models/event.py b/addons/event_sale/models/event.py
index ba407dc8f60..98485e5dd1d 100644
--- a/addons/event_sale/models/event.py
+++ b/addons/event_sale/models/event.py
@@ -239,8 +239,8 @@ class EventRegistration(models.Model):
def summary(self):
res = super(EventRegistration, self).summary()
- if self.event_ticket_id.product_id.image_medium:
- res['image'] = '/web/image/product.product/%s/image_medium' % self.event_ticket_id.product_id.id
+ if self.event_ticket_id.product_id.image_128:
+ res['image'] = '/web/image/product.product/%s/image_128' % self.event_ticket_id.product_id.id
information = res.setdefault('information', {})
information.append((_('Name'), self.name))
information.append((_('Ticket'), self.event_ticket_id.name or _('None')))
diff --git a/addons/fleet/data/fleet_cars_data.xml b/addons/fleet/data/fleet_cars_data.xml
index c2f4c011ddc..a3ca54750df 100644
--- a/addons/fleet/data/fleet_cars_data.xml
+++ b/addons/fleet/data/fleet_cars_data.xml
@@ -2,267 +2,267 @@
<odoo>
<record id="brand_abarth" model="fleet.vehicle.model.brand">
<field name="name">Abarth</field>
- <field name="image" type="base64" file="fleet/static/img/brand_abarth-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_abarth-image.png"/>
</record>
<record id="brand_acura" model="fleet.vehicle.model.brand">
<field name="name">Acura</field>
- <field name="image" type="base64" file="fleet/static/img/brand_acura-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_acura-image.png"/>
</record>
<record id="brand_alfa" model="fleet.vehicle.model.brand">
<field name="name">Alfa</field>
- <field name="image" type="base64" file="fleet/static/img/brand_alfa-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_alfa-image.png"/>
</record>
<record id="brand_audi" model="fleet.vehicle.model.brand">
<field name="name">Audi</field>
- <field name="image" type="base64" file="fleet/static/img/brand_audi-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_audi-image.png"/>
</record>
<record id="brand_austin" model="fleet.vehicle.model.brand">
<field name="name">Austin</field>
- <field name="image" type="base64" file="fleet/static/img/brand_austin-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_austin-image.png"/>
</record>
<record id="brand_bentley" model="fleet.vehicle.model.brand">
<field name="name">Bentley</field>
- <field name="image" type="base64" file="fleet/static/img/brand_bentley-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_bentley-image.png"/>
</record>
<record id="brand_bmw" model="fleet.vehicle.model.brand">
<field name="name">Bmw</field>
- <field name="image" type="base64" file="fleet/static/img/brand_bmw-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_bmw-image.png"/>
</record>
<record id="brand_bugatti" model="fleet.vehicle.model.brand">
<field name="name">Bugatti</field>
- <field name="image" type="base64" file="fleet/static/img/brand_bugatti-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_bugatti-image.png"/>
</record>
<record id="brand_buick" model="fleet.vehicle.model.brand">
<field name="name">Buick</field>
- <field name="image" type="base64" file="fleet/static/img/brand_buick-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_buick-image.png"/>
</record>
<record id="brand_byd" model="fleet.vehicle.model.brand">
<field name="name">Byd</field>
- <field name="image" type="base64" file="fleet/static/img/brand_byd-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_byd-image.png"/>
</record>
<record id="brand_cadillac" model="fleet.vehicle.model.brand">
<field name="name">Cadillac</field>
- <field name="image" type="base64" file="fleet/static/img/brand_cadillac-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_cadillac-image.png"/>
</record>
<record id="brand_chevrolet" model="fleet.vehicle.model.brand">
<field name="name">Chevrolet</field>
- <field name="image" type="base64" file="fleet/static/img/brand_chevrolet-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_chevrolet-image.png"/>
</record>
<record id="brand_chrysler" model="fleet.vehicle.model.brand">
<field name="name">Chrysler</field>
- <field name="image" type="base64" file="fleet/static/img/brand_chrysler-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_chrysler-image.png"/>
</record>
<record id="brand_citroen" model="fleet.vehicle.model.brand">
<field name="name">Citroen</field>
- <field name="image" type="base64" file="fleet/static/img/brand_citroen-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_citroen-image.png"/>
</record>
<record id="brand_corre_la_licorne" model="fleet.vehicle.model.brand">
<field name="name">Corre La Licorne</field>
- <field name="image" type="base64" file="fleet/static/img/brand_corre-la-licorne-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_corre-la-licorne-image.png"/>
</record>
<record id="brand_daewoo" model="fleet.vehicle.model.brand">
<field name="name">Daewoo</field>
- <field name="image" type="base64" file="fleet/static/img/brand_daewoo-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_daewoo-image.png"/>
</record>
<record id="brand_dodge" model="fleet.vehicle.model.brand">
<field name="name">Dodge</field>
- <field name="image" type="base64" file="fleet/static/img/brand_dodge-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_dodge-image.png"/>
</record>
<record id="brand_ferrari" model="fleet.vehicle.model.brand">
<field name="name">Ferrari</field>
- <field name="image" type="base64" file="fleet/static/img/brand_ferrari-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_ferrari-image.png"/>
</record>
<record id="brand_fiat" model="fleet.vehicle.model.brand">
<field name="name">Fiat</field>
- <field name="image" type="base64" file="fleet/static/img/brand_fiat-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_fiat-image.png"/>
</record>
<record id="brand_ford" model="fleet.vehicle.model.brand">
<field name="name">Ford</field>
- <field name="image" type="base64" file="fleet/static/img/brand_ford-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_ford-image.png"/>
</record>
<record id="brand_holden" model="fleet.vehicle.model.brand">
<field name="name">Holden</field>
- <field name="image" type="base64" file="fleet/static/img/brand_holden-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_holden-image.png"/>
</record>
<record id="brand_honda" model="fleet.vehicle.model.brand">
<field name="name">Honda</field>
- <field name="image" type="base64" file="fleet/static/img/brand_honda-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_honda-image.png"/>
</record>
<record id="brand_hyundai" model="fleet.vehicle.model.brand">
<field name="name">Hyundai</field>
- <field name="image" type="base64" file="fleet/static/img/brand_hyundai-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_hyundai-image.png"/>
</record>
<record id="brand_infiniti" model="fleet.vehicle.model.brand">
<field name="name">Infiniti</field>
- <field name="image" type="base64" file="fleet/static/img/brand_infiniti-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_infiniti-image.png"/>
</record>
<record id="brand_isuzu" model="fleet.vehicle.model.brand">
<field name="name">Isuzu</field>
- <field name="image" type="base64" file="fleet/static/img/brand_isuzu-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_isuzu-image.png"/>
</record>
<record id="brand_jaguar" model="fleet.vehicle.model.brand">
<field name="name">Jaguar</field>
- <field name="image" type="base64" file="fleet/static/img/brand_jaguar-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_jaguar-image.png"/>
</record>
<record id="brand_jeep" model="fleet.vehicle.model.brand">
<field name="name">Jeep</field>
- <field name="image" type="base64" file="fleet/static/img/brand_jeep-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_jeep-image.png"/>
</record>
<record id="brand_kia" model="fleet.vehicle.model.brand">
<field name="name">Kia</field>
- <field name="image" type="base64" file="fleet/static/img/brand_kia-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_kia-image.png"/>
</record>
<record id="brand_koenigsegg" model="fleet.vehicle.model.brand">
<field name="name">Koenigsegg</field>
- <field name="image" type="base64" file="fleet/static/img/brand_koenigsegg-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_koenigsegg-image.png"/>
</record>
<record id="brand_lagonda" model="fleet.vehicle.model.brand">
<field name="name">Lagonda</field>
- <field name="image" type="base64" file="fleet/static/img/brand_lagonda-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_lagonda-image.png"/>
</record>
<record id="brand_lamborghini" model="fleet.vehicle.model.brand">
<field name="name">Lamborghini</field>
- <field name="image" type="base64" file="fleet/static/img/brand_lamborghini-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_lamborghini-image.png"/>
</record>
<record id="brand_lancia" model="fleet.vehicle.model.brand">
<field name="name">Lancia</field>
- <field name="image" type="base64" file="fleet/static/img/brand_lancia-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_lancia-image.png"/>
</record>
<record id="brand_land_rover" model="fleet.vehicle.model.brand">
<field name="name">Land Rover</field>
- <field name="image" type="base64" file="fleet/static/img/brand_land-rover-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_land-rover-image.png"/>
</record>
<record id="brand_lexus" model="fleet.vehicle.model.brand">
<field name="name">Lexus</field>
- <field name="image" type="base64" file="fleet/static/img/brand_lexus-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_lexus-image.png"/>
</record>
<record id="brand_lincoln" model="fleet.vehicle.model.brand">
<field name="name">Lincoln</field>
- <field name="image" type="base64" file="fleet/static/img/brand_lincoln-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_lincoln-image.png"/>
</record>
<record id="brand_lotus" model="fleet.vehicle.model.brand">
<field name="name">Lotus</field>
- <field name="image" type="base64" file="fleet/static/img/brand_lotus-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_lotus-image.png"/>
</record>
<record id="brand_maserati" model="fleet.vehicle.model.brand">
<field name="name">Maserati</field>
- <field name="image" type="base64" file="fleet/static/img/brand_maserati-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_maserati-image.png"/>
</record>
<record id="brand_maybach" model="fleet.vehicle.model.brand">
<field name="name">Maybach</field>
- <field name="image" type="base64" file="fleet/static/img/brand_maybach-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_maybach-image.png"/>
</record>
<record id="brand_mazda" model="fleet.vehicle.model.brand">
<field name="name">Mazda</field>
- <field name="image" type="base64" file="fleet/static/img/brand_mazda-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_mazda-image.png"/>
</record>
<record id="brand_mercedes" model="fleet.vehicle.model.brand">
<field name="name">Mercedes</field>
- <field name="image" type="base64" file="fleet/static/img/brand_mercedes-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_mercedes-image.png"/>
</record>
<record id="brand_mg" model="fleet.vehicle.model.brand">
<field name="name">Mg</field>
- <field name="image" type="base64" file="fleet/static/img/brand_mg-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_mg-image.png"/>
</record>
<record id="brand_mini" model="fleet.vehicle.model.brand">
<field name="name">Mini</field>
- <field name="image" type="base64" file="fleet/static/img/brand_mini-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_mini-image.png"/>
</record>
<record id="brand_mitsubishi" model="fleet.vehicle.model.brand">
<field name="name">Mitsubishi</field>
- <field name="image" type="base64" file="fleet/static/img/brand_mitsubishi-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_mitsubishi-image.png"/>
</record>
<record id="brand_morgan" model="fleet.vehicle.model.brand">
<field name="name">Morgan</field>
- <field name="image" type="base64" file="fleet/static/img/brand_morgan-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_morgan-image.png"/>
</record>
<record id="brand_nissan" model="fleet.vehicle.model.brand">
<field name="name">Nissan</field>
- <field name="image" type="base64" file="fleet/static/img/brand_nissan-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_nissan-image.png"/>
</record>
<record id="brand_oldsmobile" model="fleet.vehicle.model.brand">
<field name="name">Oldsmobile</field>
- <field name="image" type="base64" file="fleet/static/img/brand_oldsmobile-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_oldsmobile-image.png"/>
</record>
<record id="brand_opel" model="fleet.vehicle.model.brand">
<field name="name">Opel</field>
- <field name="image" type="base64" file="fleet/static/img/brand_opel-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_opel-image.png"/>
</record>
<record id="brand_peugeot" model="fleet.vehicle.model.brand">
<field name="name">Peugeot</field>
- <field name="image" type="base64" file="fleet/static/img/brand_peugeot-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_peugeot-image.png"/>
</record>
<record id="brand_pontiac" model="fleet.vehicle.model.brand">
<field name="name">Pontiac</field>
- <field name="image" type="base64" file="fleet/static/img/brand_pontiac-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_pontiac-image.png"/>
</record>
<record id="brand_porsche" model="fleet.vehicle.model.brand">
<field name="name">Porsche</field>
- <field name="image" type="base64" file="fleet/static/img/brand_porsche-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_porsche-image.png"/>
</record>
<record id="brand_rambler" model="fleet.vehicle.model.brand">
<field name="name">Rambler</field>
- <field name="image" type="base64" file="fleet/static/img/brand_rambler-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_rambler-image.png"/>
</record>
<record id="brand_renault" model="fleet.vehicle.model.brand">
<field name="name">Renault</field>
- <field name="image" type="base64" file="fleet/static/img/brand_renault-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_renault-image.png"/>
</record>
<record id="brand_rolls-royce" model="fleet.vehicle.model.brand">
<field name="name">Rolls-Royce</field>
- <field name="image" type="base64" file="fleet/static/img/brand_rolls-royce-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_rolls-royce-image.png"/>
</record>
<record id="brand_saab" model="fleet.vehicle.model.brand">
<field name="name">Saab</field>
- <field name="image" type="base64" file="fleet/static/img/brand_saab-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_saab-image.png"/>
</record>
<record id="brand_scion" model="fleet.vehicle.model.brand">
<field name="name">Scion</field>
- <field name="image" type="base64" file="fleet/static/img/brand_scion-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_scion-image.png"/>
</record>
<record id="brand_skoda" model="fleet.vehicle.model.brand">
<field name="name">Skoda</field>
- <field name="image" type="base64" file="fleet/static/img/brand_skoda-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_skoda-image.png"/>
</record>
<record id="brand_smart" model="fleet.vehicle.model.brand">
<field name="name">Smart</field>
- <field name="image" type="base64" file="fleet/static/img/brand_smart-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_smart-image.png"/>
</record>
<record id="brand_steyr" model="fleet.vehicle.model.brand">
<field name="name">Steyr</field>
- <field name="image" type="base64" file="fleet/static/img/brand_steyr-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_steyr-image.png"/>
</record>
<record id="brand_subaru" model="fleet.vehicle.model.brand">
<field name="name">Subaru</field>
- <field name="image" type="base64" file="fleet/static/img/brand_subaru-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_subaru-image.png"/>
</record>
<record id="brand_tesla_motors" model="fleet.vehicle.model.brand">
<field name="name">Tesla Motors</field>
- <field name="image" type="base64" file="fleet/static/img/brand_tesla-motors-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_tesla-motors-image.png"/>
</record>
<record id="brand_toyota" model="fleet.vehicle.model.brand">
<field name="name">Toyota</field>
- <field name="image" type="base64" file="fleet/static/img/brand_toyota-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_toyota-image.png"/>
</record>
<record id="brand_trabant" model="fleet.vehicle.model.brand">
<field name="name">Trabant</field>
- <field name="image" type="base64" file="fleet/static/img/brand_trabant-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_trabant-image.png"/>
</record>
<record id="brand_volkswagen" model="fleet.vehicle.model.brand">
<field name="name">Volkswagen</field>
- <field name="image" type="base64" file="fleet/static/img/brand_volkswagen-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_volkswagen-image.png"/>
</record>
<record id="brand_volvo" model="fleet.vehicle.model.brand">
<field name="name">Volvo</field>
- <field name="image" type="base64" file="fleet/static/img/brand_volvo-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_volvo-image.png"/>
</record>
<record id="brand_willys" model="fleet.vehicle.model.brand">
<field name="name">Willys</field>
- <field name="image" type="base64" file="fleet/static/img/brand_willys-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_willys-image.png"/>
</record>
<record id="brand_suzuki" model="fleet.vehicle.model.brand">
<field name="name">Suzuki</field>
- <field name="image" type="base64" file="fleet/static/img/brand_suzuki-image.png"/>
+ <field name="image_128" type="base64" file="fleet/static/img/brand_suzuki-image.png"/>
</record>
<record id="model_corsa" model="fleet.vehicle.model">
<field name="name">Corsa</field>
diff --git a/addons/fleet/models/fleet_vehicle.py b/addons/fleet/models/fleet_vehicle.py
index 3a713a0140e..ce22e580d7c 100644
--- a/addons/fleet/models/fleet_vehicle.py
+++ b/addons/fleet/models/fleet_vehicle.py
@@ -72,9 +72,7 @@ class FleetVehicle(models.Model):
horsepower_tax = fields.Float('Horsepower Taxation')
power = fields.Integer('Power', help='Power in kW of the vehicle')
co2 = fields.Float('CO2 Emissions', help='CO2 emissions of the vehicle')
- image = fields.Binary(related='model_id.image', string="Logo", readonly=False)
- image_medium = fields.Binary(related='model_id.image_medium', string="Logo (medium)", readonly=False)
- image_small = fields.Binary(related='model_id.image_small', string="Logo (small)", readonly=False)
+ image_128 = fields.Image(related='model_id.image_128', readonly=False)
contract_renewal_due_soon = fields.Boolean(compute='_compute_contract_reminder', search='_search_contract_renewal_due_soon',
string='Has Contracts to renew', multi='contract_info')
contract_renewal_overdue = fields.Boolean(compute='_compute_contract_reminder', search='_search_get_overdue_contract_reminder',
@@ -203,13 +201,6 @@ class FleetVehicle(models.Model):
res.append(('id', search_operator, res_ids))
return res
- @api.onchange('model_id')
- def _onchange_model(self):
- if self.model_id:
- self.image_medium = self.model_id.image
- else:
- self.image_medium = False
-
@api.model
def create(self, vals):
res = super(FleetVehicle, self).create(vals)
diff --git a/addons/fleet/models/fleet_vehicle_model.py b/addons/fleet/models/fleet_vehicle_model.py
index e945da2ac71..ab6981c7600 100644
--- a/addons/fleet/models/fleet_vehicle_model.py
+++ b/addons/fleet/models/fleet_vehicle_model.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from odoo import api, fields, models, tools
+from odoo import api, fields, models
class FleetVehicleModel(models.Model):
@@ -14,9 +14,7 @@ class FleetVehicleModel(models.Model):
vendors = fields.Many2many('res.partner', 'fleet_vehicle_model_vendors', 'model_id', 'partner_id', string='Vendors')
manager_id = fields.Many2one('res.users', 'Fleet Manager', default=lambda self: self.env.uid,
domain=lambda self: [('groups_id', 'in', self.env.ref('fleet.fleet_group_manager').id)])
- image = fields.Binary(related='brand_id.image', string="Logo", readonly=False)
- image_medium = fields.Binary(related='brand_id.image_medium', string="Logo (medium)", readonly=False)
- image_small = fields.Binary(related='brand_id.image_small', string="Logo (small)", readonly=False)
+ image_128 = fields.Image(related='brand_id.image_128', readonly=False)
@api.depends('name', 'brand_id')
def name_get(self):
@@ -28,13 +26,6 @@ class FleetVehicleModel(models.Model):
res.append((record.id, name))
return res
- @api.onchange('brand_id')
- def _onchange_brand(self):
- if self.brand_id:
- self.image_medium = self.brand_id.image
- else:
- self.image_medium = False
-
class FleetVehicleModelBrand(models.Model):
_name = 'fleet.vehicle.model.brand'
@@ -42,23 +33,4 @@ class FleetVehicleModelBrand(models.Model):
_order = 'name asc'
name = fields.Char('Make', required=True)
- image = fields.Binary("Logo",
- help="This field holds the image used as logo for the brand, limited to 1024x1024px.")
- image_medium = fields.Binary("Medium-sized image",
- help="Medium-sized logo of the brand. 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",
- help="Small-sized logo of the brand. It is automatically "
- "resized as a 64x64px image, with aspect ratio preserved. "
- "Use this field anywhere a small image is required.")
-
- @api.model_create_multi
- def create(self, vals_list):
- for vals in vals_list:
- tools.image_resize_images(vals)
- return super(FleetVehicleModelBrand, self).create(vals_list)
-
- def write(self, vals):
- tools.image_resize_images(vals)
- return super(FleetVehicleModelBrand, self).write(vals)
+ image_128 = fields.Image("Logo", max_width=128, max_height=128)
diff --git a/addons/fleet/views/fleet_vehicle_cost_views.xml b/addons/fleet/views/fleet_vehicle_cost_views.xml
index a21159c3611..211c1910020 100644
--- a/addons/fleet/views/fleet_vehicle_cost_views.xml
+++ b/addons/fleet/views/fleet_vehicle_cost_views.xml
@@ -365,7 +365,7 @@
<field name="purchaser_id"/>
<templates>
<div t-name="activity-box">
- <img t-att-src="activity_image('res.partner', 'image_small', record.purchaser_id.raw_value)" t-att-title="record.purchaser_id.value" t-att-alt="record.purchaser_id.value"/>
+ <img t-att-src="activity_image('res.partner', 'image_64', record.purchaser_id.raw_value)" t-att-title="record.purchaser_id.value" t-att-alt="record.purchaser_id.value"/>
<div>
<field name="vehicle_id" display="full"/>
<field name="cost_subtype_id" muted="1" display="full"/>
diff --git a/addons/fleet/views/fleet_vehicle_model_views.xml b/addons/fleet/views/fleet_vehicle_model_views.xml
index ecb8741ec98..862d8eb111f 100644
--- a/addons/fleet/views/fleet_vehicle_model_views.xml
+++ b/addons/fleet/views/fleet_vehicle_model_views.xml
@@ -6,7 +6,7 @@
<field name="arch" type="xml">
<form string="Model">
<sheet>
- <field name="image_medium" widget='image' class="oe_avatar"/>
+ <field name="image_128" widget='image' class="oe_avatar"/>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
@@ -106,7 +106,7 @@
<sheet>
<group>
<div>
- <field name="image_medium" widget="image" class="oe_avatar"/>
+ <field name="image_128" widget="image" class="oe_avatar"/>
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name"/>
@@ -125,12 +125,11 @@
<kanban>
<field name="id"/>
<field name="name" />
- <field name="image" />
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_vignette oe_semantic_html_override">
<a type="open" href="#" class="o_kanban_image oe_kanban_action">
- <img alt="Open" t-att-src="kanban_image('fleet.vehicle.model.brand', 'image_small', record.id.raw_value)" class="img-fluid" style="width:100px;"/>
+ <img alt="Open" t-att-src="kanban_image('fleet.vehicle.model.brand', 'image_128', record.id.raw_value)" class="img-fluid" style="width:100px;"/>
</a>
<div class="oe_kanban_details">
<h4 class="oe_partner_heading">
diff --git a/addons/fleet/views/fleet_vehicle_views.xml b/addons/fleet/views/fleet_vehicle_views.xml
index 8c3c6090340..68616c60855 100644
--- a/addons/fleet/views/fleet_vehicle_views.xml
+++ b/addons/fleet/views/fleet_vehicle_views.xml
@@ -60,7 +60,7 @@
<field name="odometer_count" widget="statinfo" string="Odometer"/>
</button>
</div>
- <field name="image_medium" widget='image' class="oe_avatar"/>
+ <field name="image_128" widget='image' class="oe_avatar"/>
<div class="oe_title">
<label for="model_id" class="oe_edit_only"/>
<h1>
@@ -210,7 +210,6 @@
<field name="location" />
<field name="state_id" />
<field name="id" />
- <field name="image" />
<field name="tag_ids" />
<field name="contract_renewal_due_soon" />
<field name="contract_renewal_overdue" />
@@ -225,7 +224,7 @@
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="o_kanban_image">
- <img t-att-src="kanban_image('fleet.vehicle', 'image_small', record.id.raw_value)" alt="Vehicle"/>
+ <img t-att-src="kanban_image('fleet.vehicle', 'image_128', record.id.raw_value)" alt="Vehicle"/>
</div>
<div class="oe_kanban_details">
<strong class="o_kanban_record_title">
@@ -279,7 +278,7 @@
<field name="id"/>
<templates>
<div t-name="activity-box">
- <img t-att-src="activity_image('fleet.vehicle', 'image_small', record.id.raw_value)" role="img" t-att-title="record.id.value" t-att-alt="record.id.value"/>
+ <img t-att-src="activity_image('fleet.vehicle', 'image_128', record.id.raw_value)" role="img" t-att-title="record.id.value" t-att-alt="record.id.value"/>
<div>
<field name="license_plate"/> : <field name="model_id"/>
</div>
diff --git a/addons/gamification/data/badge.xml b/addons/gamification/data/badge.xml
index 06476e98066..696e3fabec7 100644
--- a/addons/gamification/data/badge.xml
+++ b/addons/gamification/data/badge.xml
@@ -5,21 +5,21 @@
<field name="name">Good Job</field>
<field name="description">You did great at your job.</field>
<field name="rule_auth">everyone</field>
- <field name="image" type="base64" file="gamification/static/img/badge_good_job-image.png"/>
+ <field name="image_1920" type="base64" file="gamification/static/img/badge_good_job-image.png"/>
</record>
<record id="badge_problem_solver" model="gamification.badge">
<field name="name">Problem Solver</field>
<field name="description">No one can solve challenges like you do.</field>
<field name="rule_auth">everyone</field>
- <field name="image" type="base64" file="gamification/static/img/badge_problem_solver-image.png"/>
+ <field name="image_1920" type="base64" file="gamification/static/img/badge_problem_solver-image.png"/>
</record>
<record id="badge_hidden" model="gamification.badge">
<field name="name">Hidden</field>
<field name="description">You have found the hidden badge</field>
<field name="rule_auth">nobody</field>
- <field name="image" type="base64" file="gamification/static/img/badge_hidden-image.png"/>
+ <field name="image_1920" type="base64" file="gamification/static/img/badge_hidden-image.png"/>
<field name="active" eval="False" />
</record>
@@ -29,7 +29,7 @@
<field name="rule_auth">everyone</field>
<field name="rule_max">True</field>
<field name="rule_max_number">2</field>
- <field name="image" type="base64" file="gamification/static/img/badge_idea-image.png"/>
+ <field name="image_1920" type="base64" file="gamification/static/img/badge_idea-image.png"/>
</record>
<record id="email_template_badge_received" model="mail.template">
@@ -71,7 +71,7 @@
<table cellspacing="0" cellpadding="0" border="0" style="width: 560px; margin-top: 5px;">
<tbody><tr>
<td valign="center">
- <img src="/web/image/gamification.badge/${object.badge_id.id}/image/80x80" style="padding: 0px; margin: 0px; height: auto; width: 80px;" alt="${user.company_id.name}"/>
+ <img src="/web/image/gamification.badge/${object.badge_id.id}/image_128/80x80" style="padding: 0px; margin: 0px; height: auto; width: 80px;" alt="${user.company_id.name}"/>
</td>
<td valign="center">
<cite>${object.badge_id.description}</cite>
diff --git a/addons/gamification/data/gamification_karma_rank_data.xml b/addons/gamification/data/gamification_karma_rank_data.xml
index 5eba07b1a3d..e0ef1320a4e 100644
--- a/addons/gamification/data/gamification_karma_rank_data.xml
+++ b/addons/gamification/data/gamification_karma_rank_data.xml
@@ -19,7 +19,7 @@
</div>
</field>
<field name="karma_min">1</field>
- <field name="image" type="base64" file="gamification/static/img/rank_newbie_badge.svg"/>
+ <field name="image_1920" type="base64" file="gamification/static/img/rank_newbie_badge.svg"/>
</record>
<record id="rank_student" model="gamification.karma.rank">
@@ -32,7 +32,7 @@
</div>
</field>
<field name="karma_min">100</field>
- <field name="image" type="base64" file="gamification/static/img/rank_student_badge.svg"/>
+ <field name="image_1920" type="base64" file="gamification/static/img/rank_student_badge.svg"/>
</record>
<record id="rank_bachelor" model="gamification.karma.rank">
@@ -45,7 +45,7 @@
</div>
</field>
<field name="karma_min">500</field>
- <field name="image" type="base64" file="gamification/static/img/rank_bachelor_badge.svg"/>
+ <field name="image_1920" type="base64" file="gamification/static/img/rank_bachelor_badge.svg"/>
</record>
<record id="rank_master" model="gamification.karma.rank">
@@ -58,7 +58,7 @@
</div>
</field>
<field name="karma_min">2000</field>
- <field name="image" type="base64" file="gamification/static/img/rank_master_badge.svg"/>
+ <field name="image_1920" type="base64" file="gamification/static/img/rank_master_badge.svg"/>
</record>
<record id="rank_doctor" model="gamification.karma.rank">
@@ -71,6 +71,6 @@
</div>
</field>
<field name="karma_min">10000</field>
- <field name="image" type="base64" file="gamification/static/img/rank_doctor_badge.svg"/>
+ <field name="image_1920" type="base64" file="gamification/static/img/rank_doctor_badge.svg"/>
</record>
</data></odoo>
diff --git a/addons/gamification/data/goal_base.xml b/addons/gamification/data/goal_base.xml
index bb43e81b8f2..a09b588e237 100644
--- a/addons/gamification/data/goal_base.xml
+++ b/addons/gamification/data/goal_base.xml
@@ -145,7 +145,7 @@ Thank you,
<div style="height:${heightA}px;">
${extra_div | safe}
<div style="height:55px;">
- <img style="margin-bottom:5px;width:50px;height:50px;border-radius:50%;" t-att-src="image_data_uri(object.env['res.users'].browse(goal['user_id']).partner_id.image_small)" alt="${goal['name']}"/>
+ <img style="margin-bottom:5px;width:50px;height:50px;border-radius:50%;" t-att-src="image_data_uri(object.env['res.users'].browse(goal['user_id']).partner_id.image_64)" alt="${goal['name']}"/>
</div>
<div align="center" style ="color:${bgColor};height:20px">
${goal['name']}
diff --git a/addons/gamification/models/badge.py b/addons/gamification/models/badge.py
index fc93ffb8041..d1ea4c4cc96 100644
--- a/addons/gamification/models/badge.py
+++ b/addons/gamification/models/badge.py
@@ -4,7 +4,7 @@
import logging
from datetime import date
-from odoo import api, tools, fields, models, _, exceptions
+from odoo import api, fields, models, _, exceptions
_logger = logging.getLogger(__name__)
@@ -65,22 +65,11 @@ class GamificationBadge(models.Model):
_name = 'gamification.badge'
_description = 'Gamification Badge'
- _inherit = ['mail.thread']
+ _inherit = ['mail.thread', 'image.mixin']
name = fields.Char('Badge', required=True, translate=True)
active = fields.Boolean('Active', default=True)
description = fields.Text('Description', translate=True)
- image = fields.Binary("Image", help="This field holds the image used for the badge.")
- image_medium = fields.Binary(
- "Medium-sized badge image",
- help="Medium-sized image of the badge. 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 badge image",
- help="Small-sized image of the badge. It is automatically "
- "resized as a 64x64px image, with aspect ratio preserved. "
- "Use this field anywhere a small image is required.")
level = fields.Selection([
('bronze', 'Bronze'), ('silver', 'Silver'), ('gold', 'Gold')],
string='Forum Badge Level', default='bronze')
@@ -137,16 +126,6 @@ class GamificationBadge(models.Model):
"Remaining Sending Allowed", compute='_remaining_sending_calc',
help="If a maximum is set")
- @api.model_create_multi
- def create(self, values_list):
- for vals in values_list:
- tools.image_resize_images(vals)
- return super(GamificationBadge, self).create(values_list)
-
- def write(self, vals):
- tools.image_resize_images(vals)
- return super(GamificationBadge, self).write(vals)
-
@api.depends('owner_ids')
def _get_owners_info(self):
"""Return:
diff --git a/addons/gamification/models/gamification_karma_rank.py b/addons/gamification/models/gamification_karma_rank.py
index f88712f3c44..65b0d8d2177 100644
--- a/addons/gamification/models/gamification_karma_rank.py
+++ b/addons/gamification/models/gamification_karma_rank.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from odoo import api, tools, fields, models, exceptions, http
+from odoo import api, fields, models, exceptions
from odoo.tools.translate import html_translate
@@ -24,6 +24,7 @@ class Http(models.AbstractModel):
class KarmaRank(models.Model):
_name = 'gamification.karma.rank'
_description = 'Rank based on karma'
+ _inherit = 'image.mixin'
_order = 'karma_min'
name = fields.Text(string='Rank Name', translate=True, required=True)
@@ -33,22 +34,9 @@ class KarmaRank(models.Model):
help="Motivational phrase to reach this rank")
karma_min = fields.Integer(string='Required Karma', help='Minimum karma needed to reach this rank')
user_ids = fields.One2many('res.users', 'rank_id', string='Users', help="Users having this rank")
- image = fields.Binary('Rank Icon')
- image_medium = fields.Binary(
- "Medium-sized rank icon",
- help="Medium-sized icon of the rank. 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 rank icon",
- help="Small-sized icon of the rank. It is automatically "
- "resized as a 64x64px image, with aspect ratio preserved. "
- "Use this field anywhere a small image is required.")
@api.model_create_multi
def create(self, values_list):
- for vals in values_list:
- tools.image_resize_images(vals)
res = super(KarmaRank, self).create(values_list)
users = self.env['res.users'].sudo().search([('karma', '>', 0)])
users._recompute_rank()
@@ -60,7 +48,6 @@ class KarmaRank(models.Model):
low = min(vals['karma_min'], self.karma_min)
high = max(vals['karma_min'], self.karma_min)
- tools.image_resize_images(vals)
res = super(KarmaRank, self).write(vals)
if 'karma_min' in vals:
diff --git a/addons/gamification/views/badge.xml b/addons/gamification/views/badge.xml
index 674f64208aa..d0980d3e0b7 100644
--- a/addons/gamification/views/badge.xml
+++ b/addons/gamification/views/badge.xml
@@ -40,7 +40,7 @@
<sheet>
<widget name="web_ribbon" text="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
<div class="oe_button_box" name="button_box"/>
- <field name="image" widget='image' class="oe_avatar"/>
+ <field name="image_1920" widget="image" class="oe_avatar" options="{'preview_image': 'image_128'}"/>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
@@ -102,7 +102,6 @@
<field name="id"/>
<field name="name"/>
<field name="description"/>
- <field name="image"/>
<field name="stat_my"/>
<field name="stat_count"/>
<field name="stat_this_month"/>
@@ -114,7 +113,7 @@
<t t-name="kanban-box">
<div t-attf-class="o_kanban_gamification oe_kanban_global_click #{record.stat_my.raw_value ? 'oe_kanban_color_5' : 'oe_kanban_color_white'}">
<div class="o_kanban_image">
- <img t-att-src="kanban_image('gamification.badge', 'image', record.id.raw_value)" t-att-title="record.name.value" t-att-alt="record.name.value"/>
+ <img t-att-src="kanban_image('gamification.badge', 'image_1024', record.id.raw_value)" t-att-title="record.name.value" t-att-alt="record.name.value"/>
</div>
<div class="oe_kanban_details">
<strong class="o_kanban_record_title"><field name="name"/></strong>
@@ -135,7 +134,7 @@
<em><field name="description"/></em>
<div>
<t t-foreach="record.unique_owner_ids.raw_value.slice(0,11)" t-as="owner">
- <img width="24" height="24" class="oe_kanban_avatar" t-att-src="kanban_image('res.users', 'image_small', owner)" t-att-data-member_id="owner" alt="Owner"/>
+ <img width="24" height="24" class="oe_kanban_avatar" t-att-src="kanban_image('res.users', 'image_64', owner)" t-att-data-member_id="owner" alt="Owner"/>
</t>
</div>
</div>
@@ -168,7 +167,7 @@
<div class="oe_kanban_card oe_kanban_global_click oe_kanban_badge oe_kanban_color_white o_kanban_gamification">
<div class="o_kanban_content">
<div class="o_kanban_image">
- <a type="open"><img t-att-src="kanban_image('gamification.badge', 'image', record.badge_id.raw_value)" t-att-title="record.badge_name.value" t-att-alt="record.badge_name.value" /></a>
+ <a type="open"><img t-att-src="kanban_image('gamification.badge', 'image_1024', record.badge_id.raw_value)" t-att-title="record.badge_name.value" t-att-alt="record.badge_name.value" /></a>
</div>
<div class="oe_kanban_details">
<h4 class="mt0 mb0">
diff --git a/addons/gamification/views/challenge.xml b/addons/gamification/views/challenge.xml
index a5f9f4fe2ee..745a9b5204c 100644
--- a/addons/gamification/views/challenge.xml
+++ b/addons/gamification/views/challenge.xml
@@ -158,7 +158,7 @@
</div>
</strong>
<t t-foreach="record.user_ids.raw_value.slice(0,11)" t-as="member">
- <img class="o_kanban_badge_avatars" t-att-src="kanban_image('res.users', 'image_small', member)" t-att-data-member_id="member" alt="Member"/>
+ <img class="o_kanban_badge_avatars" t-att-src="kanban_image('res.users', 'image_64', member)" t-att-data-member_id="member" alt="Member"/>
</t>
</div>
</div>
diff --git a/addons/gamification/views/gamification_karma_rank_views.xml b/addons/gamification/views/gamification_karma_rank_views.xml
index f728cff538e..fc0205794b5 100644
--- a/addons/gamification/views/gamification_karma_rank_views.xml
+++ b/addons/gamification/views/gamification_karma_rank_views.xml
@@ -47,7 +47,7 @@
<form string="Rank">
<sheet>
<div class="oe_button_box" name="button_box"/>
- <field name="image" widget='image' class="oe_avatar"/>
+ <field name="image_1920" widget="image" class="oe_avatar" options="{'preview_image': 'image_128'}"/>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
diff --git a/addons/gamification/views/goal.xml b/addons/gamification/views/goal.xml
index 9af36db1948..f571e28a4ec 100644
--- a/addons/gamification/views/goal.xml
+++ b/addons/gamification/views/goal.xml
@@ -150,7 +150,7 @@
<div class="o_kanban_content">
<p><strong><h4 class="oe_goal_name text-center" tooltip="kanban-tooltip"><field name="definition_id" /></h4></strong></p>
<div class="float-left">
- <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" />
+ <img t-att-src="kanban_image('res.users', 'image_64', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" />
</div>
<field name="user_id" />
<div class="o_goal_state_block">
diff --git a/addons/gamification/views/mail_templates.xml b/addons/gamification/views/mail_templates.xml
index fda8a66f9a4..4f589833bf1 100644
--- a/addons/gamification/views/mail_templates.xml
+++ b/addons/gamification/views/mail_templates.xml
@@ -32,7 +32,7 @@
</td>
<td style="padding:15px 20px 10px 20px;">
<p style="text-align: center;">
- <img src="/web/image/gamification.karma.rank/${object.rank_id.id}/image_medium"/>
+ <img src="/web/image/gamification.karma.rank/${object.rank_id.id}/image_128"/>
</p>
</td>
</tr>
diff --git a/addons/google_calendar/static/tests/google_calendar_tests.js b/addons/google_calendar/static/tests/google_calendar_tests.js
index 76aaa65411b..0470d95d730 100644
--- a/addons/google_calendar/static/tests/google_calendar_tests.js
+++ b/addons/google_calendar/static/tests/google_calendar_tests.js
@@ -39,7 +39,7 @@ QUnit.module('Google Calendar', {
id: {string: "ID", type: "integer"},
display_name: {string: "Displayed name", type: "char"},
partner_id: {string: "partner", type: "many2one", relation: 'partner'},
- image: {string: "image", type: "integer"},
+ image_1920: {string: "image", type: "integer"},
},
records: [
{id: 4, display_name: "user 4", partner_id: 4},
@@ -49,10 +49,10 @@ QUnit.module('Google Calendar', {
fields: {
id: {string: "ID", type: "integer"},
display_name: {string: "Displayed name", type: "char"},
- image: {string: "image", type: "integer"},
+ image_1920: {string: "image", type: "integer"},
},
records: [
- {id: 4, display_name: "partner 4", image: 'DDD'}
+ {id: 4, display_name: "partner 4", image_1920: 'DDD'}
]
},
filter_partner: {
diff --git a/addons/hr/data/hr_data.xml b/addons/hr/data/hr_data.xml
index 8c70cef3e68..41e343de6d4 100644
--- a/addons/hr/data/hr_data.xml
+++ b/addons/hr/data/hr_data.xml
@@ -15,7 +15,7 @@
<field name="user_id" ref="base.user_admin"/>
<field name="address_id" ref="base.partner_admin"/>
<field name="address_home_id" ref="base.partner_admin"/>
- <field name="image" eval="obj(ref('base.partner_admin')).image" model="res.partner"/>
+ <field name="image_1920" eval="obj(ref('base.partner_admin')).image_1920" model="res.partner"/>
</record>
<record id="onboarding_setup_it_materials" model="hr.plan.activity.type">
diff --git a/addons/hr/data/hr_demo.xml b/addons/hr/data/hr_demo.xml
index a713638b1fa..b6f039b140c 100644
--- a/addons/hr/data/hr_demo.xml
+++ b/addons/hr/data/hr_demo.xml
@@ -154,7 +154,7 @@ If you have development competencies, we can propose you specific traineeships</
<field name="work_location">Building 1, Second Floor</field>
<field name="work_phone">(376)-310-7863</field>
<field name="work_email">ronnie.hart87@example.com</field>
- <field name="image" type="base64" file="hr/static/img/employee_al-image.jpg"/>
+ <field name="image_1920" type="base64" file="hr/static/img/employee_al-image.jpg"/>
</record>
<record id="employee_mit" model="hr.employee">
@@ -168,7 +168,7 @@ If you have development competencies, we can propose you specific traineeships</
<field name="work_phone">(538)-497-4804</field>
<field name="mobile_phone">(538)-672-3185</field>
<field name="work_email">anita.oliver32@example.com</field>
- <field name="image" type="base64" file="hr/static/img/employee_mit-image.jpg"/>
+ <field name="image_1920" type="base64" file="hr/static/img/employee_mit-image.jpg"/>
</record>
<record id="employee_niv" model="hr.employee">
@@ -181,7 +181,7 @@ If you have development competencies, we can propose you specific traineeships</
<field name="work_location">Building 1, Second Floor</field>
<field name="work_phone">(450)-719-4182</field>
<field name="work_email">sharlene.rhodes49@example.comcom</field>
- <field name="image" type="base64" file="hr/static/img/employee_niv-image.jpg"/>
+ <field name="image_1920" type="base64" file="hr/static/img/employee_niv-image.jpg"/>
</record>
<record id="employee_stw" model="hr.employee">
@@ -194,7 +194,7 @@ If you have development competencies, we can propose you specific traineeships</
<field name="work_location">Building 1, Second Floor</field>
<field name="work_phone">(332)-775-6660</field>
<field name="work_email">randall.lewis74@example.com</field>
- <field name="image" type="base64" file="hr/static/img/employee_stw-image.jpg"/>
+ <field name="image_1920" type="base64" file="hr/static/img/employee_stw-image.jpg"/>
</record>
<record id="employee_chs" model="hr.employee">
@@ -207,7 +207,7 @@ If you have development competencies, we can propose you specific traineeships</
<field name="work_location">Building 1, Second Floor</field>
<field name="work_phone">(157)-363-8229</field>
<field name="work_email">jennie.fletcher76@example.com</field>
- <field name="image" type="base64" file="hr/static/img/employee_chs-image.jpg"/>
+ <field name="image_1920" type="base64" file="hr/static/img/employee_chs-image.jpg"/>
</record>
<record id="employee_qdp" model="hr.employee">
@@ -221,7 +221,7 @@ If you have development competencies, we can propose you specific traineeships</
<field name="work_location">Building 1, Second Floor</field>
<field name="work_phone">+3281813700</field>
<field name="work_email">gilles@odoo.com</field>
- <field name="image" type="base64" file="hr/static/img/employee_qdp-image.png"/>
+ <field name="image_1920" type="base64" file="hr/static/img/employee_qdp-image.png"/>
</record>
<record id="employee_fme" model="hr.employee">
@@ -234,7 +234,7 @@ If you have development competencies, we can propose you specific traineeships</
<field name="work_location">Building 1, Second Floor</field>
<field name="work_phone">(449)-505-5146</field>
<field name="work_email">keith.byrd52@example.com</field>
- <field name="image" type="base64" file="hr/static/img/employee_fme-image.jpg"/>
+ <field name="image_1920" type="base64" file="hr/static/img/employee_fme-image.jpg"/>
</record>
<record id="employee_fpi" model="hr.employee">
@@ -247,7 +247,7 @@ If you have development competencies, we can propose you specific traineeships</
<field name="work_location">Building 1, Second Floor</field>
<field name="work_phone">(203)-276-7903</field>
<field name="work_email">audrey.peterson25@example.com</field>
- <field name="image" type="base64" file="hr/static/img/employee_fpi-image.jpg"/>
+ <field name="image_1920" type="base64" file="hr/static/img/employee_fpi-image.jpg"/>
</record>
<record id="employee_jth" model="hr.employee">
@@ -260,7 +260,7 @@ If you have development competencies, we can propose you specific traineeships</
<field name="work_location">Building 1, Second Floor</field>
<field name="work_phone">(663)-707-8451</field>
<field name="work_email">toni.jimenez23@example.com</field>
- <field name="image" type="base64" file="hr/static/img/employee_jth-image.jpg"/>
+ <field name="image_1920" type="base64" file="hr/static/img/employee_jth-image.jpg"/>
</record>
<record id="employee_ngh" model="hr.employee">
@@ -273,7 +273,7 @@ If you have development competencies, we can propose you specific traineeships</
<field name="work_location">Building 1, Second Floor</field>
<field name="work_phone">(916)-264-7362</field>
<field name="work_email">jeffrey.kelly72@example.com</field>
- <field name="image" type="base64" file="hr/static/img/employee_ngh-image.jpg"/>
+ <field name="image_1920" type="base64" file="hr/static/img/employee_ngh-image.jpg"/>
</record>
<record id="employee_vad" model="hr.employee">
@@ -286,7 +286,7 @@ If you have development competencies, we can propose you specific traineeships</
<field name="work_location">Building 1, Second Floor</field>
<field name="work_phone">(360)-694-7266</field>
<field name="work_email">tina.williamson98@example.com</field>
- <field name="image" type="base64" file="hr/static/img/employee_vad-image.jpg"/>
+ <field name="image_1920" type="base64" file="hr/static/img/employee_vad-image.jpg"/>
</record>
<record id="employee_han" model="hr.employee">
@@ -297,7 +297,7 @@ If you have development competencies, we can propose you specific traineeships</
<field name="work_location">Building 1, Second Floor</field>
<field name="work_phone">(350)-912-1201</field>
<field name="work_email">walter.horton80@example.com</field>
- <field name="image" type="base64" file="hr/static/img/employee_han-image.jpg"/>
+ <field name="image_1920" type="base64" file="hr/static/img/employee_han-image.jpg"/>
</record>
<record id="employee_jve" model="hr.employee">
@@ -308,7 +308,7 @@ If you have development competencies, we can propose you specific traineeships</
<field name="work_location">Building 1, Second Floor</field>
<field name="work_phone">(114)-262-1607</field>
<field name="work_email">paul.williams59@example.com</field>
- <field name="image" type="base64" file="hr/static/img/employee_jve-image.jpg"/>
+ <field name="image_1920" type="base64" file="hr/static/img/employee_jve-image.jpg"/>
</record>
<record id="employee_jep" model="hr.employee">
@@ -319,7 +319,7 @@ If you have development competencies, we can propose you specific traineeships</
<field name="work_location">Building 1, Second Floor</field>
<field name="work_phone">(883)-331-5378</field>
<field name="work_email">doris.cole31@example.com</field>
- <field name="image" type="base64" file="hr/static/img/employee_jep-image.jpg"/>
+ <field name="image_1920" type="base64" file="hr/static/img/employee_jep-image.jpg"/>
</record>
<record id="employee_jod" model="hr.employee">
@@ -330,7 +330,7 @@ If you have development competencies, we can propose you specific traineeships</
<field name="work_location">Building 1, Second Floor</field>
<field name="work_phone">(206)-267-3735</field>
<field name="work_email">jod@odoo.com</field>
- <field name="image" type="base64" file="hr/static/img/employee_jod-image.jpg"/>
+ <field name="image_1920" type="base64" file="hr/static/img/employee_jod-image.jpg"/>
</record>
<record id="employee_jog" model="hr.employee">
@@ -341,7 +341,7 @@ If you have development competencies, we can propose you specific traineeships</
<field name="work_location">Building 1, Second Floor</field>
<field name="work_phone">(754)-532-3841</field>
<field name="work_email">beth.evans77@example.com</field>
- <field name="image" type="base64" file="hr/static/img/employee_jog-image.jpg"/>
+ <field name="image_1920" type="base64" file="hr/static/img/employee_jog-image.jpg"/>
</record>
<record id="employee_jgo" model="hr.employee">
@@ -352,7 +352,7 @@ If you have development competencies, we can propose you specific traineeships</
<field name="work_location">Building 1, Second Floor</field>
<field name="work_phone">(944)-518-8232</field>
<field name="work_email">ernest.reed47@example.com</field>
- <field name="image" type="base64" file="hr/static/img/employee_jgo-image.jpg"/>
+ <field name="image_1920" type="base64" file="hr/static/img/employee_jgo-image.jpg"/>
</record>
<record id="employee_lur" model="hr.employee">
@@ -363,7 +363,7 @@ If you have development competencies, we can propose you specific traineeships</
<field name="work_location">Building 1, Second Floor</field>
<field name="work_phone">(644)-169-1352</field>
<field name="work_email">eli.lambert22@example.com</field>
- <field name="image" type="base64" file="hr/static/img/employee_lur-image.jpg"/>
+ <field name="image_1920" type="base64" file="hr/static/img/employee_lur-image.jpg"/>
</record>
<record id="employee_hne" model="hr.employee">
@@ -374,7 +374,7 @@ If you have development competencies, we can propose you specific traineeships</
<field name="work_location">Building 1, Second Floor</field>
<field name="work_email">abigail.peterson39@example.com</field>
<field name="work_phone">(482)-233-3393</field>
- <field name="image" type="base64" file="hr/static/img/employee_hne-image.jpg"/>
+ <field name="image_1920" type="base64" file="hr/static/img/employee_hne-image.jpg"/>
</record>
</data>
</odoo>
diff --git a/addons/hr/models/hr_employee.py b/addons/hr/models/hr_employee.py
index a9252dac860..6f28b32b610 100644
--- a/addons/hr/models/hr_employee.py
+++ b/addons/hr/models/hr_employee.py
@@ -8,7 +8,7 @@ import itertools
from werkzeug import url_encode
import pytz
-from odoo import api, fields, models, tools, _
+from odoo import api, fields, models, _
from odoo.exceptions import ValidationError, AccessError
from odoo.modules.module import get_module_resource
from odoo.addons.resource.models.resource_mixin import timezone_datetime
@@ -25,13 +25,13 @@ class HrEmployeePrivate(models.Model):
_name = "hr.employee"
_description = "Employee"
_order = 'name'
- _inherit = ['hr.employee.base', 'mail.thread', 'mail.activity.mixin', 'resource.mixin']
+ _inherit = ['hr.employee.base', 'mail.thread', 'mail.activity.mixin', 'resource.mixin', 'image.mixin']
_mail_post_access = 'read'
@api.model
def _default_image(self):
image_path = get_module_resource('hr', 'static/src/img', 'default_image.png')
- return tools.image_process(base64.b64encode(open(image_path, 'rb').read()), size=tools.IMAGE_BIG_SIZE)
+ return base64.b64encode(open(image_path, 'rb').read())
# resource and user
# required on the resource, make sure required="True" set in the view
@@ -93,13 +93,7 @@ class HrEmployeePrivate(models.Model):
emergency_phone = fields.Char("Emergency Phone", groups="hr.group_hr_user", tracking=True)
km_home_work = fields.Integer(string="Km Home-Work", groups="hr.group_hr_user", tracking=True)
- # image: all image fields are base64 encoded and PIL-supported
- image = fields.Binary(
- "Photo", default=_default_image)
- image_medium = fields.Binary(
- "Medium-sized photo")
- image_small = fields.Binary(
- "Small-sized photo")
+ image_1920 = fields.Image(default=_default_image)
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')
@@ -232,7 +226,7 @@ class HrEmployeePrivate(models.Model):
def _sync_user(self, user):
vals = dict(
- image=user.image,
+ image_1920=user.image_1920,
work_email=user.email,
)
if user.tz:
@@ -245,7 +239,6 @@ class HrEmployeePrivate(models.Model):
user = self.env['res.users'].browse(vals['user_id'])
vals.update(self._sync_user(user))
vals['name'] = vals.get('name', user.name)
- tools.image_resize_images(vals)
employee = super(HrEmployeePrivate, self).create(vals)
url = '/web#%s' % url_encode({'action': 'hr.plan_wizard_action', 'active_id': employee.id, 'active_model': 'hr.employee'})
employee._message_log(body=_('<b>Congratulations !</b> May I recommand you to setup an <a href="%s">onboarding plan ?</a>') % (url))
@@ -262,7 +255,6 @@ class HrEmployeePrivate(models.Model):
self.env['res.partner.bank'].browse(account_id).partner_id = vals['address_home_id']
if vals.get('user_id'):
vals.update(self._sync_user(self.env['res.users'].browse(vals['user_id'])))
- tools.image_resize_images(vals)
res = super(HrEmployeePrivate, self).write(vals)
if vals.get('department_id') or vals.get('user_id'):
department_id = vals['department_id'] if vals.get('department_id') else self[:1].department_id.id
diff --git a/addons/hr/models/hr_employee_public.py b/addons/hr/models/hr_employee_public.py
index 8a80a23c939..62c221ee472 100644
--- a/addons/hr/models/hr_employee_public.py
+++ b/addons/hr/models/hr_employee_public.py
@@ -32,9 +32,12 @@ class HrEmployeePublic(models.Model):
# hr.employee.public specific fields
child_ids = fields.One2many('hr.employee.public', 'parent_id', string='Direct subordinates', readonly=True)
- image = fields.Binary("Photo", compute='_compute_image', readonly=True, compute_sudo=True)
- image_medium = fields.Binary("Medium-sized photo", compute='_compute_image', readonly=True, compute_sudo=True)
- image_small = fields.Binary("Small-sized photo", compute='_compute_image', readonly=True, compute_sudo=True)
+ image_1920 = fields.Image("Original Image", compute='_compute_image', compute_sudo=True)
+ image_1024 = fields.Image("Image 1024", compute='_compute_image', compute_sudo=True)
+ image_512 = fields.Image("Image 512", compute='_compute_image', compute_sudo=True)
+ image_256 = fields.Image("Image 256", compute='_compute_image', compute_sudo=True)
+ image_128 = fields.Image("Image 128", compute='_compute_image', compute_sudo=True)
+ image_64 = fields.Image("Image 64", compute='_compute_image', compute_sudo=True)
parent_id = fields.Many2one('hr.employee.public', 'Manager', readonly=True)
coach_id = fields.Many2one('hr.employee.public', 'Coach', readonly=True)
@@ -42,9 +45,12 @@ class HrEmployeePublic(models.Model):
for employee in self:
# We have to be in sudo to have access to the images
employee_id = self.sudo().env['hr.employee'].browse(employee.id)
- employee.image = employee_id.image
- employee.image_medium = employee_id.image_medium
- employee.image_small = employee_id.image_small
+ employee.image_1920 = employee_id.image_1920
+ employee.image_1024 = employee_id.image_1024
+ employee.image_512 = employee_id.image_512
+ employee.image_256 = employee_id.image_256
+ employee.image_128 = employee_id.image_128
+ employee.image_64 = employee_id.image_64
@api.model
def _get_fields(self):
diff --git a/addons/hr/models/res_users.py b/addons/hr/models/res_users.py
index d863c41fd64..6b9832bcbec 100644
--- a/addons/hr/models/res_users.py
+++ b/addons/hr/models/res_users.py
@@ -157,7 +157,7 @@ class User(models.Model):
result = super(User, self).write(vals)
employee_values = {}
- for fname in [f for f in ['name', 'email', 'image', 'tz'] if f in vals]:
+ for fname in [f for f in ['name', 'email', 'image_1920', 'tz'] if f in vals]:
employee_values[fname] = vals[fname]
if employee_values:
if 'email' in employee_values:
diff --git a/addons/hr/report/hr_employee_badge.xml b/addons/hr/report/hr_employee_badge.xml
index 1a5e8fdc645..f186914ba3d 100644
--- a/addons/hr/report/hr_employee_badge.xml
+++ b/addons/hr/report/hr_employee_badge.xml
@@ -25,7 +25,7 @@
</tr>
<tr style="height:70%;">
<td align="center" valign="center">
- <img t-if="employee.image" t-att-src="image_data_uri(employee.image)" style="max-height:85pt;max-width:90%" alt="Employee Image"/>
+ <img t-if="employee.image_1920" t-att-src="image_data_uri(employee.image_1920)" style="max-height:85pt;max-width:90%" alt="Employee Image"/>
</td>
</tr>
</table>
diff --git a/addons/hr/views/hr_employee_public_views.xml b/addons/hr/views/hr_employee_public_views.xml
index 0c8ddecb6b9..d6177dae413 100644
--- a/addons/hr/views/hr_employee_public_views.xml
+++ b/addons/hr/views/hr_employee_public_views.xml
@@ -36,7 +36,7 @@
<div class="oe_button_box" name="button_box">
<!-- Used by other modules-->
</div>
- <field name="image" widget='image' class="oe_avatar" options='{"zoom": true, "preview_image":"image_medium"}'/>
+ <field name="image_1920" widget='image' class="oe_avatar" options='{"zoom": true, "preview_image":"image_128"}'/>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
@@ -112,9 +112,9 @@
<t t-name="kanban-box">
<div class="oe_kanban_global_click o_kanban_record_has_image_fill o_hr_kanban_record">
<!-- Medium employee's picture -->
- <field name="image" widget="image" class="o_kanban_image_fill_left d-none d-md-block" options="{'zoom': true, 'background': true, 'preventClicks': false}"/>
+ <field name="image_128" widget="image" class="o_kanban_image_fill_left d-none d-md-block" options="{'zoom': true, 'background': true, 'preventClicks': false}"/>
<!-- Employee's picture optimized for mobile -->
- <field name="image_small" widget="image" class="o_kanban_image d-md-none rounded-circle" options="{'zoom': true, 'background': true, 'preventClicks': false}"/>
+ <field name="image_64" widget="image" class="o_kanban_image d-md-none rounded-circle" options="{'zoom': true, 'background': true, 'preventClicks': false}"/>
<div class="oe_kanban_details">
<div class="o_kanban_record_top">
diff --git a/addons/hr/views/hr_employee_views.xml b/addons/hr/views/hr_employee_views.xml
index 71df38b5d6e..434afc2ec6f 100644
--- a/addons/hr/views/hr_employee_views.xml
+++ b/addons/hr/views/hr_employee_views.xml
@@ -74,7 +74,7 @@
</div>
</button>
</div>
- <field name="image" widget='image' class="oe_avatar" options='{"zoom": true, "preview_image":"image_medium"}'/>
+ <field name="image_1920" widget='image' class="oe_avatar" options='{"zoom": true, "preview_image":"image_128"}'/>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
@@ -227,9 +227,9 @@
<t t-name="kanban-box">
<div class="oe_kanban_global_click o_kanban_record_has_image_fill o_hr_kanban_record">
<!-- Medium employee's picture -->
- <field name="image" widget="image" class="o_kanban_image_fill_left d-none d-md-block" options="{'zoom': true, 'background': true, 'preventClicks': false}"/>
+ <field name="image_128" widget="image" class="o_kanban_image_fill_left d-none d-md-block" options="{'zoom': true, 'background': true, 'preventClicks': false}"/>
<!-- Employee's picture optimized for mobile -->
- <field name="image_small" widget="image" class="o_kanban_image d-md-none rounded-circle" options="{'zoom': true, 'background': true, 'preventClicks': false}"/>
+ <field name="image_64" widget="image" class="o_kanban_image d-md-none rounded-circle" options="{'zoom': true, 'background': true, 'preventClicks': false}"/>
<div class="oe_kanban_details">
<div class="o_kanban_record_top">
@@ -271,7 +271,7 @@
<field name="id"/>
<templates>
<div t-name="activity-box">
- <img t-att-src="activity_image('hr.employee', 'image_small', record.id.raw_value)" role="img" t-att-title="record.id.value" t-att-alt="record.id.value"/>
+ <img t-att-src="activity_image('hr.employee', 'image_64', record.id.raw_value)" role="img" t-att-title="record.id.value" t-att-alt="record.id.value"/>
<div>
<field name="name" display="full"/>
<field name="job_id" muted="1" display="full"/>
diff --git a/addons/hr/views/res_users.xml b/addons/hr/views/res_users.xml
index f6259a0e650..1f618fb776a 100644
--- a/addons/hr/views/res_users.xml
+++ b/addons/hr/views/res_users.xml
@@ -14,7 +14,7 @@
<field name="arch" type="xml">
<footer position="replace"/>
<h1 position="replace"/>
- <xpath expr="//field[@name='image']" position="replace"/>
+ <xpath expr="//field[@name='image_1920']" position="replace"/>
<xpath expr="//field[@name='email']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
@@ -75,7 +75,7 @@
</div>
</button>
</div>
- <field name="image" widget='image' class="oe_avatar" options='{"zoom": true, "preview_image":"image_medium"}'/>
+ <field name="image_1920" widget='image' class="oe_avatar" options='{"zoom": true, "preview_image":"image_128"}'/>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
diff --git a/addons/hr_attendance/static/src/xml/attendance.xml b/addons/hr_attendance/static/src/xml/attendance.xml
index f38dd7cfa7c..f0be4eddb6c 100644
--- a/addons/hr_attendance/static/src/xml/attendance.xml
+++ b/addons/hr_attendance/static/src/xml/attendance.xml
@@ -38,7 +38,7 @@
<t t-set="checked_in" t-value="widget.employee.attendance_state=='checked_in'"/>
<t t-if="widget.employee">
<div class="o_hr_attendance_user_badge o_home_menu_background">
- <img class="img rounded-circle" t-attf-src="/web/image?model=hr.employee&amp;field=image_medium&amp;id=#{widget.employee.id}" t-att-title="widget.employee.name" t-att-alt="widget.employee.name"/>
+ <img class="img rounded-circle" t-attf-src="/web/image?model=hr.employee&amp;field=image_128&amp;id=#{widget.employee.id}" t-att-title="widget.employee.name" t-att-alt="widget.employee.name"/>
</div>
<h1 class="mb8"><t t-esc="widget.employee.name"/></h1>
<h3 class="mt8 mb24"><t t-if="!checked_in">Welcome!</t><t t-else="">Want to check out?</t></h3>
@@ -66,7 +66,7 @@
</div>
<t t-if="widget.employee_id">
<div class="o_hr_attendance_user_badge o_home_menu_background">
- <img class="img rounded-circle" t-attf-src="/web/image?model=hr.employee&amp;field=image_medium&amp;id=#{widget.employee_id}" t-att-title="widget.employee_name" t-att-alt="widget.employee_name"/>
+ <img class="img rounded-circle" t-attf-src="/web/image?model=hr.employee&amp;field=image_128&amp;id=#{widget.employee_id}" t-att-title="widget.employee_name" t-att-alt="widget.employee_name"/>
</div>
<h1 class="mb8"><t t-esc="widget.employee_name"/></h1>
<h3 class="mt8 mb24"><t t-if="!checked_in">Welcome!</t><t t-else="">Want to check out?</t></h3>
@@ -109,7 +109,7 @@
<div class="o_hr_attendance_kiosk_mode">
<t t-if="widget.attendance">
<div class="o_hr_attendance_user_badge o_home_menu_background">
- <img class="img rounded-circle" t-attf-src="/web/image?model=hr.employee&amp;field=image_medium&amp;id=#{widget.attendance.employee_id[0]}" t-att-title="widget.employee_name" t-att-alt="widget.employee_name"/>
+ <img class="img rounded-circle" t-attf-src="/web/image?model=hr.employee&amp;field=image_128&amp;id=#{widget.attendance.employee_id[0]}" t-att-title="widget.employee_name" t-att-alt="widget.employee_name"/>
</div>
<t t-if="widget.attendance.check_out">
<h1 class="mb0">Goodbye <t t-esc="widget.employee_name"/>!</h1>
diff --git a/addons/hr_attendance/views/hr_attendance_view.xml b/addons/hr_attendance/views/hr_attendance_view.xml
index 9f12d4d6487..bd416202f2f 100644
--- a/addons/hr_attendance/views/hr_attendance_view.xml
+++ b/addons/hr_attendance/views/hr_attendance_view.xml
@@ -27,7 +27,7 @@
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_global_click">
<div>
- <img t-att-src="kanban_image('hr.employee', 'image_small', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value" width="24" height="24" class="oe_kanban_avatar mr4"/>
+ <img t-att-src="kanban_image('hr.employee', 'image_64', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value" width="24" height="24" class="oe_kanban_avatar mr4"/>
<span class="o_kanban_record_title">
<strong><t t-esc="record.employee_id.value"/></strong>
</span>
diff --git a/addons/hr_attendance/views/hr_employee_view.xml b/addons/hr_attendance/views/hr_employee_view.xml
index c13e8848b61..ac2abad8010 100644
--- a/addons/hr_attendance/views/hr_employee_view.xml
+++ b/addons/hr_attendance/views/hr_employee_view.xml
@@ -137,7 +137,7 @@
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="o_kanban_image">
- <img t-att-src="kanban_image('hr.employee', 'image_medium', record.id.raw_value)" alt="Employee"/>
+ <img t-att-src="kanban_image('hr.employee', 'image_128', record.id.raw_value)" alt="Employee"/>
</div>
<div class="oe_kanban_details">
<div id="textbox">
diff --git a/addons/hr_contract/views/hr_contract_views.xml b/addons/hr_contract/views/hr_contract_views.xml
index 920501167ce..467b856f6f0 100644
--- a/addons/hr_contract/views/hr_contract_views.xml
+++ b/addons/hr_contract/views/hr_contract_views.xml
@@ -261,7 +261,7 @@
<field name="job_id"/>
</div>
<div class="oe_kanban_bottom_right">
- <img t-att-src="kanban_image('hr.employee', 'image_medium', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
+ <img t-att-src="kanban_image('hr.employee', 'image_128', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
</div>
</div>
<div class="oe_clear"></div>
@@ -280,7 +280,7 @@
<field name="employee_id"/>
<templates>
<div t-name="activity-box">
- <img t-att-src="activity_image('hr.employee', 'image_medium', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value"/>
+ <img t-att-src="activity_image('hr.employee', 'image_128', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value"/>
<div>
<field name="name" display="full"/>
<field name="job_id" muted="1" display="full"/>
diff --git a/addons/hr_expense/data/hr_expense_demo.xml b/addons/hr_expense/data/hr_expense_demo.xml
index 57ec21bda80..a933f86d43e 100644
--- a/addons/hr_expense/data/hr_expense_demo.xml
+++ b/addons/hr_expense/data/hr_expense_demo.xml
@@ -50,7 +50,7 @@
<field name="uom_po_id" ref="uom.product_uom_km"/>
<field name="categ_id" ref="product.cat_expense"/>
<field name="can_be_expensed" eval="True" />
- <field name="image" type="base64" file="hr_expense/static/img/car_travel-image.jpg"/>
+ <field name="image_1920" type="base64" file="hr_expense/static/img/car_travel-image.jpg"/>
</record>
<record id="air_ticket" model="product.product">
@@ -61,7 +61,7 @@
<field name="default_code">EXP_AF</field>
<field name="categ_id" ref="product.cat_expense"/>
<field name="can_be_expensed" eval="True" />
- <field name="image" type="base64" file="hr_expense/static/img/air_ticket-image.jpg"/>
+ <field name="image_1920" type="base64" file="hr_expense/static/img/air_ticket-image.jpg"/>
</record>
<record id="product.expense_hotel" model="product.product">
diff --git a/addons/hr_expense/views/hr_expense_views.xml b/addons/hr_expense/views/hr_expense_views.xml
index 98f99b605e5..0afbe3be4db 100644
--- a/addons/hr_expense/views/hr_expense_views.xml
+++ b/addons/hr_expense/views/hr_expense_views.xml
@@ -251,7 +251,7 @@
<field name="currency_id"/>
<templates>
<div t-name="activity-box">
- <img t-att-src="activity_image('hr.employee', 'image_small', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value"/>
+ <img t-att-src="activity_image('hr.employee', 'image_64', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value"/>
<div>
<field name="name" display="full"/>
<field name="total_amount" widget="monetary" muted="1" display="full"/>
@@ -310,7 +310,7 @@
<widget name="web_ribbon" text="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
<field name='product_variant_count' invisible='1'/>
<field name="id" invisible="True"/>
- <field name="image_medium" widget="image" class="oe_avatar"/>
+ <field name="image_1920" widget="image" class="oe_avatar" options="{'image_preview': 'image_128'}"/>
<div class="oe_title">
<label class="oe_edit_only" for="name" string="Product Name"/>
<h1><field name="name" placeholder="e.g. Lunch"/></h1>
@@ -662,7 +662,7 @@
<field name="currency_id"/>
<templates>
<div t-name="activity-box">
- <img t-att-src="activity_image('hr.employee', 'image_small', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value"/>
+ <img t-att-src="activity_image('hr.employee', 'image_64', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value"/>
<div>
<field name="name" display="full"/>
<field name="total_amount" widget="monetary" muted="1" display="full"/>
diff --git a/addons/hr_holidays/report/hr_leave_reports.xml b/addons/hr_holidays/report/hr_leave_reports.xml
index 69bb21a0f9a..20bc19d8451 100644
--- a/addons/hr_holidays/report/hr_leave_reports.xml
+++ b/addons/hr_holidays/report/hr_leave_reports.xml
@@ -71,7 +71,7 @@
<div t-attf-class="oe_kanban_global_click">
<div>
<span>
- <img t-att-src="kanban_image('hr.employee', 'image_small', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value" width="40" height="40" class="oe_kanban_avatar float-left mr4"/>
+ <img t-att-src="kanban_image('hr.employee', 'image_64', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value" width="40" height="40" class="oe_kanban_avatar float-left mr4"/>
</span>
<span>
<div>
diff --git a/addons/hr_holidays/views/hr_leave_allocation_views.xml b/addons/hr_holidays/views/hr_leave_allocation_views.xml
index c48b31c7970..9bf45b801a0 100644
--- a/addons/hr_holidays/views/hr_leave_allocation_views.xml
+++ b/addons/hr_holidays/views/hr_leave_allocation_views.xml
@@ -253,7 +253,7 @@
<div class="oe_kanban_global_click container">
<div class="row no-gutters">
<div class="col-2">
- <img t-att-src="kanban_image('hr.employee', 'image_small', record.employee_id.raw_value)"
+ <img t-att-src="kanban_image('hr.employee', 'image_64', record.employee_id.raw_value)"
t-att-title="record.employee_id.value"
t-att-alt="record.employee_id.value"
width="40" height="40"
@@ -306,7 +306,7 @@
<field name="employee_id"/>
<templates>
<div t-name="activity-box">
- <img t-att-src="activity_image('hr.employee', 'image_small', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value"/>
+ <img t-att-src="activity_image('hr.employee', 'image_64', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value"/>
<div>
<field name="employee_id"/>
<span class="ml-3 text-muted">
diff --git a/addons/hr_holidays/views/hr_leave_views.xml b/addons/hr_holidays/views/hr_leave_views.xml
index fa3c2e5c85b..8dcc4dc63f4 100644
--- a/addons/hr_holidays/views/hr_leave_views.xml
+++ b/addons/hr_holidays/views/hr_leave_views.xml
@@ -113,7 +113,7 @@
<div class="oe_kanban_global_click container">
<div class="row no-gutters">
<div class="col-2">
- <img t-att-src="kanban_image('hr.employee', 'image_small', record.employee_id.raw_value)"
+ <img t-att-src="kanban_image('hr.employee', 'image_64', record.employee_id.raw_value)"
t-att-title="record.employee_id.value"
t-att-alt="record.employee_id.value"
width="40" height="40"
@@ -178,7 +178,7 @@
<field name="number_of_days"/>
<templates>
<div t-name="activity-box">
- <img t-att-src="activity_image('hr.employee', 'image_small', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value" width="50" height="50"/>
+ <img t-att-src="activity_image('hr.employee', 'image_64', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value" width="50" height="50"/>
<div>
<field name="name"/>
<span class="ml-3 text-muted">
diff --git a/addons/hr_maintenance/views/maintenance_views.xml b/addons/hr_maintenance/views/maintenance_views.xml
index 0ede973b408..97be6402b91 100644
--- a/addons/hr_maintenance/views/maintenance_views.xml
+++ b/addons/hr_maintenance/views/maintenance_views.xml
@@ -99,7 +99,7 @@
<field name="department_id"/>
</xpath>
<xpath expr="//img[@t-att-title='record.owner_user_id.value']" position='replace'>
- <img t-att-src="kanban_image('hr.employee', 'image_small', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value" width="27" height="27" class="oe_kanban_avatar"/>
+ <img t-att-src="kanban_image('hr.employee', 'image_64', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value" width="27" height="27" class="oe_kanban_avatar"/>
</xpath>
<div t-if="record.serial_no.raw_value" position='after'>
<div t-if="!record.employee_id.raw_value">Unassigned</div>
diff --git a/addons/hr_org_chart/static/src/xml/hr_org_chart.xml b/addons/hr_org_chart/static/src/xml/hr_org_chart.xml
index 119aec4fa15..8c5160fc59c 100644
--- a/addons/hr_org_chart/static/src/xml/hr_org_chart.xml
+++ b/addons/hr_org_chart/static/src/xml/hr_org_chart.xml
@@ -10,13 +10,13 @@
use bg-images to get a clean and centred images -->
<a t-if="! is_self"
class="o_media_object rounded-circle o_employee_redirect"
- t-att-style="'background-image:url(\'/web/image/hr.employee.public/' + employee.id + '/image/\')'"
+ t-att-style="'background-image:url(\'/web/image/hr.employee.public/' + employee.id + '/image_1024/\')'"
t-att-alt="employee.name"
t-att-data-employee-id="employee.id"
t-att-href="employee.link"/>
<div t-if="is_self"
class="o_media_object rounded-circle"
- t-att-style="'background-image:url(\'/web/image/hr.employee.public/' + employee.id + '/image/\')'"/>
+ t-att-style="'background-image:url(\'/web/image/hr.employee.public/' + employee.id + '/image_1024/\')'"/>
</div>
<div class="media-body">
@@ -151,7 +151,7 @@
<t t-name="hr_orgchart_emp_popover_title">
<div>
- <span t-att-style='"background-image:url(\"/web/image/hr.employee.public/" + employee.id + "/image/\")"'/>
+ <span t-att-style='"background-image:url(\"/web/image/hr.employee.public/" + employee.id + "/image_1024/\")"'/>
<a href="#" class="float-right o_employee_redirect" t-att-data-employee-id="employee.id"><i class="fa fa-external-link" role="img" aria-label='Redirect' title="Redirect"></i></a>
<b><t t-esc="employee.name"/></b>
</div>
diff --git a/addons/hr_recruitment/data/hr_recruitment_data.xml b/addons/hr_recruitment/data/hr_recruitment_data.xml
index c0ddf96d334..b4be4c7da54 100644
--- a/addons/hr_recruitment/data/hr_recruitment_data.xml
+++ b/addons/hr_recruitment/data/hr_recruitment_data.xml
@@ -95,7 +95,7 @@
<table>
<tr>
<td width="75">
- <img src="/web/image/res.users/${object.user_id.id}/image_small" alt="Avatar" style="vertical-align:baseline;max-width:64px;" />
+ <img src="/web/image/res.users/${object.user_id.id}/image_64" alt="Avatar" style="vertical-align:baseline;max-width:64px;" />
</td>
<td>
<strong>${object.user_id.name}</strong><br/>
@@ -203,7 +203,7 @@
<table>
<tr>
<td width="75">
- <img src="/web/image/res.users/${object.user_id.id}/image_small" alt="Avatar" style="vertical-align:baseline;max-width:64px;" />
+ <img src="/web/image/res.users/${object.user_id.id}/image_64" alt="Avatar" style="vertical-align:baseline;max-width:64px;" />
</td>
<td>
<strong>${object.user_id.name}</strong><br/>
diff --git a/addons/hr_recruitment/views/hr_recruitment_views.xml b/addons/hr_recruitment/views/hr_recruitment_views.xml
index 3b49ef198b7..2cc46130e01 100644
--- a/addons/hr_recruitment/views/hr_recruitment_views.xml
+++ b/addons/hr_recruitment/views/hr_recruitment_views.xml
@@ -339,7 +339,7 @@
<field name="legend_blocked" invisible="1"/>
<field name="legend_done" invisible="1"/>
</div>
- <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="30" height="30" class="oe_kanban_avatar"/>
+ <img t-att-src="kanban_image('res.users', 'image_64', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="30" height="30" class="oe_kanban_avatar"/>
</div>
</div>
diff --git a/addons/hr_timesheet/views/hr_timesheet_views.xml b/addons/hr_timesheet/views/hr_timesheet_views.xml
index 9aef1401601..131a8dbe565 100644
--- a/addons/hr_timesheet/views/hr_timesheet_views.xml
+++ b/addons/hr_timesheet/views/hr_timesheet_views.xml
@@ -148,7 +148,7 @@
<div t-attf-class="oe_kanban_global_click">
<div class="row">
<div class="col-2">
- <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="40" height="40" class="oe_kanban_avatar float-left"/>
+ <img t-att-src="kanban_image('res.users', 'image_64', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="40" height="40" class="oe_kanban_avatar float-left"/>
</div>
<div class="col-10">
<div>
diff --git a/addons/hr_work_entry/views/hr_work_entry_views.xml b/addons/hr_work_entry/views/hr_work_entry_views.xml
index d8bd3acb375..dc8209ad3e4 100644
--- a/addons/hr_work_entry/views/hr_work_entry_views.xml
+++ b/addons/hr_work_entry/views/hr_work_entry_views.xml
@@ -29,7 +29,7 @@
event_limit="5">
<field name="state" invisible="1"/>
<!-- Sidebar favorites filters -->
- <field name="employee_id" write_model="hr.user.work.entry.employee" write_field="employee_id" avatar_field="image_small"/>
+ <field name="employee_id" write_model="hr.user.work.entry.employee" write_field="employee_id" avatar_field="image_64"/>
<templates>
<t t-name="calendar-box">
<t t-set="color" t-value="widget.getColor(event.color_index)"/>
diff --git a/addons/im_livechat/models/im_livechat_channel.py b/addons/im_livechat/models/im_livechat_channel.py
index 920ad6ecb90..ed7a6a73252 100644
--- a/addons/im_livechat/models/im_livechat_channel.py
+++ b/addons/im_livechat/models/im_livechat_channel.py
@@ -4,7 +4,7 @@ import base64
import random
import re
-from odoo import api, fields, models, modules, tools
+from odoo import api, fields, models, modules
class ImLivechatChannel(models.Model):
@@ -21,7 +21,7 @@ class ImLivechatChannel(models.Model):
def _default_image(self):
image_path = modules.get_module_resource('im_livechat', 'static/src/img', 'default.png')
- return tools.image_process(base64.b64encode(open(image_path, 'rb').read()), size=tools.IMAGE_BIG_SIZE)
+ return base64.b64encode(open(image_path, 'rb').read())
def _default_user_ids(self):
return [(6, 0, [self._uid])]
@@ -42,17 +42,7 @@ class ImLivechatChannel(models.Model):
script_external = fields.Text('Script (external)', compute='_compute_script_external', store=False, readonly=True)
nbr_channel = fields.Integer('Number of conversation', compute='_compute_nbr_channel', store=False, readonly=True)
- # images fields
- image = fields.Binary('Image', default=_default_image,
- help="This field holds the image used as photo for the group, limited to 1024x1024px.")
- image_medium = fields.Binary('Medium',
- help="Medium-sized photo of the group. 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('Thumbnail',
- help="Small-sized photo of the group. It is automatically "\
- "resized as a 64x64px image, with aspect ratio preserved. "\
- "Use this field anywhere a small image is required.")
+ image_128 = fields.Image("Image", max_width=128, max_height=128, default=_default_image)
# relationnal fields
user_ids = fields.Many2many('res.users', 'im_livechat_channel_im_user', 'channel_id', 'user_id', string='Operators', default=_default_user_ids)
@@ -83,15 +73,6 @@ class ImLivechatChannel(models.Model):
for record in self:
record.nbr_channel = len(record.channel_ids)
- @api.model
- def create(self, vals):
- tools.image_resize_images(vals)
- return super(ImLivechatChannel, self).create(vals)
-
- def write(self, vals):
- tools.image_resize_images(vals)
- return super(ImLivechatChannel, self).write(vals)
-
# --------------------------
# Action Methods
# --------------------------
diff --git a/addons/im_livechat/views/im_livechat_channel_views.xml b/addons/im_livechat/views/im_livechat_channel_views.xml
index eb5503dca1c..807bc64a7c7 100644
--- a/addons/im_livechat/views/im_livechat_channel_views.xml
+++ b/addons/im_livechat/views/im_livechat_channel_views.xml
@@ -33,7 +33,7 @@
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="o_kanban_image">
- <img t-att-src="kanban_image('im_livechat.channel', 'image_medium', record.id.raw_value)" class="img-fluid" alt="Channel"/>
+ <img t-att-src="kanban_image('im_livechat.channel', 'image_128', record.id.raw_value)" class="img-fluid" alt="Channel"/>
</div>
<div class="oe_kanban_details">
<div class="float-right">
@@ -87,7 +87,7 @@
<field string="% Happy" name="rating_percentage_satisfaction" widget="statinfo"/>
</button>
</div>
- <field name="image" widget='image' class="oe_avatar" options='{"preview_image": "image_medium"}'/>
+ <field name="image_128" widget="image" class="oe_avatar"/>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
@@ -105,7 +105,7 @@
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="o_kanban_image">
- <img t-att-src="kanban_image('res.users', 'image', record.id.raw_value)" alt="User"/>
+ <img t-att-src="kanban_image('res.users', 'image_1024', record.id.raw_value)" alt="User"/>
</div>
<div class="o_kanban_details">
<h4 class="o_kanban_record_title"><field name="name"/></h4>
diff --git a/addons/im_livechat/views/mail_channel_views.xml b/addons/im_livechat/views/mail_channel_views.xml
index 15041f566c7..ac2dd35ce6d 100644
--- a/addons/im_livechat/views/mail_channel_views.xml
+++ b/addons/im_livechat/views/mail_channel_views.xml
@@ -39,7 +39,7 @@
<form string="Session Form" create="false" edit="false">
<sheet>
<div style="width:50%" class="float-right">
- <field name="rating_last_image" widget="image" class="float-right" options='{"preview_image": "image_thumb"}' readonly="1" nolabel="1"/>
+ <field name="rating_last_image" widget="image" class="float-right" readonly="1" nolabel="1"/>
<field name="rating_last_feedback" nolabel="1"/>
</div>
<div style="width:50%" class="float-left">
diff --git a/addons/lunch/controllers/main.py b/addons/lunch/controllers/main.py
index 3a94df70669..690c37ce14d 100644
--- a/addons/lunch/controllers/main.py
+++ b/addons/lunch/controllers/main.py
@@ -86,7 +86,7 @@ class LunchController(http.Controller):
res.update({
'username': user.sudo().name,
- 'userimage': '/web/image?model=res.users&id=%s&field=image_small' % user.id,
+ 'userimage': '/web/image?model=res.users&id=%s&field=image_64' % user.id,
'wallet': request.env['lunch.cashmove'].get_wallet_balance(user, False),
'is_manager': is_manager,
'locations': request.env['lunch.location'].search_read([], ['name']),
diff --git a/addons/lunch/data/lunch_demo.xml b/addons/lunch/data/lunch_demo.xml
index 4fc4ecf2fe3..50306796748 100644
--- a/addons/lunch/data/lunch_demo.xml
+++ b/addons/lunch/data/lunch_demo.xml
@@ -118,7 +118,7 @@
<field name="price">7.5</field>
<field name="supplier_id" ref="supplier_corner"/>
<field name="description">Beef, Bacon, Salad, Cheddar, Fried Onion, BBQ Sauce</field>
- <field name="image" type="base64" file="lunch/static/img/bacon_burger.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/bacon_burger.png"/>
<field name="new_until" eval="datetime.today() + relativedelta(weeks=1)"/>
</record>
@@ -128,7 +128,7 @@
<field name="price">7.0</field>
<field name="supplier_id" ref="supplier_corner"/>
<field name="description">Beef, Cheddar, Salad, Fried Onions, BBQ Sauce</field>
- <field name="image" type="base64" file="lunch/static/img/cheeseburger.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/cheeseburger.png"/>
</record>
<record model="lunch.product" id="product_chicken_curry">
@@ -136,7 +136,7 @@
<field name="category_id" eval="str(ref('categ_sandwich'))"/>
<field name="price">3.0</field>
<field name="supplier_id" ref="supplier_corner"/>
- <field name="image" type="base64" file="lunch/static/img/chicken_curry.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/chicken_curry.png"/>
</record>
<record model="lunch.product" id="product_spicy_tuna">
@@ -144,7 +144,7 @@
<field name="category_id" eval="str(ref('categ_sandwich'))"/>
<field name="price">3.0</field>
<field name="supplier_id" ref="supplier_corner"/>
- <field name="image" type="base64" file="lunch/static/img/chicken_curry.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/chicken_curry.png"/>
</record>
<record model="lunch.product" id="product_mozzarella">
@@ -153,7 +153,7 @@
<field name="price">3.9</field>
<field name="supplier_id" ref="supplier_corner"/>
<field name="description">Mozzarella, Pesto, Tomatoes</field>
- <field name="image" type="base64" file="lunch/static/img/mozza.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/mozza.png"/>
</record>
<record model="lunch.product" id="product_club">
@@ -162,7 +162,7 @@
<field name="price">3.4</field>
<field name="supplier_id" ref="supplier_corner"/>
<field name="description">Ham, Cheese, Vegetables</field>
- <field name="image" type="base64" file="lunch/static/img/club.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/club.png"/>
</record>
<record model="lunch.product" id="product_maki">
@@ -171,7 +171,7 @@
<field name="price">12.0</field>
<field name="supplier_id" ref="supplier_sushi_shop"/>
<field name="description">6 Maki Salmon - 6 Maki Tuna - 6 Maki Shrimp/Avocado</field>
- <field name="image" type="base64" file="lunch/static/img/maki.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/maki.png"/>
<field name="new_until" eval="datetime.today() + relativedelta(weeks=1)"/>
</record>
@@ -181,7 +181,7 @@
<field name="price">13.80</field>
<field name="supplier_id" ref="supplier_sushi_shop"/>
<field name="description">4 Sushi Salmon - 6 Maki Salmon - 4 Sashimi Salmon </field>
- <field name="image" type="base64" file="lunch/static/img/salmon_sushi.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/salmon_sushi.png"/>
<field name="new_until" eval="datetime.today() + relativedelta(weeks=1)"/>
</record>
@@ -191,7 +191,7 @@
<field name="price">14.0</field>
<field name="supplier_id" ref="supplier_sushi_shop"/>
<field name="description">1 Avocado - 1 Salmon - 1 Eggs - 1 Tuna</field>
- <field name="image" type="base64" file="lunch/static/img/temaki.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/temaki.png"/>
<field name="new_until" eval="datetime.today() + relativedelta(weeks=1)"/>
</record>
@@ -201,7 +201,7 @@
<field name="price">9.25</field>
<field name="supplier_id" ref="supplier_sushi_shop"/>
<field name="description">2 Tempuras, Cabbages, Onions, Sesame Sauce</field>
- <field name="image" type="base64" file="lunch/static/img/chirashi.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/chirashi.png"/>
<field name="new_until" eval="datetime.today() + relativedelta(weeks=1)"/>
</record>
@@ -211,7 +211,7 @@
<field name="price">3.30</field>
<field name="supplier_id" eval="str(ref('supplier_coin_gourmand'))"/>
<field name="description">Cheese, Ham, Salad, Tomatoes, cucumbers, eggs</field>
- <field name="image" type="base64" file="lunch/static/img/club.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/club.png"/>
</record>
<record model="lunch.product" id="product_country">
@@ -220,7 +220,7 @@
<field name="price">3.30</field>
<field name="supplier_id" eval="str(ref('supplier_coin_gourmand'))"/>
<field name="description">Brie, Honey, Walnut Kernels</field>
- <field name="image" type="base64" file="lunch/static/img/brie.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/brie.png"/>
</record>
<record model="lunch.product" id="product_tuna">
@@ -229,7 +229,7 @@
<field name="price">2.50</field>
<field name="supplier_id" eval="str(ref('supplier_coin_gourmand'))"/>
<field name="description">Tuna, Mayonnaise</field>
- <field name="image" type="base64" file="lunch/static/img/tuna_sandwich.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/tuna_sandwich.png"/>
</record>
<record model="lunch.product" id="product_gouda">
@@ -238,7 +238,7 @@
<field name="price">2.50</field>
<field name="supplier_id" eval="str(ref('supplier_coin_gourmand'))"/>
<field name="description"></field>
- <field name="image" type="base64" file="lunch/static/img/gouda.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/gouda.png"/>
</record>
<record model="lunch.product" id="product_chicken_curry">
@@ -247,7 +247,7 @@
<field name="price">2.60</field>
<field name="supplier_id" eval="str(ref('supplier_coin_gourmand'))"/>
<field name="description"></field>
- <field name="image" type="base64" file="lunch/static/img/chicken_curry.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/chicken_curry.png"/>
</record>
<record model="lunch.product" id="product_margherita">
@@ -256,7 +256,7 @@
<field name="price">6.90</field>
<field name="supplier_id" eval="str(ref('supplier_pizza_inn'))"/>
<field name="description">Tomatoes, Mozzarella</field>
- <field name="image" type="base64" file="lunch/static/img/pizza_margherita.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/pizza_margherita.png"/>
</record>
<record model="lunch.product" id="product_funghi">
@@ -265,7 +265,7 @@
<field name="price">7.00</field>
<field name="supplier_id" ref="supplier_pizza_inn"/>
<field name="description">Tomatoes, Mushrooms, Mozzarella</field>
- <field name="image" type="base64" file="lunch/static/img/pizza_funghi.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/pizza_funghi.png"/>
</record>
<record model="lunch.product" id="product_vege">
@@ -274,7 +274,7 @@
<field name="price">7.00</field>
<field name="supplier_id" ref="supplier_pizza_inn"/>
<field name="description">Tomatoes, Mozzarella, Mushrooms, Peppers, Olives</field>
- <field name="image" type="base64" file="lunch/static/img/pizza_veggie.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/pizza_veggie.png"/>
</record>
<record model="lunch.product" id="product_italiana">
@@ -283,7 +283,7 @@
<field name="price">7.40</field>
<field name="supplier_id" eval="str(ref('supplier_pizza_inn'))"/>
<field name="description">Fresh Tomatoes, Basil, Mozzarella</field>
- <field name="image" type="base64" file="lunch/static/img/italiana.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/italiana.png"/>
</record>
<record model="lunch.product" id="product_Bolognese">
@@ -292,7 +292,7 @@
<field name="price">7.70</field>
<field name="supplier_id" eval="str(ref('supplier_pizza_inn'))"/>
<field name="description"></field>
- <field name="image" type="base64" file="lunch/static/img/pasta_bolognese.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/pasta_bolognese.png"/>
</record>
<record model="lunch.product" id="product_Napoli">
@@ -301,7 +301,7 @@
<field name="price">7.70</field>
<field name="supplier_id" eval="str(ref('supplier_pizza_inn'))"/>
<field name="description">Tomatoes, Basil</field>
- <field name="image" type="base64" file="lunch/static/img/napoli.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/napoli.png"/>
</record>
<record model="lunch.topping" id="product_olives">
@@ -316,7 +316,7 @@
<field name="price">5.50</field>
<field name="supplier_id" ref="supplier_pizza_inn"/>
<field name="description">Tomato sauce, Olive oil, Fresh Tomatoes, Onions, Vegetables, Parmesan</field>
- <field name="image" type="base64" file="lunch/static/img/4formaggio.png"/>
+ <field name="image_1920" type="base64" file="lunch/static/img/4formaggio.png"/>
</record>
<record model="lunch.cashmove" id="cashmove_1">
diff --git a/addons/lunch/models/lunch_product.py b/addons/lunch/models/lunch_product.py
index b46d212adf8..3d668857f1c 100644
--- a/addons/lunch/models/lunch_product.py
+++ b/addons/lunch/models/lunch_product.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from odoo import api, fields, models, tools
+from odoo import api, fields, models
from odoo.tools import formatLang
@@ -85,6 +85,7 @@ class LunchProduct(models.Model):
""" Products available to order. A product is linked to a specific vendor. """
_name = 'lunch.product'
_description = 'Lunch Product'
+ _inherit = 'image.mixin'
_order = 'name'
name = fields.Char('Product Name', required=True)
@@ -97,30 +98,5 @@ class LunchProduct(models.Model):
company_id = fields.Many2one('res.company', related='supplier_id.company_id', store=True)
currency_id = fields.Many2one('res.currency', related='company_id.currency_id')
- # image: all image fields are base64 encoded and PIL-supported
- image = fields.Binary(
- "Image",
- help="This field holds the image used as image for the product, limited to 1024x1024px.")
- image_medium = fields.Binary(
- "Medium-sized image",
- help="Medium-sized image of the product. It is automatically "
- "resized as a 128x128px image, with aspect ratio preserved, "
- "only when the image exceeds one of those sizes. Use this field in form views or some kanban views.")
- image_small = fields.Binary(
- "Small-sized image",
- help="Small-sized image of the product. It is automatically "
- "resized as a 64x64px image, with aspect ratio preserved. "
- "Use this field anywhere a small image is required.")
-
new_until = fields.Date('New Until')
favorite_user_ids = fields.Many2many('res.users', 'lunch_product_favorite_user_rel', 'product_id', 'user_id')
-
- @api.model_create_multi
- def create(self, vals_list):
- for values in vals_list:
- tools.image_resize_images(values)
- return super(LunchProduct, self).create(vals_list)
-
- def write(self, values):
- tools.image_resize_images(values)
- return super(LunchProduct, self).write(values)
diff --git a/addons/lunch/report/lunch_cashmove_report_views.xml b/addons/lunch/report/lunch_cashmove_report_views.xml
index 73f091ccb92..64dba141ea4 100644
--- a/addons/lunch/report/lunch_cashmove_report_views.xml
+++ b/addons/lunch/report/lunch_cashmove_report_views.xml
@@ -106,7 +106,7 @@
<t t-esc="record.date.value"/>
</div>
<div class="col-6">
- <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
+ <img t-att-src="kanban_image('res.users', 'image_64', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
</div>
</div>
</div>
diff --git a/addons/lunch/views/lunch_cashmove_views.xml b/addons/lunch/views/lunch_cashmove_views.xml
index dec3bbf9e50..d1cafa0e47b 100644
--- a/addons/lunch/views/lunch_cashmove_views.xml
+++ b/addons/lunch/views/lunch_cashmove_views.xml
@@ -77,7 +77,7 @@
<t t-esc="record.date.value"/>
</div>
<div class="col-6">
- <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
+ <img t-att-src="kanban_image('res.users', 'image_64', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
</div>
</div>
</div>
diff --git a/addons/lunch/views/lunch_orders_views.xml b/addons/lunch/views/lunch_orders_views.xml
index 0995e6cf484..ef79c6c7b24 100644
--- a/addons/lunch/views/lunch_orders_views.xml
+++ b/addons/lunch/views/lunch_orders_views.xml
@@ -88,7 +88,7 @@
</a>
</div>
<div class="col-6">
- <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
+ <img t-att-src="kanban_image('res.users', 'image_64', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
</div>
</div>
</div>
diff --git a/addons/lunch/views/lunch_product_views.xml b/addons/lunch/views/lunch_product_views.xml
index 6c69f416c68..e328753add1 100644
--- a/addons/lunch/views/lunch_product_views.xml
+++ b/addons/lunch/views/lunch_product_views.xml
@@ -46,7 +46,7 @@
<field name="currency_id" invisible="1"/>
<sheet>
<widget name="web_ribbon" text="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
- <field name="image" widget="image" class="oe_avatar" options="{'preview_image': 'image_medium'}"/>
+ <field name="image_1920" widget="image" class="oe_avatar" options="{'preview_image': 'image_128'}"/>
<div class="oe_title">
<label for="name" class="oe-edit-only"/>
<h1>
@@ -89,7 +89,7 @@
<t t-name="kanban-box">
<div class="oe_kanban_global_click o_kanban_record_has_image_fill o_kanban_record">
<div class="o_kanban_image_fill_left d-none d-md-block"
- t-attf-style="background-image:url('#{kanban_image('lunch.product', 'image_medium', record.product_id.raw_value)}')"/>
+ t-attf-style="background-image:url('#{kanban_image('lunch.product', 'image_128', record.product_id.raw_value)}')"/>
<div class="oe_kanban_details">
<div class="o_kanban_record_top">
<div class="o_kanban_record_headings">
@@ -137,7 +137,7 @@
<t t-name="kanban-box">
<div class="oe_kanban_global_click o_kanban_record_has_image_fill o_kanban_record">
<div class="o_kanban_image_fill_left d-none d-md-block"
- t-attf-style="background-image:url('#{kanban_image('lunch.product', 'image_medium', record.id.raw_value)}')"/>
+ t-attf-style="background-image:url('#{kanban_image('lunch.product', 'image_128', record.id.raw_value)}')"/>
<div class="oe_kanban_details">
<div class="o_kanban_record_top">
<div class="o_kanban_record_headings">
diff --git a/addons/lunch/wizard/lunch_line_wizard.py b/addons/lunch/wizard/lunch_line_wizard.py
index 3678449a615..4bdc3b1eb7c 100644
--- a/addons/lunch/wizard/lunch_line_wizard.py
+++ b/addons/lunch/wizard/lunch_line_wizard.py
@@ -47,9 +47,8 @@ class LunchOrderWizard(models.TransientModel):
available_toppings_2 = fields.Boolean(help='Are extras available for this product', compute='_compute_available_toppings')
available_toppings_3 = fields.Boolean(help='Are extras available for this product', compute='_compute_available_toppings')
- image = fields.Binary(related='product_id.image')
- image_medium = fields.Binary(related='product_id.image_medium')
- image_small = fields.Binary(related='product_id.image_small')
+ image_1920 = fields.Image(related='product_id.image_1920')
+ image_128 = fields.Image(related='product_id.image_128')
quantity = fields.Float('Quantity', default=1)
price_total = fields.Float('Total Price', compute='_compute_price_total')
diff --git a/addons/lunch/wizard/lunch_line_wizard_views.xml b/addons/lunch/wizard/lunch_line_wizard_views.xml
index 94afac2e5f4..7c8879f452d 100644
--- a/addons/lunch/wizard/lunch_line_wizard_views.xml
+++ b/addons/lunch/wizard/lunch_line_wizard_views.xml
@@ -16,7 +16,7 @@
<field name="edit" invisible="1"/>
<div class="d-flex">
<div class="flex-grow-0 pr-5">
- <field name="image_medium" widget="image" class="o_lunch_image" />
+ <field name="image_1920" widget="image" class="o_lunch_image" options="{'image_preview': 'image_128'}"/>
</div>
<div class="flex-grow-1 pr-5">
<h2><field name="product_name"/></h2>
diff --git a/addons/mail/controllers/main.py b/addons/mail/controllers/main.py
index b540d428ba0..bc20f0caac5 100644
--- a/addons/mail/controllers/main.py
+++ b/addons/mail/controllers/main.py
@@ -241,7 +241,7 @@ class MailController(http.Controller):
request.env[res_model].browse(res_id).check_access_rule('read')
if partner_id in request.env[res_model].browse(res_id).sudo().exists().message_ids.mapped('author_id').ids:
status, headers, _content = request.env['ir.http'].sudo().binary_content(
- model='res.partner', id=partner_id, field='image_medium', default_mimetype='image/png')
+ model='res.partner', id=partner_id, field='image_128', default_mimetype='image/png')
# binary content return an empty string and not a placeholder if obj[field] is False
if _content != '':
content = _content
diff --git a/addons/mail/models/mail_channel.py b/addons/mail/models/mail_channel.py
index 2b56951fb4f..974897c3c1c 100644
--- a/addons/mail/models/mail_channel.py
+++ b/addons/mail/models/mail_channel.py
@@ -12,7 +12,6 @@ from odoo import _, api, fields, models, modules, tools
from odoo.exceptions import UserError, ValidationError
from odoo.osv import expression
from odoo.tools import ormcache
-from odoo.tools.safe_eval import safe_eval
MODERATION_FIELDS = ['moderation', 'moderator_ids', 'moderation_ids', 'moderation_notify', 'moderation_notify_msg', 'moderation_guidelines', 'moderation_guidelines_msg']
_logger = logging.getLogger(__name__)
@@ -64,7 +63,7 @@ class Channel(models.Model):
def _get_default_image(self):
image_path = modules.get_module_resource('mail', 'static/src/img', 'groupdefault.png')
- return tools.image_process(base64.b64encode(open(image_path, 'rb').read()), size=tools.IMAGE_BIG_SIZE)
+ return base64.b64encode(open(image_path, 'rb').read())
@api.model
def default_get(self, fields):
@@ -101,17 +100,7 @@ class Channel(models.Model):
help="Members of those groups will automatically added as followers. "
"Note that they will be able to manage their subscription manually "
"if necessary.")
- # image: all image fields are base64 encoded and PIL-supported
- image = fields.Binary("Photo", default=_get_default_image,
- help="This field holds the image used as photo for the group, limited to 1024x1024px.")
- image_medium = fields.Binary('Medium-sized photo',
- help="Medium-sized photo of the group. 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 photo',
- help="Small-sized photo of the group. It is automatically "
- "resized as a 64x64px image, with aspect ratio preserved. "
- "Use this field anywhere a small image is required.")
+ image_128 = fields.Image("Image", max_width=128, max_height=128, default=_get_default_image)
is_subscribed = fields.Boolean(
'Is Subscribed', compute='_compute_is_subscribed')
# moderation
@@ -209,11 +198,10 @@ class Channel(models.Model):
@api.model
def create(self, vals):
# ensure image at quick create
- if not vals.get('image'):
- defaults = self.default_get(['image'])
- vals['image'] = defaults['image']
+ if not vals.get('image_128'):
+ defaults = self.default_get(['image_128'])
+ vals['image_128'] = defaults['image_128']
- tools.image_resize_images(vals)
# Create channel and alias
channel = super(Channel, self.with_context(
alias_model_name=self._name, alias_parent_model_name=self._name, mail_create_nolog=True, mail_create_nosubscribe=True)
@@ -250,7 +238,6 @@ class Channel(models.Model):
if not self.env.user.has_group('base.group_system'):
raise UserError("You do not possess the rights to modify fields related to moderation on one of the channels you are modifying.")
- tools.image_resize_images(vals)
result = super(Channel, self).write(vals)
if vals.get('group_ids'):
diff --git a/addons/mail/models/mail_message.py b/addons/mail/models/mail_message.py
index 229fdb943eb..38426d629bd 100644
--- a/addons/mail/models/mail_message.py
+++ b/addons/mail/models/mail_message.py
@@ -79,7 +79,7 @@ class Message(models.Model):
'res.partner', 'Author', index=True,
ondelete='set null', default=_get_default_author,
help="Author of the message. If not set, email_from may hold an email address that did not match any partner.")
- author_avatar = fields.Binary("Author's avatar", related='author_id.image_small', readonly=False)
+ author_avatar = fields.Binary("Author's avatar", related='author_id.image_64', readonly=False)
# recipients: include inactive partners (they may have been archived after
# the message was sent, but they should remain visible in the relation)
partner_ids = fields.Many2many('res.partner', string='Recipients', context={'active_test': False})
diff --git a/addons/mail/static/src/js/composers/basic_composer.js b/addons/mail/static/src/js/composers/basic_composer.js
index 2a496faf86d..d79a7c93028 100644
--- a/addons/mail/static/src/js/composers/basic_composer.js
+++ b/addons/mail/static/src/js/composers/basic_composer.js
@@ -100,7 +100,7 @@ var BasicComposer = Widget.extend({
this.avatarURL = session.uid > 0 ? session.url('/web/image', {
model: 'res.users',
- field: 'image_small',
+ field: 'image_64',
id: session.uid,
}) : '/web/static/src/img/user_menu_avatar.png';
},
diff --git a/addons/mail/static/src/js/followers.js b/addons/mail/static/src/js/followers.js
index 751187608ae..b6dc5ff6996 100644
--- a/addons/mail/static/src/js/followers.js
+++ b/addons/mail/static/src/js/followers.js
@@ -36,7 +36,7 @@ var Followers = AbstractField.extend({
init: function (parent, name, record, options) {
this._super.apply(this, arguments);
- this.image = this.attrs.image || 'image_small';
+ this.image = this.attrs.image || 'image_64';
this.comment = this.attrs.help || false;
this.followers = [];
@@ -120,7 +120,7 @@ var Followers = AbstractField.extend({
}
$follower_li = $(QWeb.render('mail.Followers.partner', {
- 'record': _.extend(record, {'avatar_url': '/web/image/' + record.res_model + '/' + record.res_id + '/image_small'}),
+ 'record': _.extend(record, {'avatar_url': '/web/image/' + record.res_model + '/' + record.res_id + '/image_64'}),
'widget': self})
);
$follower_li.appendTo($followers_list);
diff --git a/addons/mail/static/src/js/models/messages/message.js b/addons/mail/static/src/js/models/messages/message.js
index f93209a913f..d22569461e5 100644
--- a/addons/mail/static/src/js/models/messages/message.js
+++ b/addons/mail/static/src/js/models/messages/message.js
@@ -94,7 +94,7 @@ var Message = AbstractMessage.extend(Mixins.EventDispatcherMixin, ServicesMixin
if (this._isOdoobotAuthor()) {
return '/mail/static/src/img/odoobot.png';
} else if (this.hasAuthor()) {
- return '/web/image/res.partner/' + this.getAuthorID() + '/image_small';
+ return '/web/image/res.partner/' + this.getAuthorID() + '/image_64';
} else if (this.getType() === 'email') {
return '/mail/static/src/img/email_icon.png';
}
diff --git a/addons/mail/static/src/js/models/threads/channel.js b/addons/mail/static/src/js/models/threads/channel.js
index 9e9f3ac6a39..83a0a259e94 100644
--- a/addons/mail/static/src/js/models/threads/channel.js
+++ b/addons/mail/static/src/js/models/threads/channel.js
@@ -220,7 +220,7 @@ var Channel = SearchableThread.extend(ThreadTypingMixin, {
getPreview: function () {
var result = this._super.apply(this, arguments);
if (!this.isTwoUserThread()) {
- result.imageSRC = '/web/image/mail.channel/' + this.getID() + '/image_small';
+ result.imageSRC = '/web/image/mail.channel/' + this.getID() + '/image_128';
}
var lastMessage = this.getLastMessage();
return _.extend(result, {
diff --git a/addons/mail/static/src/js/models/threads/dm_chat.js b/addons/mail/static/src/js/models/threads/dm_chat.js
index 78cc01a7044..b53637e614b 100644
--- a/addons/mail/static/src/js/models/threads/dm_chat.js
+++ b/addons/mail/static/src/js/models/threads/dm_chat.js
@@ -91,7 +91,7 @@ var DMChat = TwoUserChannel.extend(ChannelSeenMixin, {
*/
getPreview: function () {
var result = this._super.apply(this, arguments);
- result.imageSRC = '/web/image/res.partner/' + this.getDirectPartnerID() + '/image_small';
+ result.imageSRC = '/web/image/res.partner/' + this.getDirectPartnerID() + '/image_64';
return result;
},
/**
diff --git a/addons/mail/static/src/xml/activity.xml b/addons/mail/static/src/xml/activity.xml
index 11b4b0e9022..d399439d79e 100644
--- a/addons/mail/static/src/xml/activity.xml
+++ b/addons/mail/static/src/xml/activity.xml
@@ -17,7 +17,7 @@
<div class="o_thread_message" style="margin-bottom: 10px">
<div class="o_thread_message_sidebar">
<div class="o_avatar_stack">
- <img t-attf-src="/web/image#{activity.user_id[0] >= 0 ? ('/res.users/' + activity.user_id[0] + '/image_small') : ''}" class="o_thread_message_avatar rounded-circle mb8" t-att-title="activity.user_id[1]" t-att-alt="activity.user_id[1]"/>
+ <img t-attf-src="/web/image#{activity.user_id[0] >= 0 ? ('/res.users/' + activity.user_id[0] + '/image_64') : ''}" class="o_thread_message_avatar rounded-circle mb8" t-att-title="activity.user_id[1]" t-att-alt="activity.user_id[1]"/>
<i t-att-class="'o_avatar_icon fa ' + activity.icon + ' bg-' + (activity.state == 'planned'? 'success' : (activity.state == 'today'? 'warning' : 'danger')) + '-full'"
t-att-title="activity.activity_type_id[1]"/>
</div>
@@ -42,7 +42,7 @@
<dd class="mb8">
<t t-esc="activity.create_date.format(datetimeFormat)"/>
by
- <img t-attf-src="/web/image#{activity.create_uid[0] >= 0 ? ('/res.users/' + activity.create_uid[0] + '/image_small') : ''}"
+ <img t-attf-src="/web/image#{activity.create_uid[0] >= 0 ? ('/res.users/' + activity.create_uid[0] + '/image_64') : ''}"
height="18" width="18"
class="rounded-circle mr4"
t-att-title="activity.create_uid[1]"
@@ -51,7 +51,7 @@
</dd>
<dt>Assigned to</dt>
<dd class="mb8">
- <img t-attf-src="/web/image#{activity.user_id[0] >= 0 ? ('/res.users/' + activity.user_id[0] + '/image_small') : ''}" height="18" width="18" class="rounded-circle mr4" t-att-title="activity.user_id[1]" t-att-alt="activity.user_id[1]"/>
+ <img t-attf-src="/web/image#{activity.user_id[0] >= 0 ? ('/res.users/' + activity.user_id[0] + '/image_64') : ''}" height="18" width="18" class="rounded-circle mr4" t-att-title="activity.user_id[1]" t-att-alt="activity.user_id[1]"/>
<b><t t-esc="activity.user_id[1]"/></b>
<em>, due on </em><span t-attf-class="o_activity_color_#{activity.state}"><t t-esc="activity.date_deadline.format(dateFormat)"/></span>
</dd>
diff --git a/addons/mail/views/mail_channel_views.xml b/addons/mail/views/mail_channel_views.xml
index 40911a053ff..7667d2b47fe 100644
--- a/addons/mail/views/mail_channel_views.xml
+++ b/addons/mail/views/mail_channel_views.xml
@@ -61,7 +61,7 @@
</t>
<t t-name="kanban-box">
<div class="oe_module_vignette oe_kanban_global_click">
- <img t-att-src="kanban_image('mail.channel', 'image_medium', record.id.raw_value)" class="oe_module_icon" alt="Channel"/>
+ <img t-att-src="kanban_image('mail.channel', 'image_128', record.id.raw_value)" class="oe_module_icon" alt="Channel"/>
<div class="oe_module_desc">
<h4 class="o_kanban_record_title">#<field name="name"/></h4>
<p class="oe_module_name">
@@ -94,7 +94,7 @@
</button>
</div>
<div class="oe_button_box" name="button_box"/>
- <field name="image" widget="image" class="oe_avatar" options="{'preview_image': 'image_medium', 'size': [90, 90]}"/>
+ <field name="image_128" widget="image" class="oe_avatar" options="{'size': [90, 90]}"/>
<div class="oe_title">
<div class="oe_edit_only">
<label for="name"/>
diff --git a/addons/mail/views/mail_message_views.xml b/addons/mail/views/mail_message_views.xml
index 6839b357611..4581e3efb41 100644
--- a/addons/mail/views/mail_message_views.xml
+++ b/addons/mail/views/mail_message_views.xml
@@ -183,7 +183,7 @@
<field name="create_date" widget="date"/>
</time>
<div class="oe_kanban_bottom_right">
- <img t-att-src="kanban_image('res.users', 'image_small', record.create_uid.raw_value)" t-att-data-member_id="record.create_uid.raw_value" t-att-alt="record.create_uid.raw_value" width="32" height="32" class="oe_kanban_avatar"/>
+ <img t-att-src="kanban_image('res.users', 'image_64', record.create_uid.raw_value)" t-att-data-member_id="record.create_uid.raw_value" t-att-alt="record.create_uid.raw_value" width="32" height="32" class="oe_kanban_avatar"/>
</div>
</div>
</div>
diff --git a/addons/mail/views/res_partner_views.xml b/addons/mail/views/res_partner_views.xml
index a620c261b44..3bc62e5c9a3 100644
--- a/addons/mail/views/res_partner_views.xml
+++ b/addons/mail/views/res_partner_views.xml
@@ -57,7 +57,7 @@
<field name="id"/>
<templates>
<div t-name="activity-box">
- <img t-att-src="activity_image('res.partner', 'image_small', record.id.raw_value)" role="img" t-att-title="record.id.value" t-att-alt="record.id.value"/>
+ <img t-att-src="activity_image('res.partner', 'image_64', record.id.raw_value)" role="img" t-att-title="record.id.value" t-att-alt="record.id.value"/>
<div>
<field name="name" display="full"/>
<field name="parent_id" muted="1" display="full"/>
diff --git a/addons/mail_bot/data/mailbot_data.xml b/addons/mail_bot/data/mailbot_data.xml
index b772ffd5951..20233fd7310 100644
--- a/addons/mail_bot/data/mailbot_data.xml
+++ b/addons/mail_bot/data/mailbot_data.xml
@@ -4,7 +4,7 @@
<record id="base.partner_root" model="res.partner">
<field name="name">OdooBot</field>
<field name="email">odoobot@example.com</field>
- <field name="image" type="base64" file="mail/static/src/img/odoobot.png"/>
+ <field name="image_1920" type="base64" file="mail/static/src/img/odoobot.png"/>
</record>
</data>
</odoo>
diff --git a/addons/mail_bot/views/res_users_views.xml b/addons/mail_bot/views/res_users_views.xml
index 296e5380485..f82b2b96f72 100644
--- a/addons/mail_bot/views/res_users_views.xml
+++ b/addons/mail_bot/views/res_users_views.xml
@@ -34,7 +34,7 @@
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form_simple_modif"/>
<field name="arch" type="xml">
- <xpath expr="//field[@name='image']" position="before">
+ <xpath expr="//field[@name='image_1920']" position="before">
<widget name="notification_alert"/>
</xpath>
</field>
diff --git a/addons/maintenance/views/maintenance_views.xml b/addons/maintenance/views/maintenance_views.xml
index 400607c118a..e651b315a22 100644
--- a/addons/maintenance/views/maintenance_views.xml
+++ b/addons/maintenance/views/maintenance_views.xml
@@ -166,7 +166,7 @@
</div>
<div class="oe_kanban_bottom_right">
<field name="kanban_state" widget="state_selection"/>
- <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
+ <img t-att-src="kanban_image('res.users', 'image_64', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
</div>
</div>
</div>
@@ -466,7 +466,7 @@
<div class="o_kanban_inline_block">
<field name="activity_ids" widget="kanban_activity" />
</div>
- <img t-att-src="kanban_image('res.users', 'image_small', record.owner_user_id.raw_value)" t-att-title="record.owner_user_id.value" t-att-alt="record.owner_user_id.value" width="27" height="27" class="oe_kanban_avatar"/>
+ <img t-att-src="kanban_image('res.users', 'image_64', record.owner_user_id.raw_value)" t-att-title="record.owner_user_id.value" t-att-alt="record.owner_user_id.value" width="27" height="27" class="oe_kanban_avatar"/>
</div>
</div>
</div>
@@ -660,7 +660,7 @@
<div t-attf-class="oe_kanban_global_click">
<div class="mb4">
<strong><field name="name"/></strong>
- <img t-att-src="kanban_image('res.users', 'image_small', record.technician_user_id.raw_value)" t-att-title="record.technician_user_id.value" t-att-alt="record.technician_user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
+ <img t-att-src="kanban_image('res.users', 'image_64', record.technician_user_id.raw_value)" t-att-title="record.technician_user_id.value" t-att-alt="record.technician_user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
</div>
<div class="row mt4">
<div class="col-6">
diff --git a/addons/mrp/data/mrp_demo.xml b/addons/mrp/data/mrp_demo.xml
index 6f6c7db8e07..5c9311f332e 100644
--- a/addons/mrp/data/mrp_demo.xml
+++ b/addons/mrp/data/mrp_demo.xml
@@ -175,7 +175,7 @@
<field name="description">Solid wood table.</field>
<field name="default_code">FURN_9666</field>
<field name="tracking">serial</field>
- <field name="image" type="base64" file="mrp/static/img/table.png"/>
+ <field name="image_1920" type="base64" file="mrp/static/img/table.png"/>
</record>
<record id="product_product_computer_desk_head" model="product.product">
<field name="name">Table Top</field>
@@ -189,7 +189,7 @@
<field name="description">Solid wood is a durable natural material.</field>
<field name="default_code">FURN_8522</field>
<field name="tracking">serial</field>
- <field name="image" type="base64" file="mrp/static/img/table_top.png"/>
+ <field name="image_1920" type="base64" file="mrp/static/img/table_top.png"/>
</record>
<record id="product_product_computer_desk_leg" model="product.product">
<field name="name">Table Leg</field>
@@ -203,7 +203,7 @@
<field name="description">18″ x 2½″ Square Leg</field>
<field name="default_code">FURN_2333</field>
<field name="tracking">lot</field>
- <field name="image" type="base64" file="mrp/static/img/table_leg.png"/>
+ <field name="image_1920" type="base64" file="mrp/static/img/table_leg.png"/>
</record>
<record id="product_product_computer_desk_bolt" model="product.product">
<field name="name">Bolt</field>
@@ -216,7 +216,7 @@
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="description">Stainless steel screw full (dia - 5mm, Length - 10mm)</field>
<field name="default_code">CONS_89957</field>
- <field name="image" type="base64" file="mrp/static/img/product_product_computer_desk_bolt.png"/>
+ <field name="image_1920" type="base64" file="mrp/static/img/product_product_computer_desk_bolt.png"/>
</record>
<record id="product_product_computer_desk_screw" model="product.product">
<field name="name">Screw</field>
@@ -229,7 +229,7 @@
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="description">Stainless steel screw</field>
<field name="default_code">CONS_25630</field>
- <field name="image" type="base64" file="mrp/static/img/product_product_computer_desk_screw.png"/>
+ <field name="image_1920" type="base64" file="mrp/static/img/product_product_computer_desk_screw.png"/>
</record>
<record id="product_product_wood_ply" model="product.product">
@@ -243,7 +243,7 @@
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="description">Layers that are stick together to assemble wood panels.</field>
<field name="default_code">FURN_7111</field>
- <field name="image" type="base64" file="mrp/static/img/product_product_wood_ply.png"/>
+ <field name="image_1920" type="base64" file="mrp/static/img/product_product_wood_ply.png"/>
</record>
<record id="product_product_wood_wear" model="product.product">
<field name="name">Wear Layer</field>
@@ -256,7 +256,7 @@
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="description">Top layer of a wood panel.</field>
<field name="default_code">FURN_8111</field>
- <field name="image" type="base64" file="mrp/static/img/product_product_wood_wear.png"/>
+ <field name="image_1920" type="base64" file="mrp/static/img/product_product_wood_wear.png"/>
</record>
<record id="product_product_ply_veneer" model="product.product">
<field name="name">Ply Veneer</field>
@@ -268,7 +268,7 @@
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="default_code">FURN_9111</field>
- <field name="image" type="base64" file="mrp/static/img/product_product_ply_veneer.png"/>
+ <field name="image_1920" type="base64" file="mrp/static/img/product_product_ply_veneer.png"/>
</record>
<record id="product_product_wood_panel" model="product.product">
@@ -281,7 +281,7 @@
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="default_code">FURN_7023</field>
- <field name="image" type="base64" file="mrp/static/img/product_product_wood_panel.png"/>
+ <field name="image_1920" type="base64" file="mrp/static/img/product_product_wood_panel.png"/>
</record>
<record id="product_product_plastic_laminate" model="product.product">
<field name="name">Plastic Laminate</field>
@@ -293,7 +293,7 @@
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="default_code">FURN_8621</field>
- <field name="image" type="base64" file="mrp/static/img/product_product_plastic_laminate.png"/>
+ <field name="image_1920" type="base64" file="mrp/static/img/product_product_plastic_laminate.png"/>
</record>
<record id="product_product_computer_desk_product_template" model="product.template">
@@ -423,7 +423,7 @@
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="description">Table kit</field>
<field name="default_code">FURN_78236</field>
- <field name="image" type="base64" file="mrp/static/img/product_product_table_kit.png"/>
+ <field name="image_1920" type="base64" file="mrp/static/img/product_product_table_kit.png"/>
</record>
<record id="product_product_table_kit_product_template" model="product.template">
@@ -467,7 +467,7 @@
<field name="description">Drawer on casters for great usability.</field>
<field name="default_code">FURN_2100</field>
<field name="barcode">601647855646</field>
- <field name="image" type="base64" file="mrp/static/img/product_product_drawer_black.png"/>
+ <field name="image_1920" type="base64" file="mrp/static/img/product_product_drawer_black.png"/>
</record>
<record id="product_product_drawer_case" model="product.product">
@@ -482,7 +482,7 @@
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="default_code">FURN_5623</field>
<field name="barcode">601647855647</field>
- <field name="image" type="base64" file="mrp/static/img/product_product_drawer_case_black.png"/>
+ <field name="image_1920" type="base64" file="mrp/static/img/product_product_drawer_case_black.png"/>
</record>
<record id="product.product_product_27" model="product.product">
diff --git a/addons/mrp/views/ir_attachment_view.xml b/addons/mrp/views/ir_attachment_view.xml
index 415ae3a5233..98104a35446 100644
--- a/addons/mrp/views/ir_attachment_view.xml
+++ b/addons/mrp/views/ir_attachment_view.xml
@@ -37,7 +37,7 @@
<field name="priority" widget="priority"/>
</span>
<div class="oe_kanban_bottom_right">
- <img t-att-src="kanban_image('res.users', 'image_small', record.create_uid.raw_value)" t-att-data-member_id="record.create_uid.raw_value" t-att-alt="record.create_uid.raw_value" width="32" height="32" class="oe_kanban_avatar"/>
+ <img t-att-src="kanban_image('res.users', 'image_64', record.create_uid.raw_value)" t-att-data-member_id="record.create_uid.raw_value" t-att-alt="record.create_uid.raw_value" width="32" height="32" class="oe_kanban_avatar"/>
</div>
</div>
</div>
diff --git a/addons/mrp/views/mrp_workorder_views.xml b/addons/mrp/views/mrp_workorder_views.xml
index 21f08de5eda..9c7538b15cf 100644
--- a/addons/mrp/views/mrp_workorder_views.xml
+++ b/addons/mrp/views/mrp_workorder_views.xml
@@ -389,7 +389,7 @@
<span t-if="record.working_state.raw_value != 'blocked' and record.working_user_ids.raw_value.length == 0 and record.last_working_user_id.raw_value"><i class="fa fa-pause" role="img" aria-label="Pause" title="Pause"/></span>
<span t-if="record.working_state.raw_value == 'blocked' and (record.working_user_ids.raw_value.length == 0 or record.last_working_user_id.raw_value)"><i class="fa fa-stop" role="img" aria-label="Stop" title="Stop"/></span>
<t t-if="record.last_working_user_id.raw_value">
- <img t-att-src="kanban_image('res.users', 'image_small', record.last_working_user_id.raw_value)" width="24" height="24" class="oe_kanban_avatar" alt="Avatar"/>
+ <img t-att-src="kanban_image('res.users', 'image_64', record.last_working_user_id.raw_value)" width="24" height="24" class="oe_kanban_avatar" alt="Avatar"/>
</t>
</div>
</div>
diff --git a/addons/note/views/note_views.xml b/addons/note/views/note_views.xml
index 72cf447c597..f27497b43d7 100644
--- a/addons/note/views/note_views.xml
+++ b/addons/note/views/note_views.xml
@@ -122,7 +122,7 @@
<t t-if="record.message_partner_ids.raw_value.length &gt; 1">
<div class="clearfix"></div>
<t t-foreach="record.message_partner_ids.raw_value" t-as="follower">
- <img t-att-src="kanban_image('res.partner', 'image_small', follower)" width="24" height="24" class="oe_kanban_avatar float-right" t-att-data-member_id="follower" alt="Follower"/>
+ <img t-att-src="kanban_image('res.partner', 'image_64', follower)" width="24" height="24" class="oe_kanban_avatar float-right" t-att-data-member_id="follower" alt="Follower"/>
</t>
<div class="clearfix"></div>
</t>
diff --git a/addons/partner_autocomplete/static/src/js/partner_autocomplete_fieldchar.js b/addons/partner_autocomplete/static/src/js/partner_autocomplete_fieldchar.js
index c1fab81a194..69a1332122e 100644
--- a/addons/partner_autocomplete/static/src/js/partner_autocomplete_fieldchar.js
+++ b/addons/partner_autocomplete/static/src/js/partner_autocomplete_fieldchar.js
@@ -115,7 +115,7 @@ var FieldAutocomplete = FieldChar.extend(AutocompleteMixin, {
var self = this;
this._getCreateData(company).then(function (data) {
if (data.logo) {
- var logoField = self.model === 'res.partner' ? 'image' : 'logo';
+ var logoField = self.model === 'res.partner' ? 'image_1920' : 'logo';
data.company[logoField] = data.logo;
}
diff --git a/addons/partner_autocomplete/static/tests/partner_autocomplete_tests.js b/addons/partner_autocomplete/static/tests/partner_autocomplete_tests.js
index b524dba75a6..c605c9bc33c 100644
--- a/addons/partner_autocomplete/static/tests/partner_autocomplete_tests.js
+++ b/addons/partner_autocomplete/static/tests/partner_autocomplete_tests.js
@@ -15,7 +15,7 @@ odoo.define('partner_autocomplete.tests', function (require) {
_.each(createData, function (val, key) {
if (fields[key]) {
- if (key === 'image') {
+ if (key === 'image_1920') {
if (val) val = 'data:image/png;base64,' + val;
assert.hasAttrValue(form.$(".o_field_image img"), "data-src", val, 'image value should have been updated to "' + val + '"');
} else {
@@ -123,7 +123,7 @@ odoo.define('partner_autocomplete.tests', function (require) {
name: {string: "Name", type: "char", searchable: true},
parent_id: {string: "Company", type: "many2one", relation: "res.partner"},
website: {string: "Website", type: "char", searchable: true},
- image: {string: "Image", type: "binary", searchable: true},
+ image_1920: {string: "Image", type: "binary", searchable: true},
email: {string: "Email", type: "char", searchable: true},
phone: {string: "Phone", type: "char", searchable: true},
street: {string: "Street", type: "char", searchable: true},
@@ -163,7 +163,7 @@ odoo.define('partner_autocomplete.tests', function (require) {
'<field name="company_type"/>' +
'<field name="name" widget="field_partner_autocomplete"/>' +
'<field name="website"/>' +
- '<field name="image" widget="image"/>' +
+ '<field name="image_1920" widget="image"/>' +
'</form>',
}).then(function (form){
// Set company type to Individual
@@ -198,7 +198,7 @@ odoo.define('partner_autocomplete.tests', function (require) {
'<field name="company_type"/>' +
'<field name="name" widget="field_partner_autocomplete"/>' +
'<field name="website"/>' +
- '<field name="image" widget="image"/>' +
+ '<field name="image_1920" widget="image"/>' +
'<field name="email"/>' +
'<field name="phone"/>' +
'<field name="street"/>' +
@@ -272,7 +272,7 @@ odoo.define('partner_autocomplete.tests', function (require) {
'<field name="company_type"/>' +
'<field name="name" widget="field_partner_autocomplete"/>' +
'<field name="website"/>' +
- '<field name="image" widget="image"/>' +
+ '<field name="image_1920" widget="image"/>' +
'<field name="email"/>' +
'<field name="phone"/>' +
'<field name="street"/>' +
diff --git a/addons/payment/data/payment_acquirer_data.xml b/addons/payment/data/payment_acquirer_data.xml
index b9040c22757..8ff2324d2a7 100644
--- a/addons/payment/data/payment_acquirer_data.xml
+++ b/addons/payment/data/payment_acquirer_data.xml
@@ -14,7 +14,7 @@
<record id="payment_acquirer_buckaroo" model="payment.acquirer">
<field name="name">Buckaroo</field>
- <field name="image" type="base64" file="payment_buckaroo/static/src/img/buckaroo_icon.png"/>
+ <field name="image_128" type="base64" file="payment_buckaroo/static/src/img/buckaroo_icon.png"/>
<field name="view_template_id" ref="default_acquirer_button"/>
<field name="module_id" ref="base.module_payment_buckaroo"/>
<field name="description" type="html">
@@ -38,7 +38,7 @@
<field name="name">Ingenico</field>
<field name="sequence">2</field>
<field name="view_template_id" ref="default_acquirer_button"/>
- <field name="image" type="base64" file="payment_ogone/static/src/img/ogone_icon.png"/>
+ <field name="image_128" type="base64" file="payment_ogone/static/src/img/ogone_icon.png"/>
<field name="module_id" ref="base.module_payment_ogone"/>
<field name="description" type="html">
<p>
@@ -61,7 +61,7 @@
<record id="payment_acquirer_adyen" model="payment.acquirer">
<field name="name">Adyen</field>
<field name="view_template_id" ref="default_acquirer_button"/>
- <field name="image" type="base64" file="payment_adyen/static/src/img/adyen_icon.png"/>
+ <field name="image_128" type="base64" file="payment_adyen/static/src/img/adyen_icon.png"/>
<field name="module_id" ref="base.module_payment_adyen"/>
<field name="description" type="html">
<p>
@@ -87,7 +87,7 @@
<field name="name">Authorize.net</field>
<field name="sequence">3</field>
<field name="view_template_id" ref="default_acquirer_button"/>
- <field name="image" type="base64" file="payment_authorize/static/src/img/authorize_icon.png"/>
+ <field name="image_128" type="base64" file="payment_authorize/static/src/img/authorize_icon.png"/>
<field name="module_id" ref="base.module_payment_authorize"/>
<field name="description" type="html">
<p>
@@ -114,7 +114,7 @@
<field name="name">Wire Transfer</field>
<field name="sequence">2</field>
<field name="view_template_id" ref="default_acquirer_button"/>
- <field name="image" type="base64" file="payment_transfer/static/src/img/transfer_icon.png"/>
+ <field name="image_128" type="base64" file="payment_transfer/static/src/img/transfer_icon.png"/>
<field name="module_id" ref="base.module_payment_transfer"/>
<field name="pending_msg">&lt;i&gt;Pending&lt;/i&gt;... The order will be validated after the payment.</field>
<field name="description" type="html">
@@ -127,7 +127,7 @@
<record id="payment_acquirer_sips" model="payment.acquirer">
<field name="name">Sips</field>
<field name="view_template_id" ref="default_acquirer_button"/>
- <field name="image" type="base64" file="payment_sips/static/src/img/sips_icon.png"/>
+ <field name="image_128" type="base64" file="payment_sips/static/src/img/sips_icon.png"/>
<field name="module_id" ref="base.module_payment_sips"/>
<field name="description" type="html">
<p>
@@ -154,7 +154,7 @@
<field name="name">Paypal</field>
<field name="sequence">1</field>
<field name="view_template_id" ref="default_acquirer_button"/>
- <field name="image" type="base64" file="payment_paypal/static/src/img/paypal_icon.png"/>
+ <field name="image_128" type="base64" file="payment_paypal/static/src/img/paypal_icon.png"/>
<field name="module_id" ref="base.module_payment_paypal"/>
<field name="description" type="html">
<p>
@@ -179,7 +179,7 @@
<record id="payment_acquirer_stripe" model="payment.acquirer">
<field name="name">Stripe</field>
<field name="view_template_id" ref="default_acquirer_button"/>
- <field name="image" type="base64" file="payment_stripe/static/src/img/stripe_icon.png"/>
+ <field name="image_128" type="base64" file="payment_stripe/static/src/img/stripe_icon.png"/>
<field name="module_id" ref="base.module_payment_stripe"/>
<field name="description" type="html">
<p>
@@ -222,7 +222,7 @@
<record id="payment_acquirer_payu" model="payment.acquirer">
<field name="name">PayUmoney</field>
- <field name="image" type="base64" file="payment_payumoney/static/src/img/payumoney_icon.png"/>
+ <field name="image_128" type="base64" file="payment_payumoney/static/src/img/payumoney_icon.png"/>
<field name="view_template_id" ref="default_acquirer_button"/>
<field name="module_id" ref="base.module_payment_payumoney"/>
<field name="description" type="html">
@@ -245,7 +245,7 @@
<record id="payment_acquirer_payulatam" model="payment.acquirer">
<field name="name">PayU Latam</field>
- <field name="image" type="base64" file="payment_payulatam/static/src/img/payulatam_icon.png"/>
+ <field name="image_128" type="base64" file="payment_payulatam/static/src/img/payulatam_icon.png"/>
<field name="view_template_id" ref="default_acquirer_button"/>
<field name="module_id" ref="base.module_payment_payulatam"/>
<field name="description" type="html">
@@ -267,7 +267,7 @@
<record id="payment_acquirer_alipay" model="payment.acquirer">
<field name="name">Alipay</field>
- <field name="image" type="base64" file="payment_alipay/static/description/icon.png"/>
+ <field name="image_128" type="base64" file="payment_alipay/static/description/icon.png"/>
<field name="view_template_id" ref="default_acquirer_button"/>
<field name="module_id" ref="base.module_payment_alipay"/>
<field name="description" type="html">
diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py
index 6595a40399f..5c3f2135590 100644
--- a/addons/payment/models/payment_acquirer.py
+++ b/addons/payment/models/payment_acquirer.py
@@ -8,7 +8,7 @@ from dateutil import relativedelta
import pprint
from odoo import api, exceptions, fields, models, _, SUPERUSER_ID
-from odoo.tools import consteq, float_round, image_resize_images, image_process, ustr
+from odoo.tools import consteq, float_round, image_process, ustr
from odoo.addons.base.models import ir_module
from odoo.exceptions import ValidationError
from odoo.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT
@@ -152,18 +152,7 @@ class PaymentAcquirer(models.Model):
module_id = fields.Many2one('ir.module.module', string='Corresponding Module')
module_state = fields.Selection(selection=ir_module.STATES, string='Installation State', related='module_id.state', readonly=False)
- image = fields.Binary(
- "Image", help="This field holds the image used for this provider, limited to 1024x1024px")
- image_medium = fields.Binary(
- "Medium-sized image",
- help="Medium-sized image of this provider. 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",
- help="Small-sized image of this provider. It is automatically "
- "resized as a 64x64px image, with aspect ratio preserved. "
- "Use this field anywhere a small image is required.")
+ image_128 = fields.Image("Image", max_width=128, max_height=128)
payment_icon_ids = fields.Many2many('payment.icon', string='Supported Payment Icons')
payment_flow = fields.Selection(selection=[('form', 'Redirection to the acquirer website'),
@@ -275,13 +264,11 @@ class PaymentAcquirer(models.Model):
@api.model
def create(self, vals):
- image_resize_images(vals)
record = super(PaymentAcquirer, self).create(vals)
record._check_required_if_provider()
return record
def write(self, vals):
- image_resize_images(vals)
result = super(PaymentAcquirer, self).write(vals)
self._check_required_if_provider()
return result
diff --git a/addons/payment/views/payment_portal_templates.xml b/addons/payment/views/payment_portal_templates.xml
index 9eea5737022..20d519599be 100644
--- a/addons/payment/views/payment_portal_templates.xml
+++ b/addons/payment/views/payment_portal_templates.xml
@@ -112,7 +112,7 @@
<a role="button" t-attf-class="btn btn-#{status} float-right" href="/my/home"><i class="fa fa-arrow-circle-right"/> Back to My Account</a>
</div>
<div class="col-md-6 offset-md-6 text-muted mt16"><!-- FIXME should be in a row... -->
- <span t-field="tx.acquirer_id.image_small" t-att-title="tx.acquirer_id.name" role="img" t-att-aria-label="tx.acquirer_id.name" t-options='{"widget": "image", "style":"max-width: 60px; display: inline-block"}'/>
+ <span t-field="tx.acquirer_id.image_128" t-att-title="tx.acquirer_id.name" role="img" t-att-aria-label="tx.acquirer_id.name" t-options='{"widget": "image", "style":"max-width: 60px; display: inline-block"}'/>
<span>Processed by <t t-esc="tx.acquirer_id.name"/>.</span>
</div>
</div>
diff --git a/addons/payment/views/payment_views.xml b/addons/payment/views/payment_views.xml
index ff335bc56e2..0be3849727c 100644
--- a/addons/payment/views/payment_views.xml
+++ b/addons/payment/views/payment_views.xml
@@ -61,7 +61,7 @@
</div>
</button>
</div>
- <field name="image" widget='image' class="oe_avatar" options='{"preview_image": "image_medium"}'/>
+ <field name="image_128" widget="image" class="oe_avatar"/>
<div class="oe_title">
<h1><field name="name" placeholder="Name"/></h1>
</div>
@@ -157,7 +157,7 @@
<t t-set="installed" t-value="!record.module_id.value || (record.module_id.value &amp;&amp; record.module_state.raw_value === 'installed')"/>
<div t-attf-class="oe_kanban_global_click #{installed and record.website_published.raw_value ? 'oe_kanban_color_5' : 'oe_kanban_color_white'}">
<div class="o_kanban_image">
- <img type="open" t-att-src="kanban_image('payment.acquirer', 'image_small', record.id.raw_value)" alt="Acquirer"/>
+ <img type="open" t-att-src="kanban_image('payment.acquirer', 'image_128', record.id.raw_value)" alt="Acquirer"/>
</div>
<div class="o_payment_acquirer_desc">
<h3 class="mt4"><t t-esc="record.name.value"/></h3>
diff --git a/addons/payment_adyen/data/payment_acquirer_data.xml b/addons/payment_adyen/data/payment_acquirer_data.xml
index a0b6488663d..18e3bb8afde 100644
--- a/addons/payment_adyen/data/payment_acquirer_data.xml
+++ b/addons/payment_adyen/data/payment_acquirer_data.xml
@@ -4,7 +4,7 @@
<record id="payment.payment_acquirer_adyen" model="payment.acquirer">
<field name="name">Adyen</field>
- <field name="image" type="base64" file="payment_adyen/static/src/img/adyen_icon.png"/>
+ <field name="image_128" type="base64" file="payment_adyen/static/src/img/adyen_icon.png"/>
<field name="provider">adyen</field>
<field name="company_id" ref="base.main_company"/>
<field name="view_template_id" ref="adyen_form"/>
diff --git a/addons/payment_authorize/data/payment_acquirer_data.xml b/addons/payment_authorize/data/payment_acquirer_data.xml
index da0e438c41d..293bcbad9e0 100644
--- a/addons/payment_authorize/data/payment_acquirer_data.xml
+++ b/addons/payment_authorize/data/payment_acquirer_data.xml
@@ -4,7 +4,7 @@
<record id="payment.payment_acquirer_authorize" model="payment.acquirer">
<field name="name">Authorize.Net</field>
- <field name="image" type="base64" file="payment_authorize/static/src/img/authorize_icon.png"/>
+ <field name="image_128" type="base64" file="payment_authorize/static/src/img/authorize_icon.png"/>
<field name="provider">authorize</field>
<field name="company_id" ref="base.main_company"/>
<field name="view_template_id" ref="authorize_form"/>
diff --git a/addons/payment_buckaroo/data/payment_acquirer_data.xml b/addons/payment_buckaroo/data/payment_acquirer_data.xml
index db69ed5fa7c..7b11d688844 100644
--- a/addons/payment_buckaroo/data/payment_acquirer_data.xml
+++ b/addons/payment_buckaroo/data/payment_acquirer_data.xml
@@ -4,7 +4,7 @@
<record id="payment.payment_acquirer_buckaroo" model="payment.acquirer">
<field name="name">Buckaroo</field>
- <field name="image" type="base64" file="payment_buckaroo/static/src/img/buckaroo_icon.png"/>
+ <field name="image_128" type="base64" file="payment_buckaroo/static/src/img/buckaroo_icon.png"/>
<field name="provider">buckaroo</field>
<field name="company_id" ref="base.main_company"/>
<field name="view_template_id" ref="buckaroo_form"/>
diff --git a/addons/payment_ogone/data/payment_acquirer_data.xml b/addons/payment_ogone/data/payment_acquirer_data.xml
index 49743cc2a62..8f121d164d5 100644
--- a/addons/payment_ogone/data/payment_acquirer_data.xml
+++ b/addons/payment_ogone/data/payment_acquirer_data.xml
@@ -4,7 +4,7 @@
<record id="payment.payment_acquirer_ogone" model="payment.acquirer">
<field name="name">Ingenico</field>
- <field name="image" type="base64" file="payment_ogone/static/src/img/ogone_icon.png"/>
+ <field name="image_128" type="base64" file="payment_ogone/static/src/img/ogone_icon.png"/>
<field name="provider">ogone</field>
<field name="company_id" ref="base.main_company"/>
<field name="view_template_id" ref="ogone_form"/>
diff --git a/addons/payment_paypal/data/payment_acquirer_data.xml b/addons/payment_paypal/data/payment_acquirer_data.xml
index 62bac1466ff..893feb51b6e 100644
--- a/addons/payment_paypal/data/payment_acquirer_data.xml
+++ b/addons/payment_paypal/data/payment_acquirer_data.xml
@@ -4,7 +4,7 @@
<record id="payment.payment_acquirer_paypal" model="payment.acquirer">
<field name="name">Paypal</field>
- <field name="image" type="base64" file="payment_paypal/static/src/img/paypal_icon.png"/>
+ <field name="image_128" type="base64" file="payment_paypal/static/src/img/paypal_icon.png"/>
<field name="provider">paypal</field>
<field name="company_id" ref="base.main_company"/>
<field name="view_template_id" ref="paypal_form"/>
diff --git a/addons/payment_payumoney/data/payment_acquirer_data.xml b/addons/payment_payumoney/data/payment_acquirer_data.xml
index f8c9dd97139..dab5726f043 100644
--- a/addons/payment_payumoney/data/payment_acquirer_data.xml
+++ b/addons/payment_payumoney/data/payment_acquirer_data.xml
@@ -3,7 +3,7 @@
<data noupdate="1">
<record id="payment.payment_acquirer_payu" model="payment.acquirer">
<field name="name">PayUmoney</field>
- <field name="image" type="base64" file="payment_payumoney/static/src/img/payumoney_icon.png"/>
+ <field name="image_128" type="base64" file="payment_payumoney/static/src/img/payumoney_icon.png"/>
<field name="provider">payumoney</field>
<field name="company_id" ref="base.main_company"/>
<field name="view_template_id" ref="payumoney_form"/>
diff --git a/addons/payment_sips/data/payment_acquirer_data.xml b/addons/payment_sips/data/payment_acquirer_data.xml
index c6082d6f6fc..666c0271ad6 100644
--- a/addons/payment_sips/data/payment_acquirer_data.xml
+++ b/addons/payment_sips/data/payment_acquirer_data.xml
@@ -4,7 +4,7 @@
<record id="payment.payment_acquirer_sips" model="payment.acquirer">
<field name="name">Sips</field>
- <field name="image" type="base64" file="payment_sips/static/src/img/sips_icon.png"/>
+ <field name="image_128" type="base64" file="payment_sips/static/src/img/sips_icon.png"/>
<field name="provider">sips</field>
<field name="company_id" ref="base.main_company"/>
<field name="view_template_id" ref="payment_sips.sips_form"/>
diff --git a/addons/payment_stripe/data/payment_acquirer_data.xml b/addons/payment_stripe/data/payment_acquirer_data.xml
index a82caaa3704..2d30e4c6a72 100644
--- a/addons/payment_stripe/data/payment_acquirer_data.xml
+++ b/addons/payment_stripe/data/payment_acquirer_data.xml
@@ -3,7 +3,7 @@
<data noupdate="1">
<record id="payment.payment_acquirer_stripe" model="payment.acquirer">
<field name="name">Stripe</field>
- <field name="image" type="base64" file="payment_stripe/static/src/img/stripe_icon.png"/>
+ <field name="image_128" type="base64" file="payment_stripe/static/src/img/stripe_icon.png"/>
<field name="provider">stripe</field>
<field name="company_id" ref="base.main_company"/>
<field name="view_template_id" ref="stripe_form"/>
diff --git a/addons/payment_transfer/data/payment_acquirer_data.xml b/addons/payment_transfer/data/payment_acquirer_data.xml
index 4cd7c7811e5..ba2964e13d8 100644
--- a/addons/payment_transfer/data/payment_acquirer_data.xml
+++ b/addons/payment_transfer/data/payment_acquirer_data.xml
@@ -4,7 +4,7 @@
<record id="payment.payment_acquirer_transfer" model="payment.acquirer">
<field name="name">Wire Transfer</field>
- <field name="image" type="base64" file="payment_transfer/static/src/img/transfer_icon.png"/>
+ <field name="image_128" type="base64" file="payment_transfer/static/src/img/transfer_icon.png"/>
<field name="provider">transfer</field>
<field name="company_id" ref="base.main_company"/>
<field name="view_template_id" ref="transfer_form"/>
diff --git a/addons/point_of_sale/data/point_of_sale_data.xml b/addons/point_of_sale/data/point_of_sale_data.xml
index 0dfa33f862a..48ca0eb669b 100644
--- a/addons/point_of_sale/data/point_of_sale_data.xml
+++ b/addons/point_of_sale/data/point_of_sale_data.xml
@@ -39,7 +39,7 @@
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="default_code">MISC</field>
- <field name="image" type="base64" file="point_of_sale/static/img/product_product_49-image.jpg"/>
+ <field name="image_1920" type="base64" file="point_of_sale/static/img/product_product_49-image.jpg"/>
</record>
<record id="uom.product_uom_categ_unit" model="uom.category">
diff --git a/addons/point_of_sale/data/point_of_sale_demo.xml b/addons/point_of_sale/data/point_of_sale_demo.xml
index 7bb512a4dd6..d564078cc29 100644
--- a/addons/point_of_sale/data/point_of_sale_demo.xml
+++ b/addons/point_of_sale/data/point_of_sale_demo.xml
@@ -54,7 +54,7 @@
<field name="pos_categ_id" ref="pos_category_miscellaneous"/>
<field name="uom_id" ref="uom.product_uom_unit" />
<field name="uom_po_id" ref="uom.product_uom_unit" />
- <field name="image" type="base64" file="point_of_sale/static/img/wall_shelf_unit.png"/>
+ <field name="image_1920" type="base64" file="point_of_sale/static/img/wall_shelf_unit.png"/>
</record>
<record id="small_shelf" model="product.product">
<field name="available_in_pos">True</field>
@@ -69,7 +69,7 @@
<field name="to_weight">True</field>
<field name="uom_id" ref="uom.product_uom_unit" />
<field name="uom_po_id" ref="uom.product_uom_unit" />
- <field name="image" type="base64" file="point_of_sale/static/img/small_shelf.png"/>
+ <field name="image_1920" type="base64" file="point_of_sale/static/img/small_shelf.png"/>
</record>
<record id="letter_tray" model="product.product">
@@ -84,7 +84,7 @@
<field name="pos_categ_id" ref="pos_category_miscellaneous"/>
<field name="uom_id" ref="uom.product_uom_unit" />
<field name="uom_po_id" ref="uom.product_uom_unit" />
- <field name="image" type="base64" file="point_of_sale/static/img/letter_tray.png"/>
+ <field name="image_1920" type="base64" file="point_of_sale/static/img/letter_tray.png"/>
</record>
<record id="desk_organizer" model="product.product">
<field name="available_in_pos">True</field>
@@ -99,7 +99,7 @@
<field name="pos_categ_id" ref="pos_category_miscellaneous"/>
<field name="uom_id" ref="uom.product_uom_unit" />
<field name="uom_po_id" ref="uom.product_uom_unit" />
- <field name="image" type="base64" file="point_of_sale/static/img/desk_organizer.png"/>
+ <field name="image_1920" type="base64" file="point_of_sale/static/img/desk_organizer.png"/>
<field name="taxes_id" eval='[(5,)]'/> <!-- no taxes -->
</record>
@@ -116,7 +116,7 @@
<field name="pos_categ_id" ref="pos_category_miscellaneous"/>
<field name="uom_id" ref="uom.product_uom_unit" />
<field name="uom_po_id" ref="uom.product_uom_unit" />
- <field name="image" type="base64" file="point_of_sale/static/img/magnetic_board.png"/>
+ <field name="image_1920" type="base64" file="point_of_sale/static/img/magnetic_board.png"/>
</record>
<record id="monitor_stand" model="product.product">
<field name="available_in_pos">True</field>
@@ -130,7 +130,7 @@
<field name="pos_categ_id" ref="pos_category_miscellaneous"/>
<field name="uom_id" ref="uom.product_uom_unit" />
<field name="uom_po_id" ref="uom.product_uom_unit" />
- <field name="image" type="base64" file="point_of_sale/static/img/monitor_stand.png"/>
+ <field name="image_1920" type="base64" file="point_of_sale/static/img/monitor_stand.png"/>
</record>
<record id="desk_pad" model="product.product">
<field name="available_in_pos">True</field>
@@ -144,7 +144,7 @@
<field name="pos_categ_id" ref="pos_category_miscellaneous"/>
<field name="uom_id" ref="uom.product_uom_unit" />
<field name="uom_po_id" ref="uom.product_uom_unit" />
- <field name="image" type="base64" file="point_of_sale/static/img/desk_pad.png"/>
+ <field name="image_1920" type="base64" file="point_of_sale/static/img/desk_pad.png"/>
</record>
<record id="whiteboard" model="product.product">
@@ -157,7 +157,7 @@
<field name="categ_id" ref="product.product_category_5"/>
<field name="uom_id" ref="uom.product_uom_unit" />
<field name="uom_po_id" ref="uom.product_uom_unit" />
- <field name="image" type="base64" file="point_of_sale/static/img/whiteboard.png"/>
+ <field name="image_1920" type="base64" file="point_of_sale/static/img/whiteboard.png"/>
</record>
<record id="led_lamp" model="product.product">
@@ -172,7 +172,7 @@
<field name="pos_categ_id" ref="pos_category_miscellaneous"/>
<field name="uom_id" ref="uom.product_uom_unit" />
<field name="uom_po_id" ref="uom.product_uom_unit" />
- <field name="image" type="base64" file="point_of_sale/static/img/led_lamp.png"/>
+ <field name="image_1920" type="base64" file="point_of_sale/static/img/led_lamp.png"/>
</record>
<record id="newspaper_rack" model="product.product">
@@ -188,7 +188,7 @@
<field name="pos_categ_id" ref="pos_category_miscellaneous"/>
<field name="uom_id" ref="uom.product_uom_unit" />
<field name="uom_po_id" ref="uom.product_uom_unit" />
- <field name="image" type="base64" file="point_of_sale/static/img/newspaper_stand.png"/>
+ <field name="image_1920" type="base64" file="point_of_sale/static/img/newspaper_stand.png"/>
</record>
<record id="whiteboard_pen" model="product.product">
@@ -202,7 +202,7 @@
<field name="pos_categ_id" ref="pos_category_miscellaneous"/>
<field name="uom_id" ref="uom.product_uom_unit" />
<field name="uom_po_id" ref="uom.product_uom_unit" />
- <field name="image" type="base64" file="point_of_sale/static/img/whiteboard_pen.png"/>
+ <field name="image_1920" type="base64" file="point_of_sale/static/img/whiteboard_pen.png"/>
</record>
<record id="product.product_product_1" model="product.product">
diff --git a/addons/point_of_sale/models/pos_category.py b/addons/point_of_sale/models/pos_category.py
index a8e01c2ae4f..c3f40d94478 100644
--- a/addons/point_of_sale/models/pos_category.py
+++ b/addons/point_of_sale/models/pos_category.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from odoo import api, fields, models, tools, _
+from odoo import api, fields, models, _
+
class PosCategory(models.Model):
_name = "pos.category"
@@ -16,29 +17,7 @@ class PosCategory(models.Model):
parent_id = fields.Many2one('pos.category', string='Parent Category', index=True)
child_id = fields.One2many('pos.category', 'parent_id', string='Children Categories')
sequence = fields.Integer(help="Gives the sequence order when displaying a list of product categories.")
- # NOTE: there is no 'default image', because by default we don't show
- # thumbnails for categories. However if we have a thumbnail for at least one
- # category, then we display a default image on the other, so that the
- # buttons have consistent styling.
- image = fields.Binary(
- help="This field holds the image used as image for the cateogry, limited to 1024x1024px.")
- image_medium = fields.Binary(string="Medium-sized image",
- help="Medium-sized image of the category. 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(string="Small-sized image",
- help="Small-sized image of the category. It is automatically "
- "resized as a 64x64px image, with aspect ratio preserved. "
- "Use this field anywhere a small image is required.")
-
- @api.model
- def create(self, vals):
- tools.image_resize_images(vals)
- return super(PosCategory, self).create(vals)
-
- def write(self, vals):
- tools.image_resize_images(vals)
- return super(PosCategory, self).write(vals)
+ image_128 = fields.Image("Image", max_width=128, max_height=128)
def name_get(self):
def get_names(cat):
diff --git a/addons/point_of_sale/models/res_partner.py b/addons/point_of_sale/models/res_partner.py
index a1b89f004e3..7f54488c51c 100644
--- a/addons/point_of_sale/models/res_partner.py
+++ b/addons/point_of_sale/models/res_partner.py
@@ -29,8 +29,8 @@ class ResPartner(models.Model):
""" create or modify a partner from the point of sale ui.
partner contains the partner's fields. """
# image is a dataurl, get the data after the comma
- if partner.get('image'):
- partner['image'] = partner['image'].split(',')[1]
+ if partner.get('image_1920'):
+ partner['image_1920'] = partner['image_1920'].split(',')[1]
partner_id = partner.pop('id', False)
if partner_id: # Modifying existing partner
self.browse(partner_id).write(partner)
diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js
index e24a5d7841b..1cea3a6c9ce 100644
--- a/addons/point_of_sale/static/src/js/models.js
+++ b/addons/point_of_sale/static/src/js/models.js
@@ -778,7 +778,7 @@ exports.PosModel = Backbone.Model.extend({
if (order) {
order.get_orderlines().forEach(function (orderline) {
var product = orderline.product;
- var image_url = window.location.origin + '/web/image?model=product.product&field=image_medium&id=' + product.id;
+ var image_url = window.location.origin + '/web/image?model=product.product&field=image_128&id=' + product.id;
// only download and convert image if we haven't done it before
if (! product.image_base64) {
diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js
index 279d66b65ea..ae1c62a535a 100644
--- a/addons/point_of_sale/static/src/js/screens.js
+++ b/addons/point_of_sale/static/src/js/screens.js
@@ -732,7 +732,7 @@ var ProductCategoriesWidget = PosBaseWidget.extend({
},
get_image_url: function(category){
- return window.location.origin + '/web/image?model=pos.category&field=image_medium&id='+category.id;
+ return window.location.origin + '/web/image?model=pos.category&field=image_128&id='+category.id;
},
render_category: function( category, with_image ){
@@ -899,7 +899,7 @@ var ProductListWidget = PosBaseWidget.extend({
this.renderElement();
},
get_product_image_url: function(product){
- return window.location.origin + '/web/image?model=product.product&field=image_medium&id='+product.id;
+ return window.location.origin + '/web/image?model=product.product&field=image_128&id='+product.id;
},
replace: function($target){
this.renderElement();
@@ -1308,7 +1308,7 @@ var ClientListScreenWidget = ScreenWidget.extend({
}
},
partner_icon_url: function(id){
- return '/web/image?model=res.partner&id='+id+'&field=image_small';
+ return '/web/image?model=res.partner&id='+id+'&field=image_64';
},
// ui handle for the 'edit selected customer' action
diff --git a/addons/point_of_sale/views/pos_category_view.xml b/addons/point_of_sale/views/pos_category_view.xml
index 96d05ff9321..fa2b716cf5b 100644
--- a/addons/point_of_sale/views/pos_category_view.xml
+++ b/addons/point_of_sale/views/pos_category_view.xml
@@ -6,7 +6,7 @@
<field name="arch" type="xml">
<form string="Pos Product Categories">
<sheet>
- <field name="image" widget='image' class="oe_avatar"/>
+ <field name="image_128" widget="image" class="oe_avatar"/>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
@@ -41,14 +41,13 @@
<field name="arch" type="xml">
<kanban class="o_kanban_mobile">
<field name="name"/>
- <field name="image_medium"/>
<field name="id"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_global_click">
<div class="row">
<div class="col-4">
- <img height="100" width="100" t-att-src="kanban_image('pos.category', 'image_medium', record.id.raw_value)" alt="Category"/>
+ <img height="100" width="100" t-att-src="kanban_image('pos.category', 'image_128', record.id.raw_value)" alt="Category"/>
</div>
<div class="col-8">
<strong class="o_kanban_record_title"><field name="name"/></strong>
diff --git a/addons/point_of_sale/views/pos_session_view.xml b/addons/point_of_sale/views/pos_session_view.xml
index d2641930c6d..9ba67a2f1ae 100644
--- a/addons/point_of_sale/views/pos_session_view.xml
+++ b/addons/point_of_sale/views/pos_session_view.xml
@@ -155,7 +155,7 @@
<span><field name="start_at" /></span>
</div>
<div class="oe_kanban_bottom_right">
- <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
+ <img t-att-src="kanban_image('res.users', 'image_64', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
</div>
</div>
</div>
diff --git a/addons/portal/static/src/xml/portal_chatter.xml b/addons/portal/static/src/xml/portal_chatter.xml
index 339477b3715..e8e740692f8 100644
--- a/addons/portal/static/src/xml/portal_chatter.xml
+++ b/addons/portal/static/src/xml/portal_chatter.xml
@@ -29,7 +29,7 @@
</t>
<t t-if="widget.options['display_composer']">
<div class="media">
- <img alt="Avatar" class="o_portal_chatter_avatar" t-attf-src="/web/image/res.partner/#{widget.options['partner_id']}/image_small/50x50"/>
+ <img alt="Avatar" class="o_portal_chatter_avatar" t-attf-src="/web/image/res.partner/#{widget.options['partner_id']}/image_64/50x50"/>
<div class="media-body">
<form class="o_portal_chatter_composer_form" t-attf-action="/mail/chatter_post" method="POST">
<input type="hidden" name="csrf_token" t-att-value="widget.options['csrf_token']"/>
diff --git a/addons/pos_restaurant/data/pos_restaurant_demo.xml b/addons/pos_restaurant/data/pos_restaurant_demo.xml
index 4f71aa2c841..8f8c2d463b1 100644
--- a/addons/pos_restaurant/data/pos_restaurant_demo.xml
+++ b/addons/pos_restaurant/data/pos_restaurant_demo.xml
@@ -32,7 +32,7 @@
<field name="weight">0.01</field>
<field name="pos_categ_id" ref="food"/>
<field name="categ_id" ref="pos_restaurant.product_category_pos_food"/>
- <field name="image" type="base64" file="pos_restaurant/static/img/th-pizza.png"/>
+ <field name="image_1920" type="base64" file="pos_restaurant/static/img/th-pizza.png"/>
</record>
<record id="pos_food_funghi" model="product.product">
<field name="available_in_pos">True</field>
@@ -41,7 +41,7 @@
<field name="weight">0.01</field>
<field name="pos_categ_id" ref="food"/>
<field name="categ_id" ref="pos_restaurant.product_category_pos_food"/>
- <field name="image" type="base64" file="pos_restaurant/static/img/th-pizza.png"/>
+ <field name="image_1920" type="base64" file="pos_restaurant/static/img/th-pizza.png"/>
</record>
<record id="pos_food_vege" model="product.product">
<field name="available_in_pos">True</field>
@@ -50,7 +50,7 @@
<field name="weight">0.01</field>
<field name="pos_categ_id" ref="food"/>
<field name="categ_id" ref="pos_restaurant.product_category_pos_food"/>
- <field name="image" type="base64" file="pos_restaurant/static/img/th-pizza.png"/>
+ <field name="image_1920" type="base64" file="pos_restaurant/static/img/th-pizza.png"/>
</record>
<record id="pos_food_bolo" model="product.product">
<field name="available_in_pos">True</field>
@@ -59,7 +59,7 @@
<field name="weight">0.01</field>
<field name="pos_categ_id" ref="food"/>
<field name="categ_id" ref="pos_restaurant.product_category_pos_food"/>
- <field name="image" type="base64" file="pos_restaurant/static/img/th-pasta.jpg"/>
+ <field name="image_1920" type="base64" file="pos_restaurant/static/img/th-pasta.jpg"/>
</record>
<record id="pos_food_4formaggi" model="product.product">
<field name="available_in_pos">True</field>
@@ -68,7 +68,7 @@
<field name="weight">0.01</field>
<field name="pos_categ_id" ref="food"/>
<field name="categ_id" ref="pos_restaurant.product_category_pos_food"/>
- <field name="image" type="base64" file="pos_restaurant/static/img/th-pasta-4f.jpg"/>
+ <field name="image_1920" type="base64" file="pos_restaurant/static/img/th-pasta-4f.jpg"/>
</record>
<record id="pos_food_bacon" model="product.product">
<field name="available_in_pos">True</field>
@@ -77,7 +77,7 @@
<field name="weight">0.01</field>
<field name="pos_categ_id" ref="food"/>
<field name="categ_id" ref="pos_restaurant.product_category_pos_food"/>
- <field name="image" type="base64" file="pos_restaurant/static/img/th-burger.jpg"/>
+ <field name="image_1920" type="base64" file="pos_restaurant/static/img/th-burger.jpg"/>
</record>
<record id="pos_food_cheeseburger" model="product.product">
<field name="available_in_pos">True</field>
@@ -86,7 +86,7 @@
<field name="weight">0.01</field>
<field name="pos_categ_id" ref="food"/>
<field name="categ_id" ref="pos_restaurant.product_category_pos_food"/>
- <field name="image" type="base64" file="pos_restaurant/static/img/th-cheeseburger.jpg"/>
+ <field name="image_1920" type="base64" file="pos_restaurant/static/img/th-cheeseburger.jpg"/>
</record>
<record id="pos_food_chicken" model="product.product">
<field name="available_in_pos">True</field>
@@ -95,7 +95,7 @@
<field name="weight">0.01</field>
<field name="pos_categ_id" ref="food"/>
<field name="categ_id" ref="pos_restaurant.product_category_pos_food"/>
- <field name="image" type="base64" file="pos_restaurant/static/img/th-sandwich.jpg"/>
+ <field name="image_1920" type="base64" file="pos_restaurant/static/img/th-sandwich.jpg"/>
</record>
<record id="pos_food_tuna" model="product.product">
<field name="available_in_pos">True</field>
@@ -104,7 +104,7 @@
<field name="weight">0.01</field>
<field name="pos_categ_id" ref="food"/>
<field name="categ_id" ref="pos_restaurant.product_category_pos_food"/>
- <field name="image" type="base64" file="pos_restaurant/static/img/th-tuna.jpg"/>
+ <field name="image_1920" type="base64" file="pos_restaurant/static/img/th-tuna.jpg"/>
</record>
<record id="pos_food_mozza" model="product.product">
<field name="available_in_pos">True</field>
@@ -113,7 +113,7 @@
<field name="weight">0.01</field>
<field name="pos_categ_id" ref="food"/>
<field name="categ_id" ref="pos_restaurant.product_category_pos_food"/>
- <field name="image" type="base64" file="pos_restaurant/static/img/th-mozza.jpg"/>
+ <field name="image_1920" type="base64" file="pos_restaurant/static/img/th-mozza.jpg"/>
</record>
<record id="pos_food_club" model="product.product">
<field name="available_in_pos">True</field>
@@ -122,7 +122,7 @@
<field name="weight">0.01</field>
<field name="pos_categ_id" ref="food"/>
<field name="categ_id" ref="pos_restaurant.product_category_pos_food"/>
- <field name="image" type="base64" file="pos_restaurant/static/img/th-club.jpg"/>
+ <field name="image_1920" type="base64" file="pos_restaurant/static/img/th-club.jpg"/>
</record>
<record id="pos_food_maki" model="product.product">
<field name="available_in_pos">True</field>
@@ -131,7 +131,7 @@
<field name="weight">0.01</field>
<field name="pos_categ_id" ref="food"/>
<field name="categ_id" ref="pos_restaurant.product_category_pos_food"/>
- <field name="image" type="base64" file="pos_restaurant/static/img/th-maki.jpg"/>
+ <field name="image_1920" type="base64" file="pos_restaurant/static/img/th-maki.jpg"/>
</record>
<record id="pos_food_salmon" model="product.product">
<field name="available_in_pos">True</field>
@@ -140,7 +140,7 @@
<field name="weight">0.01</field>
<field name="pos_categ_id" ref="food"/>
<field name="categ_id" ref="pos_restaurant.product_category_pos_food"/>
- <field name="image" type="base64" file="pos_restaurant/static/img/th-salmon.jpg"/>
+ <field name="image_1920" type="base64" file="pos_restaurant/static/img/th-salmon.jpg"/>
</record>
<record id="pos_food_temaki" model="product.product">
<field name="available_in_pos">True</field>
@@ -149,7 +149,7 @@
<field name="weight">0.01</field>
<field name="pos_categ_id" ref="food"/>
<field name="categ_id" ref="pos_restaurant.product_category_pos_food"/>
- <field name="image" type="base64" file="pos_restaurant/static/img/th-temaki.jpg"/>
+ <field name="image_1920" type="base64" file="pos_restaurant/static/img/th-temaki.jpg"/>
</record>
<record id="pos_food_chirashi" model="product.product">
<field name="available_in_pos">True</field>
@@ -158,7 +158,7 @@
<field name="weight">0.01</field>
<field name="pos_categ_id" ref="food"/>
<field name="categ_id" ref="pos_restaurant.product_category_pos_food"/>
- <field name="image" type="base64" file="pos_restaurant/static/img/th-salmon-avocado.jpg"/>
+ <field name="image_1920" type="base64" file="pos_restaurant/static/img/th-salmon-avocado.jpg"/>
</record>
<!-- Drinks -->
@@ -169,7 +169,7 @@
<field name="weight">0.01</field>
<field name="pos_categ_id" ref="drinks"/>
<field name="categ_id" ref="point_of_sale.product_category_pos"/>
- <field name="image" type="base64" file="pos_restaurant/static/img/th-coke.jpg"/>
+ <field name="image_1920" type="base64" file="pos_restaurant/static/img/th-coke.jpg"/>
</record>
<record id="water" model="product.product">
@@ -179,7 +179,7 @@
<field name="weight">0.01</field>
<field name="pos_categ_id" ref="drinks"/>
<field name="categ_id" ref="point_of_sale.product_category_pos"/>
- <field name="image" type="base64" file="pos_restaurant/static/img/th-water.jpg"/>
+ <field name="image_1920" type="base64" file="pos_restaurant/static/img/th-water.jpg"/>
</record>
<record id="minute_maid" model="product.product">
@@ -189,7 +189,7 @@
<field name="weight">0.01</field>
<field name="pos_categ_id" ref="drinks"/>
<field name="categ_id" ref="point_of_sale.product_category_pos"/>
- <field name="image" type="base64" file="pos_restaurant/static/img/th-minute_maid.jpg"/>
+ <field name="image_1920" type="base64" file="pos_restaurant/static/img/th-minute_maid.jpg"/>
</record>
<!-- Pos Config -->
diff --git a/addons/product/data/product_demo.xml b/addons/product/data/product_demo.xml
index a46ab878d1a..229e87b652a 100644
--- a/addons/product/data/product_demo.xml
+++ b/addons/product/data/product_demo.xml
@@ -85,7 +85,7 @@
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="default_code">FURN_7777</field>
- <field name="image" type="base64" file="product/static/img/product_chair.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_chair.png"/>
</record>
<record id="product_delivery_02" model="product.product">
@@ -98,7 +98,7 @@
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="default_code">FURN_8888</field>
- <field name="image" type="base64" file="product/static/img/product_lamp.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_lamp.png"/>
</record>
<record id="product_order_01" model="product.product">
@@ -111,7 +111,7 @@
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="default_code">FURN_9999</field>
- <field name="image" type="base64" file="product/static/img/product_product_43-image.jpg"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_product_43-image.jpg"/>
</record>
<record id="product_product_3" model="product.product">
@@ -125,7 +125,7 @@
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="description_sale">Desk combination, black-brown: chair + desk + drawer.</field>
<field name="default_code">FURN_7800</field>
- <field name="image" type="base64" file="product/static/img/product_product_3-image.jpg"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_product_3-image.jpg"/>
</record>
<!-- Variants -->
@@ -202,7 +202,7 @@
<field name="weight">0.01</field>
<field name="attribute_value_ids" eval="[(6,0,[ref('product.product_attribute_value_1'), ref('product.product_attribute_value_3')])]"/>
<field name="product_tmpl_id" ref="product_product_4_product_template"/>
- <field name="image" type="base64" file="product/static/img/table02.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/table02.png"/>
</record>
<record id="product_product_4b" model="product.product">
<field name="default_code">FURN_0097</field>
@@ -210,7 +210,7 @@
<field name="product_tmpl_id" ref="product_product_4_product_template"/>
<field name="standard_price">500.0</field>
<field name="attribute_value_ids" eval="[(6,0,[ref('product.product_attribute_value_1'), ref('product.product_attribute_value_4')])]"/>
- <field name="image" type="base64" file="product/static/img/table04.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/table04.png"/>
</record>
<record id="product_product_4c" model="product.product">
<field name="default_code">FURN_0098</field>
@@ -218,7 +218,7 @@
<field name="standard_price">500.0</field>
<field name="product_tmpl_id" ref="product_product_4_product_template"/>
<field name="attribute_value_ids" eval="[(6,0,[ref('product.product_attribute_value_2'), ref('product.product_attribute_value_3')])]"/>
- <field name="image" type="base64" file="product/static/img/table03.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/table03.png"/>
</record>
<record id="product_product_4d" model="product.product">
<field name="default_code">DESK0004</field>
@@ -226,7 +226,7 @@
<field name="product_tmpl_id" ref="product_product_4_product_template"/>
<field name="standard_price">500.0</field>
<field name="attribute_value_ids" eval="[(6,0,[ref('product.product_attribute_value_2'), ref('product.product_attribute_value_4')])]"/>
- <field name="image" type="base64" file="product/static/img/table01.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/table01.png"/>
</record>
<record id="product_product_5" model="product.product">
@@ -239,7 +239,7 @@
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="default_code">E-COM06</field>
- <field name="image" type="base64" file="product/static/img/product_product_5-image.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_product_5-image.png"/>
</record>
<record id="product_product_6" model="product.product">
@@ -253,7 +253,7 @@
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="default_code">E-COM07</field>
<field name='weight'>0.330</field>
- <field name="image" type="base64" file="product/static/img/product_product_6-image.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_product_6-image.png"/>
</record>
<record id="product_product_7" model="product.product">
@@ -266,7 +266,7 @@
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="default_code">E-COM08</field>
- <field name="image" type="base64" file="product/static/img/product_product_7-image.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_product_7-image.png"/>
</record>
<record id="product_product_8" model="product.product">
@@ -280,7 +280,7 @@
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="default_code">E-COM09</field>
<field name='weight'>9.54</field>
- <field name="image" type="base64" file="product/static/img/product_product_8-image.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_product_8-image.png"/>
</record>
<record id="product_product_9" model="product.product">
@@ -293,7 +293,7 @@
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="default_code">E-COM10</field>
- <field name="image" type="base64" file="product/static/img/product_product_9-image.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_product_9-image.png"/>
</record>
<record id="product_product_10" model="product.product">
@@ -306,7 +306,7 @@
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="default_code">E-COM11</field>
- <field name="image" type="base64" file="product/static/img/product_product_10-image.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_product_10-image.png"/>
</record>
<record id="product_product_11_product_template" model="product.template">
@@ -317,7 +317,7 @@
<field name="type">consu</field>
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
- <field name="image" type="base64" file="product/static/img/product_product_11-image.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_product_11-image.png"/>
</record>
<!-- the product template attribute lines have to be defined before creating the variants -->
@@ -378,7 +378,7 @@
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="default_code">FURN_0269</field>
- <field name="image" type="base64" file="product/static/img/product_product_12-image.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_product_12-image.png"/>
</record>
<record id="product_product_13" model="product.product">
@@ -391,7 +391,7 @@
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="default_code">FURN_1118</field>
- <field name="image" type="base64" file="product/static/img/product_product_13-image.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_product_13-image.png"/>
</record>
<record id="product_product_16" model="product.product">
@@ -404,7 +404,7 @@
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="default_code">FURN_8900</field>
- <field name="image" type="base64" file="product/static/img/product_product_16-image.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_product_16-image.png"/>
</record>
<record id="product_product_20" model="product.product">
@@ -417,7 +417,7 @@
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="default_code">FURN_9001</field>
- <field name="image" type="base64" file="product/static/img/product_product_20-image.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_product_20-image.png"/>
</record>
<record id="product_product_22" model="product.product">
<field name="name">Desk Stand with Screen</field>
@@ -429,7 +429,7 @@
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="default_code">FURN_7888</field>
- <field name="image" type="base64" file="product/static/img/product_product_22-image.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_product_22-image.png"/>
</record>
<record id="product_product_24" model="product.product">
@@ -442,7 +442,7 @@
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="default_code">FURN_0789</field>
- <field name="image" type="base64" file="product/static/img/product_product_24-image.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_product_24-image.png"/>
</record>
<record id="product_product_25" model="product.product">
@@ -455,7 +455,7 @@
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="default_code">FURN_6666</field>
- <field name="image" type="base64" file="product/static/img/product_product_25-image.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_product_25-image.png"/>
</record>
<record id="product_product_27" model="product.product">
@@ -469,7 +469,7 @@
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="description">Drawer with two routing possiblities.</field>
<field name="default_code">FURN_8855</field>
- <field name="image" type="base64" file="product/static/img/product_product_27-image.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_product_27-image.png"/>
</record>
<record id="consu_delivery_03" model="product.product">
@@ -483,7 +483,7 @@
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="description_sale">Four person modern office workstation</field>
<field name="default_code">FURN_8220</field>
- <field name="image" type="base64" file="product/static/img/product_product_d03-image.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_product_d03-image.png"/>
</record>
<record id="consu_delivery_02" model="product.product">
@@ -497,7 +497,7 @@
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="description_sale">Conference room table</field>
<field name="default_code">FURN_6741</field>
- <field name="image" type="base64" file="product/static/img/product_product_46-image.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_product_46-image.png"/>
</record>
<record id="consu_delivery_01" model="product.product">
@@ -511,7 +511,7 @@
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="description_sale">Three Seater Sofa with Lounger in Steel Grey Colour</field>
<field name="default_code">FURN_8999</field>
- <field name="image" type="base64" file="product/static/img/product_product_d01-image.png"/>
+ <field name="image_1920" type="base64" file="product/static/img/product_product_d01-image.png"/>
</record>
<!--
diff --git a/addons/product/models/product.py b/addons/product/models/product.py
index cdb4a74a498..400b434f775 100644
--- a/addons/product/models/product.py
+++ b/addons/product/models/product.py
@@ -122,103 +122,86 @@ class ProductProduct(models.Model):
# all image fields are base64 encoded and PIL-supported
- # all image_raw fields are technical and should not be displayed to the user
- image_raw_original = fields.Binary("Raw Original Image")
+ # all image_variant fields are technical and should not be displayed to the user
+ image_variant_max = fields.Image("Variant Image", max_width=1920, max_height=1920)
# resized fields stored (as attachment) for performance
- image_raw_big = fields.Binary("Raw Big-sized Image", compute='_compute_images', store=True)
- image_raw_large = fields.Binary("Raw Large-sized Image", compute='_compute_images', store=True)
- image_raw_medium = fields.Binary("Raw Medium-sized Image", compute='_compute_images', store=True)
- image_raw_small = fields.Binary("Raw Small-sized Image", compute='_compute_images', store=True)
-
- can_image_raw_be_zoomed = fields.Boolean("Can image raw be zoomed", compute='_compute_images', store=True)
+ image_variant_1024 = fields.Image("Variant Image 1204", related="image_variant_max", max_width=1024, max_height=1024, store=True)
+ image_variant_512 = fields.Image("Variant Image 512", related="image_variant_max", max_width=512, max_height=512, store=True)
+ image_variant_256 = fields.Image("Variant Image 256", related="image_variant_max", max_width=256, max_height=256, store=True)
+ image_variant_128 = fields.Image("Variant Image 128", related="image_variant_max", max_width=128, max_height=128, store=True)
+ image_variant_64 = fields.Image("Variant Image 64", related="image_variant_max", max_width=64, max_height=64, store=True)
+ can_image_variant_1024_be_zoomed = fields.Boolean("Can Variant Image 1024 be zoomed", compute='_compute_can_image_variant_1024_be_zoomed', store=True)
# Computed fields that are used to create a fallback to the template if
# necessary, it's recommended to display those fields to the user.
- image_original = fields.Binary("Original Image", compute='_compute_image_original', inverse='_set_image_original', help="Image in its original size, as it was uploaded.")
- image_big = fields.Binary("Big-sized Image", compute='_compute_image_big', help="1024px * 1024px")
- image_large = fields.Binary("Large-sized Image", compute='_compute_image_large', help="256px * 256px")
- image_medium = fields.Binary("Medium-sized Image", compute='_compute_image_medium', help="128px * 128px")
- image_small = fields.Binary("Small-sized Image", compute='_compute_image_small', help="64px * 64px")
- can_image_be_zoomed = fields.Boolean("Can image be zoomed", compute='_compute_can_image_be_zoomed')
-
- image = fields.Binary("Image", compute='_compute_image', inverse='_set_image')
-
- @api.depends('image_raw_original')
- def _compute_images(self):
+ image_1920 = fields.Image("Image", compute='_compute_image_1920', inverse='_set_image_1920')
+ image_1024 = fields.Image("Image 1024", compute='_compute_image_1024')
+ image_512 = fields.Image("Image 512", compute='_compute_image_512')
+ image_256 = fields.Image("Image 256", compute='_compute_image_256')
+ image_128 = fields.Image("Image 128", compute='_compute_image_128')
+ image_64 = fields.Image("Image 64", compute='_compute_image_64')
+ can_image_1024_be_zoomed = fields.Boolean("Can Image 1024 be zoomed", compute='_compute_can_image_1024_be_zoomed')
+
+ @api.depends('image_variant_max', 'image_variant_1024')
+ def _compute_can_image_variant_1024_be_zoomed(self):
for record in self:
- image = record.image_raw_original
- # for performance: avoid calling unnecessary methods when falsy
- images = image and tools.image_get_resized_images(image, big_name=False)
- record.image_raw_big = image and tools.image_get_resized_images(image,
- large_name=False, medium_name=False, small_name=False)['image']
- record.image_raw_large = image and images['image_large']
- record.image_raw_medium = image and images['image_medium']
- record.image_raw_small = image and images['image_small']
- record.can_image_raw_be_zoomed = image and tools.is_image_size_above(image)
-
- def _compute_image_original(self):
+ record.can_image_variant_1024_be_zoomed = record.image_variant_max and tools.is_image_size_above(record.image_variant_max, record.image_variant_1024)
+
+ def _compute_image_1920(self):
"""Get the image from the template if no image is set on the variant."""
for record in self:
- record.image_original = record.image_raw_original or record.product_tmpl_id.image_original
+ record.image_1920 = record.image_variant_max or record.product_tmpl_id.image_1920
- def _set_image_original(self):
+ def _set_image_1920(self):
for record in self:
if (
# We are trying to remove an image even though it is already
# not set, remove it from the template instead.
- not record.image_original and not record.image_raw_original or
+ not record.image_1920 and not record.image_variant_max or
# We are trying to add an image, but the template image is
# not set, write on the template instead.
- record.image_original and not record.product_tmpl_id.image_original or
+ record.image_1920 and not record.product_tmpl_id.image_1920 or
# There is only one variant, always write on the template.
self.search_count([
('product_tmpl_id', '=', record.product_tmpl_id.id),
('active', '=', True),
]) <= 1
):
- record.image_raw_original = False
- record.product_tmpl_id.image_original = record.image_original
+ record.image_variant_max = False
+ record.product_tmpl_id.image_1920 = record.image_1920
else:
- record.image_raw_original = record.image_original
+ record.image_variant_max = record.image_1920
- def _compute_image_big(self):
+ def _compute_image_1024(self):
"""Get the image from the template if no image is set on the variant."""
for record in self:
- record.image_big = record.image_raw_big or record.product_tmpl_id.image_big
+ record.image_1024 = record.image_variant_1024 or record.product_tmpl_id.image_1024
- def _compute_image_large(self):
+ def _compute_image_512(self):
"""Get the image from the template if no image is set on the variant."""
for record in self:
- record.image_large = record.image_raw_large or record.product_tmpl_id.image_large
+ record.image_512 = record.image_variant_512 or record.product_tmpl_id.image_512
- def _compute_image_medium(self):
+ def _compute_image_256(self):
"""Get the image from the template if no image is set on the variant."""
for record in self:
- record.image_medium = record.image_raw_medium or record.product_tmpl_id.image_medium
+ record.image_256 = record.image_variant_256 or record.product_tmpl_id.image_256
- def _compute_image_small(self):
+ def _compute_image_128(self):
"""Get the image from the template if no image is set on the variant."""
for record in self:
- record.image_small = record.image_raw_small or record.product_tmpl_id.image_small
+ record.image_128 = record.image_variant_128 or record.product_tmpl_id.image_128
- def _compute_can_image_be_zoomed(self):
+ def _compute_image_64(self):
"""Get the image from the template if no image is set on the variant."""
for record in self:
- record.can_image_be_zoomed = record.can_image_raw_be_zoomed if record.image_raw_original else record.product_tmpl_id.can_image_be_zoomed
+ record.image_64 = record.image_variant_64 or record.product_tmpl_id.image_64
- @api.depends('image_big')
- def _compute_image(self):
- for record in self:
- record.image = record.image_big
-
- def _set_image(self):
+ def _compute_can_image_1024_be_zoomed(self):
+ """Get the image from the template if no image is set on the variant."""
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()
+ record.can_image_1024_be_zoomed = record.can_image_variant_1024_be_zoomed if record.image_variant_max else record.product_tmpl_id.can_image_1024_be_zoomed
_sql_constraints = [
('barcode_uniq', 'unique(barcode)', "A barcode can only be assigned to one product !"),
@@ -391,8 +374,8 @@ class ProductProduct(models.Model):
for product in self:
# If there is an image set on the variant and no image set on the
# template, move the image to the template.
- if product.image_raw_original and not product.product_tmpl_id.image_original:
- product.product_tmpl_id.image_original = product.image_raw_original
+ if product.image_variant_max and not product.product_tmpl_id.image_1920:
+ product.product_tmpl_id.image_1920 = product.image_variant_max
# Check if product still exists, in case it has been unlinked by unlinking its template
if not product.exists():
continue
diff --git a/addons/product/models/product_template.py b/addons/product/models/product_template.py
index a9530f1f01f..101ed0c4039 100644
--- a/addons/product/models/product_template.py
+++ b/addons/product/models/product_template.py
@@ -149,6 +149,13 @@ class ProductTemplate(models.Model):
item_ids = fields.One2many('product.pricelist.item', 'product_tmpl_id', 'Pricelist Items')
+ can_image_1024_be_zoomed = fields.Boolean("Can Image 1024 be zoomed", compute='_compute_can_image_1024_be_zoomed', store=True)
+
+ @api.depends('image_1920', 'image_1024')
+ def _compute_can_image_1024_be_zoomed(self):
+ for template in self:
+ template.can_image_1024_be_zoomed = template.image_1920 and tools.is_image_size_above(template.image_1920, template.image_1024)
+
@api.depends('product_variant_ids')
def _compute_product_variant_id(self):
for p in self:
@@ -371,6 +378,16 @@ class ProductTemplate(models.Model):
self.create_variant_ids()
if 'active' in vals and not vals.get('active'):
self.with_context(active_test=False).mapped('product_variant_ids').write({'active': vals.get('active')})
+ if 'image_1920' in vals:
+ self.env['product.product'].invalidate_cache(fnames=[
+ 'image_1920',
+ 'image_1024',
+ 'image_512',
+ 'image_256',
+ 'image_128',
+ 'image_64',
+ 'can_image_1024_be_zoomed',
+ ])
return res
@api.returns('self', lambda value: value.id)
diff --git a/addons/product/tests/test_variants.py b/addons/product/tests/test_variants.py
index ccddf89c662..f07553a9141 100644
--- a/addons/product/tests/test_variants.py
+++ b/addons/product/tests/test_variants.py
@@ -501,7 +501,7 @@ class TestVariantsImages(common.TestProductCommon):
self.images.update({color: base64.b64encode(f.read())})
self.env['product.product'].create({
- 'image_raw_original': self.images[color],
+ 'image_variant_max': self.images[color],
'attribute_value_ids': [(6, 0, [color_value.id])],
'product_tmpl_id': self.template.id,
})
@@ -511,7 +511,7 @@ class TestVariantsImages(common.TestProductCommon):
return res
def test_variant_images(self):
- """Check that on variant, the image used is the image_raw_original if set,
+ """Check that on variant, the image used is the image_variant_max if set,
and defaults to the template image otherwise.
"""
f = io.BytesIO()
@@ -519,29 +519,29 @@ class TestVariantsImages(common.TestProductCommon):
f.seek(0)
image_black = base64.b64encode(f.read())
- images = self.variants.mapped('image_original')
+ images = self.variants.mapped('image_1920')
self.assertEqual(len(set(images)), 4)
variant_no_image = self.variants[0]
- self.assertFalse(variant_no_image.image)
- self.template.image = image_black
+ self.assertFalse(variant_no_image.image_1920)
+ self.template.image_1920 = image_black
# the first has no image variant, all the others do
- self.assertFalse(variant_no_image.image_raw_original)
+ self.assertFalse(variant_no_image.image_variant_max)
self.assertTrue(all(images[1:]))
# template image is the same as this one, since it has no image variant
- self.assertEqual(variant_no_image.image, self.template.image)
+ self.assertEqual(variant_no_image.image_1920, self.template.image_1920)
# having changed the template image should not have changed these
- self.assertEqual(images[1:], self.variants.mapped('image')[1:])
+ self.assertEqual(images[1:], self.variants.mapped('image_1920')[1:])
def test_update_images_with_archived_variants(self):
"""Update images after variants have been archived"""
self.variants[1:].write({'active': False})
- self.variants[0].image = self.images['red']
- self.assertEqual(self.template.image, self.images['red'])
- self.assertEqual(self.variants[0].image_raw_original, False)
- self.assertEqual(self.variants[0].image, self.images['red'])
+ self.variants[0].image_1920 = self.images['red']
+ self.assertEqual(self.template.image_1920, self.images['red'])
+ self.assertEqual(self.variants[0].image_variant_max, False)
+ self.assertEqual(self.variants[0].image_1920, self.images['red'])
class TestVariantsArchive(common.TestProductCommon):
diff --git a/addons/product/views/product_template_views.xml b/addons/product/views/product_template_views.xml
index 1540b133fe2..35678b70689 100644
--- a/addons/product/views/product_template_views.xml
+++ b/addons/product/views/product_template_views.xml
@@ -68,7 +68,6 @@
<field name="arch" type="xml">
<kanban>
<field name="id"/>
- <field name="image_small"/>
<field name="lst_price"/>
<field name="product_variant_count"/>
<field name="currency_id"/>
@@ -78,7 +77,7 @@
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="o_kanban_image">
- <img t-att-src="kanban_image('product.template', 'image_small', record.id.raw_value)" alt="Product"/>
+ <img t-att-src="kanban_image('product.template', 'image_64', record.id.raw_value)" alt="Product"/>
</div>
<div class="oe_kanban_details">
<strong class="o_kanban_record_title">
@@ -111,7 +110,7 @@
<field name="id"/>
<templates>
<div t-name="activity-box">
- <img t-att-src="activity_image('product.template', 'image_small', record.id.raw_value)" role="img" t-att-title="record.id.value" t-att-alt="record.id.value"/>
+ <img t-att-src="activity_image('product.template', 'image_64', record.id.raw_value)" role="img" t-att-title="record.id.value" t-att-alt="record.id.value"/>
<div>
<field name="name" display="full"/>
<div t-if="record.default_code.value" class="text-muted">
diff --git a/addons/product/views/product_views.xml b/addons/product/views/product_views.xml
index b495635b7cd..3acf80d169f 100644
--- a/addons/product/views/product_views.xml
+++ b/addons/product/views/product_views.xml
@@ -21,7 +21,7 @@
<field name='is_product_variant' invisible='1'/>
<field name='attribute_line_ids' invisible='1'/>
<field name="id" invisible="True"/>
- <field name="image" widget="image" class="oe_avatar" options="{'preview_image': 'image_medium'}"/>
+ <field name="image_1920" widget="image" class="oe_avatar" options="{'preview_image': 'image_128'}"/>
<div class="oe_title">
<label class="oe_edit_only" for="name" string="Product Name"/>
<h1><field name="name" placeholder="Product Name"/></h1>
@@ -268,7 +268,7 @@
<div class="oe_button_box" name="button_box"/>
<field name="active" invisible="1"/>
<field name="id" invisible="1"/>
- <field name="image" widget="image" class="oe_avatar" options="{'preview_image': 'image_medium'}"/>
+ <field name="image_1920" widget="image" class="oe_avatar" options="{'preview_image': 'image_128'}"/>
<div class="oe_title">
<label class="oe_edit_only" for="name" string="Product Name"/>
<h1><field name="name" readonly="1" placeholder="e.g. Odoo Enterprise Subscription"/></h1>
@@ -418,7 +418,6 @@
<field name="arch" type="xml">
<kanban>
<field name="id"/>
- <field name="image_small"/>
<field name="lst_price"/>
<field name="activity_state"/>
<progressbar field="activity_state" colors='{"planned": "success", "today": "warning", "overdue": "danger"}'/>
@@ -426,7 +425,7 @@
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="o_kanban_image">
- <img t-att-src="kanban_image('product.product', 'image_small', record.id.raw_value)" alt="Product"/>
+ <img t-att-src="kanban_image('product.product', 'image_64', record.id.raw_value)" alt="Product"/>
</div>
<div class="oe_kanban_details">
<strong class="o_kanban_record_title">
@@ -457,7 +456,7 @@
<field name="default_code"/>
<templates>
<div t-name="activity-box">
- <img t-att-src="activity_image('product.product', 'image_small', record.id.raw_value)" role="img" t-att-title="record.id.value" t-att-alt="record.id.value"/>
+ <img t-att-src="activity_image('product.product', 'image_64', record.id.raw_value)" role="img" t-att-title="record.id.value" t-att-alt="record.id.value"/>
<div>
<field name="name" display="full"/>
<div t-if="record.default_code.value" class="text-muted">
diff --git a/addons/project/views/project_portal_templates.xml b/addons/project/views/project_portal_templates.xml
index b76a27479b9..2ac7e604693 100644
--- a/addons/project/views/project_portal_templates.xml
+++ b/addons/project/views/project_portal_templates.xml
@@ -91,7 +91,7 @@
<h6>Customer</h6>
<div class="row">
<div class="col flex-grow-0 pr-3">
- <img t-if="project.partner_id.image" class="rounded-circle mt-1 o_portal_contact_img" t-att-src="image_data_uri(project.partner_id.image)" alt="Contact"/>
+ <img t-if="project.partner_id.image_1024" class="rounded-circle mt-1 o_portal_contact_img" t-att-src="image_data_uri(project.partner_id.image_1024)" alt="Contact"/>
<img t-else="" class="rounded-circle mt-1 o_portal_contact_img" src="/web/static/src/img/user_menu_avatar.png" alt="Contact"/>
</div>
<div class="col pl-sm-0">
@@ -103,7 +103,7 @@
<h6>Project Manager</h6>
<div class="row">
<div class="col flex-grow-0 pr-3">
- <img t-if="project.user_id.image" class="rounded-circle mt-1 o_portal_contact_img" t-att-src="image_data_uri(project.user_id.image)" alt="Contact"/>
+ <img t-if="project.user_id.image_1024" class="rounded-circle mt-1 o_portal_contact_img" t-att-src="image_data_uri(project.user_id.image_1024)" alt="Contact"/>
<img t-else="" class="rounded-circle mt-1 o_portal_contact_img" src="/web/static/src/img/user_menu_avatar.png" alt="Contact"/>
</div>
<div class="col pl-sm-0">
@@ -205,7 +205,7 @@
<strong>Assigned to</strong>
<div class="row">
<div class="col flex-grow-0 pr-3">
- <img t-if="task.user_id.image" class="rounded-circle mt-1 o_portal_contact_img" t-att-src="image_data_uri(task.user_id.image)" alt="Contact"/>
+ <img t-if="task.user_id.image_1024" class="rounded-circle mt-1 o_portal_contact_img" t-att-src="image_data_uri(task.user_id.image_1024)" alt="Contact"/>
<img t-else="" class="rounded-circle mt-1 o_portal_contact_img" src="/web/static/src/img/user_menu_avatar.png" alt="Contact"/>
</div>
<div class="col pl-md-0">
@@ -217,7 +217,7 @@
<strong>Reported by</strong>
<div class="row">
<div class="col flex-grow-0 pr-3">
- <img t-if="task.partner_id.image" class="rounded-circle mt-1 o_portal_contact_img" t-att-src="image_data_uri(task.partner_id.image)" alt="Contact"/>
+ <img t-if="task.partner_id.image_1024" class="rounded-circle mt-1 o_portal_contact_img" t-att-src="image_data_uri(task.partner_id.image_1024)" alt="Contact"/>
<img t-else="" class="rounded-circle mt-1 o_portal_contact_img" src="/web/static/src/img/user_menu_avatar.png" alt="Contact"/>
</div>
<div class="col pl-md-0">
diff --git a/addons/project/views/project_rating_templates.xml b/addons/project/views/project_rating_templates.xml
index a016e3e77b2..a1b8613ccb3 100644
--- a/addons/project/views/project_rating_templates.xml
+++ b/addons/project/views/project_rating_templates.xml
@@ -77,8 +77,8 @@
<t t-foreach="partner_stats.values()" t-as="partner_stat">
<div class="row mt8" t-if="partner_stat['total']" title="Top 5 partner ratings of last 15 days.">
<div class="col-md-1">
- <img t-if="partner_stat['rated_partner'].image" class="o_top_partner_image" t-att-src="image_data_uri(partner_stat['rated_partner'].image)" alt="Rated partner"/>
- <img t-if="not partner_stat['rated_partner'].image" class="o_top_partner_image" src='/web/static/src/img/placeholder.png' alt="Placeholder"/>
+ <img t-if="partner_stat['rated_partner'].image_1024" class="o_top_partner_image" t-att-src="image_data_uri(partner_stat['rated_partner'].image_1024)" alt="Rated partner"/>
+ <img t-if="not partner_stat['rated_partner'].image_1024" class="o_top_partner_image" src='/web/static/src/img/placeholder.png' alt="Placeholder"/>
</div>
<div class="col-md-4 o_smiley_no_padding_right">
<span class="ml8" t-esc="partner_stat['rated_partner'].name"/>
@@ -126,8 +126,8 @@
<div t-attf-id="rating_#{rating.id}" class="container d-none">
<div class="row">
<div class="col-lg-2">
- <img t-if="rating.partner_id.image" class="o_top_partner_image" t-att-src="image_data_uri(rating.partner_id.image)" alt="Rated partner"/>
- <img t-if="not rating.partner_id.image" class="o_top_partner_image" src='/web/static/src/img/placeholder.png' alt="Placeholder"/>
+ <img t-if="rating.partner_id.image_1024" class="o_top_partner_image" t-att-src="image_data_uri(rating.partner_id.image_1024)" alt="Rated partner"/>
+ <img t-if="not rating.partner_id.image_1024" class="o_top_partner_image" src='/web/static/src/img/placeholder.png' alt="Placeholder"/>
</div>
<div class="col-lg-10">
<div class="mt4">
diff --git a/addons/project/views/project_views.xml b/addons/project/views/project_views.xml
index 6bdc873c97c..43734fc16aa 100644
--- a/addons/project/views/project_views.xml
+++ b/addons/project/views/project_views.xml
@@ -238,7 +238,7 @@
</div>
<div class="col-4">
<div class="oe_kanban_bottom_right">
- <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
+ <img t-att-src="kanban_image('res.users', 'image_64', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
</div>
</div>
</div>
@@ -610,7 +610,7 @@
</div>
<div class="oe_kanban_bottom_right">
<field name="kanban_state" widget="state_selection" groups="base.group_user"/>
- <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar"/>
+ <img t-att-src="kanban_image('res.users', 'image_64', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar"/>
</div>
</div>
</div>
@@ -698,7 +698,7 @@
<field name="user_id"/>
<templates>
<div t-name="activity-box">
- <img t-att-src="activity_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value"/>
+ <img t-att-src="activity_image('res.users', 'image_64', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value"/>
<div>
<field name="name" display="full"/>
<field name="project_id" muted="1" display="full" invisible="context.get('default_project_id', False)"/>
diff --git a/addons/purchase/views/portal_templates.xml b/addons/purchase/views/portal_templates.xml
index 6d723766665..58bcee1741f 100644
--- a/addons/purchase/views/portal_templates.xml
+++ b/addons/purchase/views/portal_templates.xml
@@ -103,7 +103,7 @@
<t t-set="current_subtotal" t-value="current_subtotal + ol.price_total" groups="account.group_show_line_subtotals_tax_included"/>
<div t-if="not ol.display_type" class="row purchases_vertical_align">
<div class="col-lg-1 text-center">
- <img t-att-src="image_data_uri(resize_to_48(ol.product_id.image))" alt="Product"/>
+ <img t-att-src="image_data_uri(resize_to_48(ol.product_id.image_64))" alt="Product"/>
</div>
<div id='product_name' class="col-lg-5">
<span t-esc="ol.product_id.name"/>
diff --git a/addons/purchase_requisition/views/purchase_requisition_views.xml b/addons/purchase_requisition/views/purchase_requisition_views.xml
index 8ef7677c1ce..6d031aa317b 100644
--- a/addons/purchase_requisition/views/purchase_requisition_views.xml
+++ b/addons/purchase_requisition/views/purchase_requisition_views.xml
@@ -243,7 +243,7 @@
<field name="vendor_id"/>
</div>
<div class="oe_kanban_bottom_right">
- <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
+ <img t-att-src="kanban_image('res.users', 'image_64', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
</div>
</div>
</div>
diff --git a/addons/sale/data/mail_data.xml b/addons/sale/data/mail_data.xml
index c149738db3a..05ef93eaaa4 100644
--- a/addons/sale/data/mail_data.xml
+++ b/addons/sale/data/mail_data.xml
@@ -154,7 +154,7 @@
<td colspan="4"><i>${line.name}</i></td>
% else:
<td style="width: 150px;">
- <img src="/web/image/product.product/${line.product_id.id}/image_small" width="64" alt="Product image"></img>
+ <img src="/web/image/product.product/${line.product_id.id}/image_64" width="64" alt="Product image"></img>
</td>
<td align="left">${line.product_id.name}</td>
<td>${line.product_uom_qty}</td>
diff --git a/addons/sale/data/sale_demo.xml b/addons/sale/data/sale_demo.xml
index ecdd2681779..ee66c68efd4 100644
--- a/addons/sale/data/sale_demo.xml
+++ b/addons/sale/data/sale_demo.xml
@@ -690,7 +690,7 @@ Thanks!</field>
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="company_id" eval="[]"/>
- <field name="image" type="base64" file="sale/static/img/advance_product_0-image.jpg"/>
+ <field name="image_1920" type="base64" file="sale/static/img/advance_product_0-image.jpg"/>
<field name="taxes_id" eval="[]"/>
<field name="supplier_taxes_id" eval="[]"/>
</record>
diff --git a/addons/sale/models/product_template.py b/addons/sale/models/product_template.py
index 1db9daaa627..257f9fa595e 100644
--- a/addons/sale/models/product_template.py
+++ b/addons/sale/models/product_template.py
@@ -252,12 +252,12 @@ class ProductTemplate(models.Model):
)
list_price = product.price_compute('list_price')[product.id]
price = product.price if pricelist else list_price
- display_image = bool(product.image)
+ display_image = bool(product.image_1920)
else:
product_template = product_template.with_context(current_attributes_price_extra=[v.price_extra or 0.0 for v in combination])
list_price = product_template.price_compute('list_price')[product_template.id]
price = product_template.price if pricelist else list_price
- display_image = bool(product_template.image)
+ display_image = bool(product_template.image_1920)
filtered_combination = combination._without_no_variant_attributes()
if filtered_combination:
diff --git a/addons/sale/static/src/js/variant_mixin.js b/addons/sale/static/src/js/variant_mixin.js
index 219cd1ea817..36577e8dedd 100644
--- a/addons/sale/static/src/js/variant_mixin.js
+++ b/addons/sale/static/src/js/variant_mixin.js
@@ -611,7 +611,7 @@ var VariantMixin = {
_updateProductImage: function ($productContainer, displayImage, productId, productTemplateId) {
var model = productId ? 'product.product' : 'product.template';
var modelId = productId || productTemplateId;
- var imageUrl = '/web/image/{0}/{1}/' + (this._productImageField ? this._productImageField : 'image');
+ var imageUrl = '/web/image/{0}/{1}/' + (this._productImageField ? this._productImageField : 'image_1024');
var imageSrc = imageUrl
.replace("{0}", model)
.replace("{1}", modelId);
diff --git a/addons/sale/views/sale_portal_templates.xml b/addons/sale/views/sale_portal_templates.xml
index b6264bb8534..d67a37a5287 100644
--- a/addons/sale/views/sale_portal_templates.xml
+++ b/addons/sale/views/sale_portal_templates.xml
@@ -184,8 +184,8 @@
<div class="small mb-1"><strong class="text-muted">Salesperson</strong></div>
<div class="row flex-nowrap">
<div class="col flex-grow-0 pr-2">
- <img class="rounded-circle mr4 float-left o_portal_contact_img" t-if="sale_order.user_id.image" t-att-src="image_data_uri(sale_order.user_id.image)" alt="Contact"/>
- <img class="rounded-circle mr4 float-left o_portal_contact_img" t-if="not sale_order.user_id.image" src="/web/static/src/img/placeholder.png" alt="Contact"/>
+ <img class="rounded-circle mr4 float-left o_portal_contact_img" t-if="sale_order.user_id.image_1024" t-att-src="image_data_uri(sale_order.user_id.image_1024)" alt="Contact"/>
+ <img class="rounded-circle mr4 float-left o_portal_contact_img" t-if="not sale_order.user_id.image_1024" src="/web/static/src/img/placeholder.png" alt="Contact"/>
</div>
<div class="col pl-0" style="min-width: 150px">
<span t-field="sale_order.user_id" t-options='{"widget": "contact", "fields": ["name", "phone"], "no_marker": True}'/>
diff --git a/addons/sale_product_configurator/data/sale_demo.xml b/addons/sale_product_configurator/data/sale_demo.xml
index 00683af8855..117ebd6acc0 100644
--- a/addons/sale_product_configurator/data/sale_demo.xml
+++ b/addons/sale_product_configurator/data/sale_demo.xml
@@ -9,7 +9,7 @@
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="description_sale">Office chairs can harm your floor: protect it.</field>
- <field name="image" type="base64" file="sale/static/img/floor_protection-image.png"/>
+ <field name="image_1920" type="base64" file="sale/static/img/floor_protection-image.png"/>
</record>
<record id="product.product_product_4_product_template" model="product.template">
diff --git a/addons/sale_product_configurator/static/src/js/product_configurator_modal.js b/addons/sale_product_configurator/static/src/js/product_configurator_modal.js
index 7d52b07b76d..c2687e79d0d 100644
--- a/addons/sale_product_configurator/static/src/js/product_configurator_modal.js
+++ b/addons/sale_product_configurator/static/src/js/product_configurator_modal.js
@@ -60,7 +60,7 @@ var OptionalProductsModal = Dialog.extend(ServicesMixin, VariantMixin, {
this.pricelistId = params.pricelistId;
this.previousModalHeight = params.previousModalHeight;
this.dialogClass = 'oe_optional_products_modal';
- this._productImageField = 'image_medium';
+ this._productImageField = 'image_128';
// reset any previously populated properties maps
optionalProductsMap = {};
@@ -209,7 +209,7 @@ var OptionalProductsModal = Dialog.extend(ServicesMixin, VariantMixin, {
var productId = this.rootProduct.product_id;
$modalContent
.find('img:first')
- .attr("src", "/web/image/product.product/" + productId + "/image_medium");
+ .attr("src", "/web/image/product.product/" + productId + "/image_128");
if (this.rootProduct &&
(this.rootProduct.product_custom_attribute_values ||
diff --git a/addons/sale_product_configurator/views/templates.xml b/addons/sale_product_configurator/views/templates.xml
index ba03bbb30d1..4a849dc7846 100644
--- a/addons/sale_product_configurator/views/templates.xml
+++ b/addons/sale_product_configurator/views/templates.xml
@@ -54,8 +54,8 @@
</div>
<div class="col-lg-1 d-inline-block"></div>
<div class="col-lg-5 d-inline-block align-top text-left">
- <img t-if="product_variant" t-att-src="'/web/image/product.product/%s/image' % product_variant.id" class="d-block product_detail_img" alt="Product Image"/>
- <img t-else="" t-att-src="'/web/image/product.template/%s/image' % product.id" class="d-block product_detail_img" alt="Product Image"/>
+ <img t-if="product_variant" t-att-src="'/web/image/product.product/%s/image_1024' % product_variant.id" class="d-block product_detail_img" alt="Product Image"/>
+ <img t-else="" t-att-src="'/web/image/product.template/%s/image_1024' % product.id" class="d-block product_detail_img" alt="Product Image"/>
</div>
</t>
<t t-else="">
@@ -87,8 +87,8 @@
<input type="hidden" class="product_template_id" t-att-value="product.product_tmpl_id.id"/>
<input type="hidden" class="product_id" t-att-value="product_variant.id"/>
<td class='td-img'>
- <img t-if="product_variant" t-att-src="'/web/image/product.product/%s/image_medium' % product_variant.id" alt="Product Image"/>
- <img t-else="" t-att-src="'/web/image/product.template/%s/image_medium' % product.id" alt="Product Image"/>
+ <img t-if="product_variant" t-att-src="'/web/image/product.product/%s/image_128' % product_variant.id" alt="Product Image"/>
+ <img t-else="" t-att-src="'/web/image/product.template/%s/image_128' % product.id" alt="Product Image"/>
</td>
<td class='td-product_name'>
<strong t-esc="combination_info['display_name']"/>
@@ -165,8 +165,8 @@
<td class="td-img">
<input type="hidden" class="product_template_id" t-att-value="product.id"/>
<input type="hidden" class="product_id" t-attf-name="optional-product-#{product.id}" t-att-value="product_variant.id"/>
- <img t-if="product_variant" t-att-src="'/web/image/product.product/%s/image_medium' % product_variant.id" class="variant_image" alt="Product Image"/>
- <img t-else="" t-att-src="'/web/image/product.template/%s/image_medium' % product.id" class="variant_image" alt="Product Image"/>
+ <img t-if="product_variant" t-att-src="'/web/image/product.product/%s/image_128' % product_variant.id" class="variant_image" alt="Product Image"/>
+ <img t-else="" t-att-src="'/web/image/product.template/%s/image_128' % product.id" class="variant_image" alt="Product Image"/>
</td>
<td class='td-product_name' colspan="2">
<div class="float-left">
diff --git a/addons/sales_team/views/crm_team_views.xml b/addons/sales_team/views/crm_team_views.xml
index 7d60b8f3e26..a31b0e7ab2f 100644
--- a/addons/sales_team/views/crm_team_views.xml
+++ b/addons/sales_team/views/crm_team_views.xml
@@ -87,7 +87,7 @@
<t t-name="kanban-box">
<div class="oe_kanban_global_click" style="max-width: 200px">
<div class="o_kanban_record_top">
- <img t-att-src="kanban_image('res.users', 'image_small', record.id.raw_value)" height="40" width="40" class="oe_avatar oe_kanban_avatar_smallbox mb0" alt="Avatar"/>
+ <img t-att-src="kanban_image('res.users', 'image_64', record.id.raw_value)" height="40" width="40" class="oe_avatar oe_kanban_avatar_smallbox mb0" alt="Avatar"/>
<div class="o_kanban_record_headings ml8">
<strong class="o_kanban_record_title"><field name="name"/></strong>
</div>
diff --git a/addons/stock/data/stock_demo.xml b/addons/stock/data/stock_demo.xml
index ceaf8bad0aa..2566a0979bd 100644
--- a/addons/stock/data/stock_demo.xml
+++ b/addons/stock/data/stock_demo.xml
@@ -152,7 +152,7 @@
<field name="parent_id" ref="res_partner_company_1"/>
<field name="email">jeff.lawson52@example.com</field>
<field name="phone">(461)-417-6587</field>
- <field name="image" type="base64" file="stock/static/img/res_partner_address_41.jpg"/>
+ <field name="image_1920" type="base64" file="stock/static/img/res_partner_address_41.jpg"/>
</record>
<record id="res_company_1" model="res.company">
diff --git a/addons/stock/data/stock_demo2.xml b/addons/stock/data/stock_demo2.xml
index 3ed916236e0..198d41714be 100644
--- a/addons/stock/data/stock_demo2.xml
+++ b/addons/stock/data/stock_demo2.xml
@@ -35,7 +35,7 @@
<field name="tracking">lot</field>
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
- <field name="image" type="base64" file="stock/static/img/cable_management.png"/>
+ <field name="image_1920" type="base64" file="stock/static/img/cable_management.png"/>
</record>
<record id="lot_product_cable_management" model="stock.production.lot">
diff --git a/addons/stock_landed_costs/views/stock_landed_cost_views.xml b/addons/stock_landed_costs/views/stock_landed_cost_views.xml
index fde86dfccdf..8169f4b3f1f 100644
--- a/addons/stock_landed_costs/views/stock_landed_cost_views.xml
+++ b/addons/stock_landed_costs/views/stock_landed_cost_views.xml
@@ -205,7 +205,7 @@
<form string="Landed Costs">
<sheet>
<widget name="web_ribbon" text="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
- <field name="image_medium" widget="image" class="oe_avatar"/>
+ <field name="image_1920" widget="image" class="oe_avatar" options="{'image_preview': 'image_128'}"/>
<div class="oe_title">
<div class="oe_edit_only">
<label for="name" name='label_name' string="Product Name"/>
diff --git a/addons/stock_picking_batch/views/stock_picking_batch_views.xml b/addons/stock_picking_batch/views/stock_picking_batch_views.xml
index 12d9c7a3fea..0c677a986f8 100644
--- a/addons/stock_picking_batch/views/stock_picking_batch_views.xml
+++ b/addons/stock_picking_batch/views/stock_picking_batch_views.xml
@@ -75,7 +75,7 @@
<div class="o_kanban_record_bottom">
<div class="oe_kanban_bottom_left"/>
<div class="oe_kanban_bottom_right">
- <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar"/>
+ <img t-att-src="kanban_image('res.users', 'image_64', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar"/>
</div>
</div>
</div>
diff --git a/addons/survey/views/gamification_badge_views.xml b/addons/survey/views/gamification_badge_views.xml
index e9f03f85936..fa404edf6e2 100644
--- a/addons/survey/views/gamification_badge_views.xml
+++ b/addons/survey/views/gamification_badge_views.xml
@@ -8,7 +8,7 @@
<form string="Badge">
<sheet>
<div class="oe_button_box" name="button_box"/>
- <field name="image" widget='image' class="oe_avatar"/>
+ <field name="image_1920" widget="image" class="oe_avatar" options="{'preview_image': 'image_128'}"/>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
diff --git a/addons/survey/views/survey_templates.xml b/addons/survey/views/survey_templates.xml
index 605fd56ef60..569da41c1c5 100644
--- a/addons/survey/views/survey_templates.xml
+++ b/addons/survey/views/survey_templates.xml
@@ -51,7 +51,7 @@
</div>
</div>
<div class="col-6 text-center" t-if="survey.certification_give_badge and answer.quizz_passed">
- <img t-att-src="'/web/image/gamification.badge/%s/image_medium' % survey.certification_badge_id.id"/>
+ <img t-att-src="'/web/image/gamification.badge/%s/image_128' % survey.certification_badge_id.id"/>
<div>You received the badge <span class="font-weight-bold" t-esc="survey.certification_badge_id.name"/>!</div>
</div>
</div>
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py
index 85f01e3c83d..11996d46ecc 100644
--- a/addons/web/controllers/main.py
+++ b/addons/web/controllers/main.py
@@ -1186,7 +1186,7 @@ class Binary(http.Controller):
'/web/partner_image/<int:rec_id>',
'/web/partner_image/<int:rec_id>/<string:field>',
'/web/partner_image/<int:rec_id>/<string:field>/<string:model>/'], type='http', auth="public")
- def content_image_partner(self, rec_id, field='image_small', model='res.partner', **kwargs):
+ def content_image_partner(self, rec_id, field='image_64', model='res.partner', **kwargs):
# other kwargs are ignored on purpose
return self._content_image(id=rec_id, model='res.partner', field=field,
placeholder='user_placeholder.jpg')
diff --git a/addons/web/static/src/js/chrome/user_menu.js b/addons/web/static/src/js/chrome/user_menu.js
index c2d19b7a879..3b93bbd9c3b 100644
--- a/addons/web/static/src/js/chrome/user_menu.js
+++ b/addons/web/static/src/js/chrome/user_menu.js
@@ -46,7 +46,7 @@ var UserMenu = Widget.extend({
self.$('.oe_topbar_name').text(topbar_name);
var avatar_src = session.url('/web/image', {
model:'res.users',
- field: 'image_small',
+ field: 'image_64',
id: session.uid,
});
$avatar.attr('src', avatar_src);
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js
index 322168a7241..dbafc45e592 100644
--- a/addons/web/static/src/js/fields/basic_fields.js
+++ b/addons/web/static/src/js/fields/basic_fields.js
@@ -1833,7 +1833,7 @@ var FieldBinaryImage = AbstractFieldBinary.extend({
this.$el.addClass(this.attrs.class);
}
- var urlThumb = this._getImageUrl(this.model, this.res_id, 'image_medium', unique);
+ var urlThumb = this._getImageUrl(this.model, this.res_id, 'image_128', unique);
this.$el.empty();
$img = this.$el;
diff --git a/addons/web/static/src/js/views/calendar/calendar_view.js b/addons/web/static/src/js/views/calendar/calendar_view.js
index 2ee927a4af0..af4a0baa2ec 100644
--- a/addons/web/static/src/js/views/calendar/calendar_view.js
+++ b/addons/web/static/src/js/views/calendar/calendar_view.js
@@ -103,7 +103,7 @@ var CalendarView = AbstractView.extend({
};
if (fields[fieldName].relation) {
if (['res.users', 'res.partner'].indexOf(fields[fieldName].relation) !== -1) {
- filters[fieldName].avatar_field = 'image_small';
+ filters[fieldName].avatar_field = 'image_64';
}
filters[fieldName].avatar_model = fields[fieldName].relation;
}
diff --git a/addons/web/tests/test_image.py b/addons/web/tests/test_image.py
index bf1bb06f8e6..454f237ce1d 100644
--- a/addons/web/tests/test_image.py
+++ b/addons/web/tests/test_image.py
@@ -20,17 +20,17 @@ class TestImage(HttpCase):
self.assertEqual(image.size, (150, 150))
# CASE: resize placeholder to small
- response = self.url_open('/web/image/fake/0/image_small')
+ response = self.url_open('/web/image/fake/0/image_64')
image = Image.open(io.BytesIO(response.content))
self.assertEqual(image.size, (64, 64))
# CASE: resize placeholder to medium
- response = self.url_open('/web/image/fake/0/image_medium')
+ response = self.url_open('/web/image/fake/0/image_128')
image = Image.open(io.BytesIO(response.content))
self.assertEqual(image.size, (128, 128))
# CASE: resize placeholder to large
- response = self.url_open('/web/image/fake/0/image_large')
+ response = self.url_open('/web/image/fake/0/image_256')
image = Image.open(io.BytesIO(response.content))
self.assertEqual(image.size, (256, 256))
diff --git a/addons/website/tests/template_qweb_test.xml b/addons/website/tests/template_qweb_test.xml
index 423c8d3212e..ac7dd4e390f 100644
--- a/addons/website/tests/template_qweb_test.xml
+++ b/addons/website/tests/template_qweb_test.xml
@@ -28,7 +28,7 @@
<a href="/web/content/local_link">x</a>
<span t-attf-style="background-image: url('/web/image/2')" t-att-empty="False">xxx</span>
<div widget="html" t-field="user.signature"/>
- <div widget="image" t-field="user.image" t-options="{'widget': 'image'}"/>
+ <div widget="image" t-field="user.image_1920" t-options="{'widget': 'image'}"/>
</body>
</html>
</template>
diff --git a/addons/website/tests/test_qweb.py b/addons/website/tests/test_qweb.py
index 8e2eb382a40..9386c9f81e3 100644
--- a/addons/website/tests/test_qweb.py
+++ b/addons/website/tests/test_qweb.py
@@ -57,7 +57,7 @@ class TestQweb(TransactionCase):
<div widget="html"><span class="toto">
span<span class="fa"></span><img src="http://test.cdn/web/image/1">
</span></div>
- <div widget="image"><img src="http://test.cdn/web/image/res.users/%(user_id)s/image/%(filename)s" class="img img-fluid" alt="%(alt)s"/></div>
+ <div widget="image"><img src="http://test.cdn/web/image/res.users/%(user_id)s/image_1920/%(filename)s" class="img img-fluid" alt="%(alt)s"/></div>
</body>
</html>""" % {
"js": attachments[0].url,
diff --git a/addons/website_blog/models/website_blog.py b/addons/website_blog/models/website_blog.py
index 57a731e444b..6bf40b32f63 100644
--- a/addons/website_blog/models/website_blog.py
+++ b/addons/website_blog/models/website_blog.py
@@ -160,7 +160,7 @@ class BlogPost(models.Model):
create_uid = fields.Many2one('res.users', 'Created by', index=True, readonly=True)
write_date = fields.Datetime('Last Updated on', index=True, readonly=True)
write_uid = fields.Many2one('res.users', 'Last Contributor', index=True, readonly=True)
- author_avatar = fields.Binary(related='author_id.image_small', string="Avatar", readonly=False)
+ author_avatar = fields.Binary(related='author_id.image_64', string="Avatar", readonly=False)
visits = fields.Integer('No of Views', copy=False)
ranking = fields.Float(compute='_compute_ranking', string='Ranking')
diff --git a/addons/website_blog/static/src/js/website_blog.editor.js b/addons/website_blog/static/src/js/website_blog.editor.js
index 2eedfc78b2e..1342d32201f 100644
--- a/addons/website_blog/static/src/js/website_blog.editor.js
+++ b/addons/website_blog/static/src/js/website_blog.editor.js
@@ -127,7 +127,7 @@ options.registry.many2one.include({
var $img = $(this).find('img');
var css = window.getComputedStyle($img[0]);
$img.css({ width: css.width, height: css.height });
- $img.attr('src', '/web/image/res.partner/'+self.ID+'/image');
+ $img.attr('src', '/web/image/res.partner/'+self.ID+'/image_1024');
});
setTimeout(function () { $nodes.removeClass('o_dirty'); },0);
}
diff --git a/addons/website_blog/views/website_blog_views.xml b/addons/website_blog/views/website_blog_views.xml
index 91c317c8f0b..7152b2c299b 100644
--- a/addons/website_blog/views/website_blog_views.xml
+++ b/addons/website_blog/views/website_blog_views.xml
@@ -143,7 +143,7 @@
<i class="fa fa-clock-o" role="img" aria-label="Post date" title="Post date"/><span t-esc="record.post_date.value"/>
</div>
<div class="col-4 text-right">
- <img t-att-src="kanban_image('res.partner', 'image_small', record.author_id.raw_value)" t-att-title="record.author_id.value" t-att-alt="record.author_id.value" width="24" height="24" class="oe_kanban_avatar"/>
+ <img t-att-src="kanban_image('res.partner', 'image_64', record.author_id.raw_value)" t-att-title="record.author_id.value" t-att-alt="record.author_id.value" width="24" height="24" class="oe_kanban_avatar"/>
</div>
</div>
</div>
diff --git a/addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml b/addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml
index 822678fa8d7..013944362fa 100644
--- a/addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml
+++ b/addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml
@@ -82,7 +82,7 @@
</t>
<div class="media mt-3">
<a t-attf-href="/partners/#{slug(partner)}?#{current_grade and 'grade_id=%s&amp;' % current_grade.id}#{current_country and 'country_id=%s' % current_country.id}"
- t-field="partner.image_medium"
+ t-field="partner.image_128"
t-options='{"widget": "image", "class": "mr-3"}'
></a>
<div class="media-body o_partner_body" style="min-height: 64px;">
@@ -164,7 +164,7 @@
<t t-if="any([p.website_published for p in partner.implemented_partner_ids])">
<h3 id="references">References</h3>
<div t-foreach="partner.implemented_partner_ids" t-if="reference.website_published" t-as="reference" class="media mt-3">
- <span t-field="reference.image_medium" t-options='{"widget": "image", "class": "d-block mr-3"}'/>
+ <span t-field="reference.image_128" t-options='{"widget": "image", "class": "d-block mr-3"}'/>
<div class="media-body" style="min-height: 64px;">
<span t-field="reference.self"/>
<div t-field='reference.website_short_description'/>
diff --git a/addons/website_customer/views/website_customer_templates.xml b/addons/website_customer/views/website_customer_templates.xml
index 9cd668d901d..8a5c917c1d1 100644
--- a/addons/website_customer/views/website_customer_templates.xml
+++ b/addons/website_customer/views/website_customer_templates.xml
@@ -36,7 +36,7 @@
<t t-foreach="partners" t-as="partner">
<div class="media mt-3">
<a t-attf-href="/customers/#{slug(partner)}"
- t-field="partner.image_medium"
+ t-field="partner.image_128"
t-options='{"widget": "image", "class": "mr-3"}'
></a>
<div class="media-body" style="min-height: 64px;">
@@ -197,7 +197,7 @@
</a>
</h4>
<div><a t-attf-href="/partners/#{slug(partner.assigned_partner_id)}"
- t-field="partner.assigned_partner_id.image_medium"
+ t-field="partner.assigned_partner_id.image_128"
t-options='{"widget": "image", "class": "d-block mx-auto"}'
/>
</div>
@@ -218,7 +218,7 @@
<div t-foreach="partner.implemented_partner_ids" t-as="reference" class="media mt-3">
<t t-if="reference.website_published">
<a t-attf-href="/customers/#{slug(reference)}">
- <span t-field="reference.image_medium" t-options='{"widget": "image", "class": "d-block mr-3"}'/>
+ <span t-field="reference.image_128" t-options='{"widget": "image", "class": "d-block mr-3"}'/>
</a>
<div class="media-body" style="min-height: 64px;">
<a t-attf-href="/customers/#{slug(reference)}">
diff --git a/addons/website_event_track/models/event_track.py b/addons/website_event_track/models/event_track.py
index 6f0a72d31c6..20b146f0f84 100644
--- a/addons/website_event_track/models/event_track.py
+++ b/addons/website_event_track/models/event_track.py
@@ -88,7 +88,7 @@ class Track(models.Model):
('0', 'Low'), ('1', 'Medium'),
('2', 'High'), ('3', 'Highest')],
'Priority', required=True, default='1')
- image = fields.Binary('Image', related='partner_id.image_medium', store=True, readonly=False)
+ image = fields.Image("Image", related='partner_id.image_128', store=True, readonly=False)
@api.depends('name')
def _compute_website_url(self):
@@ -202,4 +202,4 @@ class Sponsor(models.Model):
partner_id = fields.Many2one('res.partner', 'Sponsor/Customer', required=True)
url = fields.Char('Sponsor Website')
sequence = fields.Integer('Sequence', store=True, related='sponsor_type_id.sequence', readonly=False)
- image_medium = fields.Binary(string='Logo', related='partner_id.image_medium', store=True, readonly=False)
+ image_128 = fields.Image(string="Logo", related='partner_id.image_128', store=True, readonly=False)
diff --git a/addons/website_event_track/views/event_track_templates.xml b/addons/website_event_track/views/event_track_templates.xml
index 6e55bb1c0b2..cf924566f1f 100644
--- a/addons/website_event_track/views/event_track_templates.xml
+++ b/addons/website_event_track/views/event_track_templates.xml
@@ -18,7 +18,7 @@
<div t-attf-class="col-sm-6 col-lg-#{(len(event.sponsor_ids) > 6) and 2 or (12 // len(event.sponsor_ids))} text-center mb16 oe_sponsor" t-foreach="event.sponsor_ids" t-as="sponsor">
<t t-if="sponsor.url">
<a t-att-href="sponsor.url" style="position: relative; display: inline-block;" class="bg-white">
- <span t-field="sponsor.image_medium"
+ <span t-field="sponsor.image_128"
t-options='{"widget": "image", "class": "shadow"}'/>
<div class="ribbon-wrapper">
<div t-field="sponsor.sponsor_type_id" t-attf-class="ribbon ribbon_#{sponsor.sponsor_type_id.name}"/>
@@ -27,7 +27,7 @@
</t>
<t t-if="not sponsor.url">
<span style="position: relative; display: inline-block;" class="bg-white">
- <span t-field="sponsor.image_medium"
+ <span t-field="sponsor.image_128"
t-options='{"widget": "image", "class": "shadow"}'/>
<div class="ribbon-wrapper">
<div t-field="sponsor.sponsor_type_id" t-attf-class="ribbon ribbon_#{sponsor.sponsor_type_id.name}"/>
@@ -242,7 +242,7 @@
<div t-if="track.partner_id" class="mt32">
<div class="row">
<div class="col-md-2">
- <span t-field="track.partner_id.sudo().image_medium"
+ <span t-field="track.partner_id.sudo().image_128"
t-options='{"widget": "image", "class": "rounded-circle"}'/>
</div><div class="col-md-10">
<h4 t-field="track.partner_id.name" class="mb4"/>
diff --git a/addons/website_event_track/views/event_track_views.xml b/addons/website_event_track/views/event_track_views.xml
index 5ec6624b0c7..599d304d4e6 100644
--- a/addons/website_event_track/views/event_track_views.xml
+++ b/addons/website_event_track/views/event_track_views.xml
@@ -44,7 +44,7 @@
</div>
<div class="oe_kanban_bottom_right">
<field name="kanban_state" widget="state_selection" groups="base.group_user"/>
- <img t-att-src="kanban_image('res.partner', 'image_small', record.partner_id.raw_value)"
+ <img t-att-src="kanban_image('res.partner', 'image_64', record.partner_id.raw_value)"
t-att-title="record.partner_id.value" t-att-alt="record.partner_id.value" width="24" height="24"
class="oe_kanban_avatar"/>
</div>
diff --git a/addons/website_forum/models/forum.py b/addons/website_forum/models/forum.py
index 3bd01177ec7..8056381da96 100644
--- a/addons/website_forum/models/forum.py
+++ b/addons/website_forum/models/forum.py
@@ -388,7 +388,7 @@ class Post(models.Model):
res = super(Post, self)._default_website_meta()
res['default_opengraph']['og:title'] = res['default_twitter']['twitter:title'] = self.name
res['default_opengraph']['og:description'] = res['default_twitter']['twitter:description'] = self.plain_content
- res['default_opengraph']['og:image'] = res['default_twitter']['twitter:image'] = "/web/image/res.users/%s/image" % (self.create_uid.id)
+ res['default_opengraph']['og:image'] = res['default_twitter']['twitter:image'] = "/web/image/res.users/%s/image_1024" % (self.create_uid.id)
res['default_twitter']['twitter:card'] = 'summary'
res['default_meta_description'] = self.plain_content
return res
diff --git a/addons/website_forum/views/forum.xml b/addons/website_forum/views/forum.xml
index ff8ad6c2256..1c46079b518 100644
--- a/addons/website_forum/views/forum.xml
+++ b/addons/website_forum/views/forum.xml
@@ -29,7 +29,7 @@
<form string="Forum">
<sheet>
<widget name="web_ribbon" text="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
- <field name="image" widget="image" options="{'preview_image': 'image_medium'}" class="oe_avatar"/>
+ <field name="image_1920" widget="image" options="{'preview_image': 'image_128'}" class="oe_avatar"/>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
diff --git a/addons/website_forum/views/website_forum.xml b/addons/website_forum/views/website_forum.xml
index f971c068f8e..e5737e037d1 100644
--- a/addons/website_forum/views/website_forum.xml
+++ b/addons/website_forum/views/website_forum.xml
@@ -73,7 +73,7 @@
<div class="card bg-secondary" t-if="question">
<h6 class="card-header"><b>Writer</b></h6>
<div class="card-body o_card_people">
- <img class="o_wforum_people_photo_container d-block mx-auto mb-3" t-attf-src="/web/image/res.users/#{question.create_uid.id}/image_medium"/>
+ <img class="o_wforum_people_photo_container d-block mx-auto mb-3" t-attf-src="/web/image/res.users/#{question.create_uid.id}/image_128"/>
<h6 class="text-center">
<b><i class="fa fa-diamond text-secondary"/> <t t-esc="question.create_uid.sudo().karma"/></b>
<b><a t-attf-href="/forum/#{slug(forum)}/user/#{question.create_uid.sudo().id}" t-field="question.create_uid" t-options='{"widget": "contact", "fields": ["name", "country_id"]}'/></b>
@@ -397,9 +397,9 @@
<h1 class="card-header h6 font-weight-bold bg-white"
t-field="forum.name"/>
<div class="card-img-bottom embed-responsive embed-responsive-16by9 o_wforum_forum_card_bg">
- <div t-if="forum.image"
+ <div t-if="forum.image_256"
class="oe_img_bg embed-responsive-item"
- t-attf-style="background-image: url(/web/image/forum.forum/#{forum.id}/image_large); background-position: center;"/>
+ t-attf-style="background-image: url(/web/image/forum.forum/#{forum.id}/image_256); background-position: center;"/>
</div>
</div>
</a>
@@ -913,7 +913,7 @@
<t t-call="website_forum.forum_user_tooltip"/>
</div>
<a t-att-href="user_profile_url" class="o_forum_user_info">
- <img class="float-left o_forum_avatar" t-attf-src="/web/image/res.users/#{answer.create_uid.id}/image_medium" alt="Avatar"/>
+ <img class="float-left o_forum_avatar" t-attf-src="/web/image/res.users/#{answer.create_uid.id}/image_128" alt="Avatar"/>
</a>
<a t-att-href="user_profile_url"
t-field="answer.create_uid"
@@ -969,7 +969,7 @@
<div class="o_forum_user_bio text-left card">
<div class="card-body">
<a t-att-href="user_profile_url">
- <img class="float-left img rounded o_forum_avatar_big" t-attf-src="/web/image/res.users/#{answer.create_uid.id}/image_medium" alt="Avatar"/>
+ <img class="float-left img rounded o_forum_avatar_big" t-attf-src="/web/image/res.users/#{answer.create_uid.id}/image_128" alt="Avatar"/>
</a>
<div class="o_forum_tooltip_header">
<h4 class="o_forum_tooltip_heading"><a t-att-href="user_profile_url"
@@ -1126,7 +1126,7 @@
<input type="checkbox" t-att-value="user.id" class="custom-control-input" t-attf-id="user_#{user.id}"/>
<label class="custom-control-label" t-attf-for="user_#{user.id}">
<div class="col-11 d-inline-flex">
- <img class="d-inline img o_forum_avatar" t-attf-src="/web/image/res.users/#{user.id}/image_medium" alt="Avatar"/>
+ <img class="d-inline img o_forum_avatar" t-attf-src="/web/image/res.users/#{user.id}/image_128" alt="Avatar"/>
<b t-esc="user.name" class="d-inline"></b>
</div>
</label>
diff --git a/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml b/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml
index dd2b6504ea7..c25a60b78f8 100644
--- a/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml
+++ b/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml
@@ -424,7 +424,7 @@
<h3 class="mb32 text-center">Your application has been sent to:</h3>
</div>
<div class="col-lg-1 offset-lg-4">
- <p t-field="responsible.image_small" t-options="{'widget': 'image', 'class': 'rounded-circle d-block mx-auto'}"/>
+ <p t-field="responsible.image_64" t-options="{'widget': 'image', 'class': 'rounded-circle d-block mx-auto'}"/>
</div>
<div class="col-lg-5 o_responsible_data">
<h4 class="mt0" t-field="responsible.name"/>
diff --git a/addons/website_livechat/views/website_livechat.xml b/addons/website_livechat/views/website_livechat.xml
index 2cc0dc35f6f..75e884bdcf1 100644
--- a/addons/website_livechat/views/website_livechat.xml
+++ b/addons/website_livechat/views/website_livechat.xml
@@ -146,13 +146,13 @@
<h3>The Team</h3>
<t t-foreach="team" t-as="user">
<div class="media mt-3">
- <t t-if="user.image_small">
+ <t t-if="user.image_64">
<t t-if="user.livechat_username">
- <img t-att-src="user.image_small and image_data_uri(user.image_small) or '/web/static/src/img/placeholder.png'"
+ <img t-att-src="user.image_64 and image_data_uri(user.image_64) or '/web/static/src/img/placeholder.png'"
class="rounded o_livechat_operator_avatar" t-att-alt="user.livechat_username"/>
</t>
<t t-else="">
- <img t-att-src="user.image_small and image_data_uri(user.image_small) or '/web/static/src/img/placeholder.png'"
+ <img t-att-src="user.image_64 and image_data_uri(user.image_64) or '/web/static/src/img/placeholder.png'"
class="rounded o_livechat_operator_avatar" t-att-alt="user.name"/>
</t>
</t>
@@ -214,7 +214,7 @@
<t t-foreach="channels" t-as="channel">
<div t-attf-class="media#{' mt-3' if channel_index else ''}">
<a t-attf-href="/livechat/channel/#{ slug(channel)}">
- <img t-att-src="channel.image_small and image_data_uri(channel.image_small) or '/web/static/src/img/placeholder.png'" t-att-alt="channel.name" />
+ <img t-att-src="channel.image_64 and image_data_uri(channel.image_64) or '/web/static/src/img/placeholder.png'" t-att-alt="channel.name" />
</a>
<div class="media-body">
<h4><t t-esc="channel.name"/></h4>
diff --git a/addons/website_mail_channel/views/website_mail_channel_templates.xml b/addons/website_mail_channel/views/website_mail_channel_templates.xml
index 7b439bb0b91..d2b6e82a4c9 100644
--- a/addons/website_mail_channel/views/website_mail_channel_templates.xml
+++ b/addons/website_mail_channel/views/website_mail_channel_templates.xml
@@ -33,7 +33,7 @@
</div>
<div class="row mt8" t-foreach="groups" t-as="group">
<div class="col-lg-3">
- <img t-att-src="website.image_url(group, 'image_small')" class="float-left" alt="Group"/>
+ <img t-att-src="website.image_url(group, 'image_64')" class="float-left" alt="Group"/>
<strong><a t-attf-href="/groups/#{ slug(group) }" t-esc="group.name"/></strong><br />
<t t-if="group.alias_id and group.alias_id.alias_name and group.alias_id.alias_domain">
<i class='fa fa-envelope-o' role="img" aria-label="Alias" title="Alias"/>
diff --git a/addons/website_membership/views/website_membership_templates.xml b/addons/website_membership/views/website_membership_templates.xml
index 8939d1adf98..3ff095b3123 100644
--- a/addons/website_membership/views/website_membership_templates.xml
+++ b/addons/website_membership/views/website_membership_templates.xml
@@ -54,7 +54,7 @@
<t t-set="partner" t-value="partners[partner_id]"/>
<div class="media mt-3">
<a t-attf-href="/members/#{slug(partner)}"
- t-field="partner.image_small"
+ t-field="partner.image_64"
t-options='{"widget": "image", "class": "media-object mr-3"}'
></a>
<div class="media-body" style="min-height: 64px;">
diff --git a/addons/website_partner/views/website_partner_templates.xml b/addons/website_partner/views/website_partner_templates.xml
index 2f5c58b1dee..60adb04ee2d 100644
--- a/addons/website_partner/views/website_partner_templates.xml
+++ b/addons/website_partner/views/website_partner_templates.xml
@@ -17,7 +17,7 @@
<template id="partner_detail" name="Partner Details">
<h1 class="col-lg-12 text-center" id="partner_name" t-field="partner.display_name"/>
<div class="col-lg-4">
- <div t-field="partner.image" t-options='{"widget": "image", "class": "d-block mx-auto mb16", "max_width": 512}'/>
+ <div t-field="partner.image_1920" t-options='{"widget": "image", "preview_image": "image_512", "class": "d-block mx-auto mb16"}'/>
<address>
<div t-field="partner.self" t-options='{
"widget": "contact",
diff --git a/addons/website_profile/controllers/main.py b/addons/website_profile/controllers/main.py
index 9dcc345cb0a..e11d68fa835 100644
--- a/addons/website_profile/controllers/main.py
+++ b/addons/website_profile/controllers/main.py
@@ -72,8 +72,8 @@ class WebsiteProfile(http.Controller):
@http.route([
'/profile/avatar/<int:user_id>',
], type='http', auth="public", website=True, sitemap=False)
- def get_user_profile_avatar(self, user_id, field='image_large', width=0, height=0, crop=False, **post):
- if field not in ('image_small', 'image_medium', 'image_large'):
+ def get_user_profile_avatar(self, user_id, field='image_256', width=0, height=0, crop=False, **post):
+ if field not in ('image_64', 'image_128', 'image_256'):
return werkzeug.exceptions.Forbidden()
can_sudo = self._check_avatar_access(user_id, **post)
diff --git a/addons/website_profile/views/website_profile.xml b/addons/website_profile/views/website_profile.xml
index e30e6ee6593..b5470a833a9 100644
--- a/addons/website_profile/views/website_profile.xml
+++ b/addons/website_profile/views/website_profile.xml
@@ -104,7 +104,7 @@
<div class="col-3">
<div class="card o_card_people">
<div class="card-body">
- <img class="o_forum_avatar_img w-100 mb-3" t-attf-src="/web/image/res.users/#{user.id}/image_medium"/>
+ <img class="o_forum_avatar_img w-100 mb-3" t-attf-src="/web/image/res.users/#{user.id}/image_128"/>
<div class="text-center">
<a href="#" class="o_forum_profile_pic_edit btn btn-primary" aria-label="Edit">
<i class="fa fa-pencil fa-1g float-sm-none float-md-left" title="Edit"></i>
@@ -206,7 +206,7 @@
<!-- ==== Header Left ==== -->
<div class="col-12 col-md-4 col-lg-3">
<div t-attf-class="d-flex align-items-start h-100 #{'justify-content-between' if (request.env.user == user) else 'justify-content-around' }">
- <div class="o_wprofile_pict d-inline-block mb-3 mb-md-0" t-attf-style="background-image:url(/web/image/res.users/#{user.id}/image)"/>
+ <div class="o_wprofile_pict d-inline-block mb-3 mb-md-0" t-attf-style="background-image:url(/web/image/res.users/#{user.id}/image_1024)"/>
<a class="btn btn-primary d-inline-block d-md-none" t-if="request.env.user == user and user.karma != 0" t-attf-href="/profile/edit?url_param=#{edit_button_url_param}">
<i class="fa fa-pencil mr-1"/>EDIT
</a>
@@ -252,7 +252,7 @@
<div class="o_wprofile_sidebar_top d-flex justify-content-between">
<div t-if="user.rank_id" class="d-flex align-items-center">
<small class="font-weight-bold mr-2">Current rank:</small>
- <img t-attf-src="/web/image/gamification.karma.rank/#{user.rank_id.id}/image_small" height="16" alt="" class="mr-1"/>
+ <img t-attf-src="/web/image/gamification.karma.rank/#{user.rank_id.id}/image_64" height="16" alt="" class="mr-1"/>
<a href="/profile/ranks_badges" t-field="user.rank_id"/>
</div>
<button class="btn btn-sm d-md-none bg-white border" type="button" data-toggle="collapse" data-target="#o_wprofile_sidebar_collapse" aria-expanded="false" aria-controls="o_wprofile_sidebar_collapse">More info</button>
@@ -341,7 +341,7 @@
</svg>
<div class="o_pc_overlay d-flex flex-column align-items-center justify-content-center">
<img class="img-fluid"
- t-attf-src="/web/image/gamification.karma.rank/#{next_rank_id.id if next_rank_id else user.rank_id.id}/image_medium"
+ t-attf-src="/web/image/gamification.karma.rank/#{next_rank_id.id if next_rank_id else user.rank_id.id}/image_128"
t-att-alt="(next_rank_id.name if next_rank_id else user.rank_id.name) + ' badge'"
t-att-style="'max-width: ' + (img_max_width if img_max_width else '50%;')"/>
<h4 class=" mb-0">
@@ -367,7 +367,7 @@
<div class="card">
<div class="card-body p-2 pr-3">
<div class="media align-items-center">
- <img height="38" t-attf-src="/web/image/gamification.badge/#{badge.badge_id.id}/image_small" class="mr-0"/>
+ <img height="38" t-attf-src="/web/image/gamification.badge/#{badge.badge_id.id}/image_64" class="mr-0"/>
<div class="media-body col-md-10 p-0">
<h6 class="my-0 text-truncate" t-field="badge.badge_id.name"/>
</div>
@@ -406,7 +406,7 @@
<t t-foreach="ranks" t-as="rank">
<li t-attf-class="list-group-item">
<div class="media align-items-center">
- <img width="40" t-attf-src="/web/image/gamification.karma.rank/#{rank.id}/image" class="mr-2" alt="Rank badge"/>
+ <img width="40" t-attf-src="/web/image/gamification.karma.rank/#{rank.id}/image_64" class="mr-2" alt="Rank badge"/>
<div class="media-body">
<h5 class="mt-0 mb-0" t-field="rank.name"/>
<span class="badge badge-success"><span t-field="rank.karma_min"/></span> point<span t-if="rank.karma_min">s</span>
@@ -437,9 +437,9 @@
<table class="table table-sm mb64">
<tr t-foreach="badges" t-as="badge">
<td class="align-middle">
- <img t-if="not badge.image and badge.level" t-attf-src="/website_profile/static/src/img/badge_#{badge.level}.svg"
+ <img t-if="not badge.image_1920 and badge.level" t-attf-src="/website_profile/static/src/img/badge_#{badge.level}.svg"
class="my-1" style="height:2.5em" t-att-alt="badge.name"/>
- <img t-else="" t-attf-src="/web/image/gamification.badge/#{badge.id}/image" class="my-1" style="height:2.5em" t-att-alt="badge.name"/>
+ <img t-else="" t-attf-src="/web/image/gamification.badge/#{badge.id}/image_1024" class="my-1" style="height:2.5em" t-att-alt="badge.name"/>
<h6 t-field="badge.name" class="d-inline my-0"/>
</td>
<td class="align-middle d-none d-md-table-cell">
@@ -512,7 +512,7 @@
<div class="card text-center mb-2 border-bottom-0 o_wprofile_pointer">
<div class="card-body">
<div class="d-inline-block position-relative">
- <img class="rounded-circle img-fluid" t-att-src="'/profile/avatar/%s?field=image_medium%s' % (user['id'], '&amp;res_model=%s&amp;res_id=%s' % (record._name, record.id) if record else '')"/>
+ <img class="rounded-circle img-fluid" t-att-src="'/profile/avatar/%s?field=image_128%s' % (user['id'], '&amp;res_model=%s&amp;res_id=%s' % (record._name, record.id) if record else '')"/>
<img class="position-absolute" t-attf-src="/website_profile/static/src/img/rank_#{user_index + 1}.svg" alt="User rank" style="bottom: 0; right: -10px"/>
</div>
<h3 class="mt-2 mb-0" t-esc="user['name']"></h3>
@@ -531,7 +531,7 @@
<span t-esc="user['position']"/>
</td>
<td class="align-middle d-none d-sm-table-cell">
- <img class="rounded-circle o_wprofile_img_small" height="30" t-att-src="'/profile/avatar/%s?field=image_medium%s' % (user['id'], '&amp;res_model=%s&amp;res_id=%s' % (record._name, record.id) if record else '')"/>
+ <img class="rounded-circle o_wprofile_img_small" height="30" t-att-src="'/profile/avatar/%s?field=image_128%s' % (user['id'], '&amp;res_model=%s&amp;res_id=%s' % (record._name, record.id) if record else '')"/>
</td>
<td class="align-middle w-md-75">
<span class="font-weight-bold" t-esc="user['name']"/><br/>
diff --git a/addons/website_sale/data/mail_template_data.xml b/addons/website_sale/data/mail_template_data.xml
index 18a1bb70a51..32d57e03bba 100644
--- a/addons/website_sale/data/mail_template_data.xml
+++ b/addons/website_sale/data/mail_template_data.xml
@@ -43,7 +43,7 @@
<table width="100%">
<tr>
<td style="padding: 10px; width:150px;">
- <img src="/web/image/product.product/${line.product_id.id}/image_medium" height="100px" width="100px" alt="Product image"></img>
+ <img src="/web/image/product.product/${line.product_id.id}/image_128" height="100px" width="100px" alt="Product image"></img>
</td>
<td>
<strong>${line.product_id.display_name}</strong><br/>${line.name}
diff --git a/addons/website_sale/models/product.py b/addons/website_sale/models/product.py
index 056cbce0541..d8b22e6dfc9 100644
--- a/addons/website_sale/models/product.py
+++ b/addons/website_sale/models/product.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from odoo import api, fields, models, tools, _
+from odoo import api, fields, models, _
from odoo.exceptions import ValidationError, UserError
from odoo.addons.website.models import ir_http
from odoo.tools.translate import html_translate
@@ -137,7 +137,7 @@ class ProductPricelist(models.Model):
class ProductPublicCategory(models.Model):
_name = "product.public.category"
- _inherit = ["website.seo.metadata", "website.multi.mixin"]
+ _inherit = ["website.seo.metadata", "website.multi.mixin", 'image.mixin']
_description = "Website Product Category"
_parent_store = True
_order = "sequence, name"
@@ -148,32 +148,9 @@ class ProductPublicCategory(models.Model):
child_id = fields.One2many('product.public.category', 'parent_id', string='Children Categories')
parents_and_self = fields.Many2many('product.public.category', compute='_compute_parents_and_self')
sequence = fields.Integer(help="Gives the sequence order when displaying a list of product categories.", index=True)
- # NOTE: there is no 'default image', because by default we don't show
- # thumbnails for categories. However if we have a thumbnail for at least one
- # category, then we display a default image on the other, so that the
- # buttons have consistent styling.
- # In this case, the default image is set by the js code.
- image = fields.Binary(help="This field holds the image used as image for the category, limited to 1024x1024px.")
website_description = fields.Html('Category Description', sanitize_attributes=False, translate=html_translate)
- image_medium = fields.Binary(string='Medium-sized image',
- help="Medium-sized image of the category. 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(string='Small-sized image',
- help="Small-sized image of the category. It is automatically "
- "resized as a 64x64px image, with aspect ratio preserved. "
- "Use this field anywhere a small image is required.")
product_tmpl_ids = fields.Many2many('product.template', relation='product_public_category_product_template_rel')
- @api.model
- def create(self, vals):
- tools.image_resize_images(vals)
- return super(ProductPublicCategory, self).create(vals)
-
- def write(self, vals):
- tools.image_resize_images(vals)
- return super(ProductPublicCategory, self).write(vals)
-
@api.constrains('parent_id')
def check_parent_id(self):
if not self._check_recursion():
@@ -383,7 +360,7 @@ class ProductTemplate(models.Model):
res = super(ProductTemplate, self)._default_website_meta()
res['default_opengraph']['og:description'] = res['default_twitter']['twitter:description'] = self.description_sale
res['default_opengraph']['og:title'] = res['default_twitter']['twitter:title'] = self.name
- res['default_opengraph']['og:image'] = res['default_twitter']['twitter:image'] = "/web/image/product.template/%s/image" % (self.id)
+ res['default_opengraph']['og:image'] = res['default_twitter']['twitter:image'] = "/web/image/product.template/%s/image_1024" % (self.id)
res['default_meta_description'] = self.description_sale
return res
@@ -457,7 +434,7 @@ class Product(models.Model):
"""
self.ensure_one()
variant_images = list(self.product_variant_image_ids)
- if self.image_raw_original:
+ if self.image_variant_max:
# if the main variant image is set, display it first
variant_images = [self] + variant_images
else:
diff --git a/addons/website_sale/models/product_image.py b/addons/website_sale/models/product_image.py
index e991343b55d..562ebe79854 100644
--- a/addons/website_sale/models/product_image.py
+++ b/addons/website_sale/models/product_image.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from odoo import api, fields, models, _
+from odoo import api, fields, models, tools, _
from odoo.exceptions import ValidationError
from odoo.addons.website.tools import get_video_embed_code
@@ -16,7 +16,7 @@ class ProductImage(models.Model):
name = fields.Char("Name", required=True)
sequence = fields.Integer(default=10, index=True)
- image_original = fields.Binary(required=True)
+ image_1920 = fields.Image(required=True)
product_tmpl_id = fields.Many2one('product.template', "Product Template", index=True, ondelete='cascade')
product_variant_id = fields.Many2one('product.product', "Product Variant", index=True, ondelete='cascade')
@@ -24,6 +24,13 @@ class ProductImage(models.Model):
help='URL of a video for showcasing your product.')
embed_code = fields.Char(compute="_compute_embed_code")
+ can_image_1024_be_zoomed = fields.Boolean("Can Image 1024 be zoomed", compute='_compute_can_image_1024_be_zoomed', store=True)
+
+ @api.depends('image_1920', 'image_1024')
+ def _compute_can_image_1024_be_zoomed(self):
+ for image in self:
+ image.can_image_1024_be_zoomed = image.image_1920 and tools.is_image_size_above(image.image_1920, image.image_1024)
+
@api.depends('video_url')
def _compute_embed_code(self):
for image in self:
diff --git a/addons/website_sale/static/src/js/website_sale.js b/addons/website_sale/static/src/js/website_sale.js
index 85ef87d0e08..08c7f8775cf 100644
--- a/addons/website_sale/static/src/js/website_sale.js
+++ b/addons/website_sale/static/src/js/website_sale.js
@@ -440,7 +440,7 @@ publicWidget.registry.WebsiteSale = publicWidget.Widget.extend(VariantMixin, {
else { // compatibility 12.0
var model = productId ? 'product.product' : 'product.template';
var modelId = productId || productTemplateId;
- var imageSrc = '/web/image/{0}/{1}/image'
+ var imageSrc = '/web/image/{0}/{1}/image_1024'
.replace("{0}", model)
.replace("{1}", modelId);
@@ -451,7 +451,7 @@ publicWidget.registry.WebsiteSale = publicWidget.Widget.extend(VariantMixin, {
var $thumbnail = $productContainer.find('img.js_variant_img_small');
if ($thumbnail.length !== 0) { // if only one, thumbnails are not displayed
- $thumbnail.attr("src", "/web/image/{0}/{1}/image/90x90"
+ $thumbnail.attr("src", "/web/image/{0}/{1}/image_128/90x90"
.replace('{0}', model)
.replace('{1}', modelId));
$('.carousel').carousel(0);
diff --git a/addons/website_sale/static/src/scss/website_sale_frontend.scss b/addons/website_sale/static/src/scss/website_sale_frontend.scss
index 6993c1e2fa8..c0932d95425 100644
--- a/addons/website_sale/static/src/scss/website_sale_frontend.scss
+++ b/addons/website_sale/static/src/scss/website_sale_frontend.scss
@@ -140,6 +140,6 @@ $o-wsale-wizard-label-completed: $success;
}
table.js_cart_lines .td-img img {
- // allows sizing the placeholder image to the "image_small" size of 64px
+ // allows sizing the placeholder image to the "image_64" size of 64px
max-height: 64px;
} \ No newline at end of file
diff --git a/addons/website_sale/static/src/xml/website_sale_utils.xml b/addons/website_sale/static/src/xml/website_sale_utils.xml
index 0c470a0d58d..000f7118519 100644
--- a/addons/website_sale/static/src/xml/website_sale_utils.xml
+++ b/addons/website_sale/static/src/xml/website_sale_utils.xml
@@ -11,7 +11,7 @@
t-att-href="product['website_url']" class="dropdown-item p-2 text-wrap">
<div class="media align-items-center o_search_product_item">
<t t-if="widget.displayImage">
- <img t-attf-src="/web/image/product.template/#{product['id']}/image_small"
+ <img t-attf-src="/web/image/product.template/#{product['id']}/image_64"
class="flex-shrink-0"/>
</t>
<div class="media-body px-3">
diff --git a/addons/website_sale/tests/test_website_sale_image.py b/addons/website_sale/tests/test_website_sale_image.py
index 3577844e90d..63342ce9f12 100644
--- a/addons/website_sale/tests/test_website_sale_image.py
+++ b/addons/website_sale/tests/test_website_sale_image.py
@@ -89,7 +89,7 @@ class TestWebsiteSaleImage(odoo.tests.HttpCase):
# create the template, without creating the variants
template = self.env['product.template'].with_context(create_product_product=True).create({
'name': 'A Colorful Image',
- 'product_template_image_ids': [(0, 0, {'name': 'image 1', 'image': image_gif}), (0, 0, {'name': 'image 4', 'image': image_svg})],
+ 'product_template_image_ids': [(0, 0, {'name': 'image 1', 'image_1920': image_gif}), (0, 0, {'name': 'image 4', 'image_1920': image_svg})],
})
# set the color attribute and values on the template
@@ -112,33 +112,33 @@ class TestWebsiteSaleImage(odoo.tests.HttpCase):
# because the template image is empty and there is only one variant)
product_red = self.env['product.product'].create({
'product_tmpl_id': template.id,
- 'image': blue_image,
+ 'image_1920': blue_image,
'attribute_value_ids': [(6, 0, attr_values.filtered(lambda l: l.name == name_red).ids)],
- 'product_variant_image_ids': [(0, 0, {'name': 'image 2', 'image': image_bmp})],
+ 'product_variant_image_ids': [(0, 0, {'name': 'image 2', 'image_1920': image_bmp})],
})
- self.assertEqual(template.image_original, blue_image)
+ self.assertEqual(template.image_1920, blue_image)
# create the green variant
product_green = self.env['product.product'].create({
- 'image': green_image,
+ 'image_1920': green_image,
'product_tmpl_id': template.id,
'attribute_value_ids': [(6, 0, attr_values.filtered(lambda l: l.name == name_green).ids)],
- 'product_variant_image_ids': [(0, 0, {'name': 'image 3', 'image': image_png})],
+ 'product_variant_image_ids': [(0, 0, {'name': 'image 3', 'image_1920': image_png})],
})
# now set the red image on the first variant, that works because
# template image is not empty anymore and we have a second variant
- product_red.image = red_image
+ product_red.image_1920 = red_image
- # Verify image_original size > 1024 can be zoomed
- self.assertTrue(template.can_image_be_zoomed)
- self.assertFalse(template.product_template_image_ids[0].can_image_be_zoomed)
- self.assertFalse(template.product_template_image_ids[1].can_image_be_zoomed)
- self.assertFalse(product_red.can_image_be_zoomed)
- self.assertFalse(product_red.product_variant_image_ids[0].can_image_be_zoomed)
- self.assertTrue(product_green.can_image_be_zoomed)
- self.assertTrue(product_green.product_variant_image_ids[0].can_image_be_zoomed)
+ # Verify image_1920 size > 1024 can be zoomed
+ self.assertTrue(template.can_image_1024_be_zoomed)
+ self.assertFalse(template.product_template_image_ids[0].can_image_1024_be_zoomed)
+ self.assertFalse(template.product_template_image_ids[1].can_image_1024_be_zoomed)
+ self.assertFalse(product_red.can_image_1024_be_zoomed)
+ self.assertFalse(product_red.product_variant_image_ids[0].can_image_1024_be_zoomed)
+ self.assertTrue(product_green.can_image_1024_be_zoomed)
+ self.assertTrue(product_green.product_variant_image_ids[0].can_image_1024_be_zoomed)
# jpeg encoding is changing the color a bit
jpeg_blue = (65, 105, 227)
@@ -146,62 +146,68 @@ class TestWebsiteSaleImage(odoo.tests.HttpCase):
jpeg_green = (34, 139, 34)
# Verify original size: keep original
- image = Image.open(io.BytesIO(base64.b64decode(template.image_original)))
+ image = Image.open(io.BytesIO(base64.b64decode(template.image_1920)))
self.assertEqual(image.size, (1920, 1080))
self.assertEqual(image.getpixel((image.size[0] / 2, image.size[1] / 2)), jpeg_blue, "blue")
- image = Image.open(io.BytesIO(base64.b64decode(product_red.image_original)))
+ image = Image.open(io.BytesIO(base64.b64decode(product_red.image_1920)))
self.assertEqual(image.size, (800, 500))
self.assertEqual(image.getpixel((image.size[0] / 2, image.size[1] / 2)), jpeg_red, "red")
- image = Image.open(io.BytesIO(base64.b64decode(product_green.image_original)))
+ image = Image.open(io.BytesIO(base64.b64decode(product_green.image_1920)))
self.assertEqual(image.size, (1920, 1080))
self.assertEqual(image.getpixel((image.size[0] / 2, image.size[1] / 2)), jpeg_green, "green")
- # Verify big size: keep aspect ratio
- image = Image.open(io.BytesIO(base64.b64decode(template.image_big)))
+ # Verify 1024 size: keep aspect ratio
+ image = Image.open(io.BytesIO(base64.b64decode(template.image_1024)))
self.assertEqual(image.size, (1024, 576))
self.assertEqual(image.getpixel((image.size[0] / 2, image.size[1] / 2)), jpeg_blue, "blue")
- image = Image.open(io.BytesIO(base64.b64decode(product_red.image_big)))
+ image = Image.open(io.BytesIO(base64.b64decode(product_red.image_1024)))
self.assertEqual(image.size, (800, 500))
self.assertEqual(image.getpixel((image.size[0] / 2, image.size[1] / 2)), jpeg_red, "red")
- image = Image.open(io.BytesIO(base64.b64decode(product_green.image_big)))
+ image = Image.open(io.BytesIO(base64.b64decode(product_green.image_1024)))
self.assertEqual(image.size, (1024, 576))
self.assertEqual(image.getpixel((image.size[0] / 2, image.size[1] / 2)), jpeg_green, "green")
- # Verify image == image_big
- self.assertEqual(template.image_big, template.image)
- self.assertEqual(product_red.image_big, product_red.image)
- self.assertEqual(product_green.image_big, product_green.image)
+ # Verify 512 size: keep aspect ratio
+ image = Image.open(io.BytesIO(base64.b64decode(template.image_512)))
+ self.assertEqual(image.size, (512, 288))
+ self.assertEqual(image.getpixel((image.size[0] / 2, image.size[1] / 2)), jpeg_blue, "blue")
+ image = Image.open(io.BytesIO(base64.b64decode(product_red.image_512)))
+ self.assertEqual(image.size, (512, 320))
+ self.assertEqual(image.getpixel((image.size[0] / 2, image.size[1] / 2)), jpeg_red, "red")
+ image = Image.open(io.BytesIO(base64.b64decode(product_green.image_512)))
+ self.assertEqual(image.size, (512, 288))
+ self.assertEqual(image.getpixel((image.size[0] / 2, image.size[1] / 2)), jpeg_green, "green")
- # Verify large size: keep aspect ratio
- image = Image.open(io.BytesIO(base64.b64decode(template.image_large)))
+ # Verify 256 size: keep aspect ratio
+ image = Image.open(io.BytesIO(base64.b64decode(template.image_256)))
self.assertEqual(image.size, (256, 144))
self.assertEqual(image.getpixel((image.size[0] / 2, image.size[1] / 2)), jpeg_blue, "blue")
- image = Image.open(io.BytesIO(base64.b64decode(product_red.image_large)))
+ image = Image.open(io.BytesIO(base64.b64decode(product_red.image_256)))
self.assertEqual(image.size, (256, 160))
self.assertEqual(image.getpixel((image.size[0] / 2, image.size[1] / 2)), jpeg_red, "red")
- image = Image.open(io.BytesIO(base64.b64decode(product_green.image_large)))
+ image = Image.open(io.BytesIO(base64.b64decode(product_green.image_256)))
self.assertEqual(image.size, (256, 144))
self.assertEqual(image.getpixel((image.size[0] / 2, image.size[1] / 2)), jpeg_green, "green")
- # Verify medium size: keep aspect ratio
- image = Image.open(io.BytesIO(base64.b64decode(template.image_medium)))
+ # Verify 128 size: keep aspect ratio
+ image = Image.open(io.BytesIO(base64.b64decode(template.image_128)))
self.assertEqual(image.size, (128, 72))
self.assertEqual(image.getpixel((image.size[0] / 2, image.size[1] / 2)), jpeg_blue, "blue")
- image = Image.open(io.BytesIO(base64.b64decode(product_red.image_medium)))
+ image = Image.open(io.BytesIO(base64.b64decode(product_red.image_128)))
self.assertEqual(image.size, (128, 80))
self.assertEqual(image.getpixel((image.size[0] / 2, image.size[1] / 2)), jpeg_red, "red")
- image = Image.open(io.BytesIO(base64.b64decode(product_green.image_medium)))
+ image = Image.open(io.BytesIO(base64.b64decode(product_green.image_128)))
self.assertEqual(image.size, (128, 72))
self.assertEqual(image.getpixel((image.size[0] / 2, image.size[1] / 2)), jpeg_green, "green")
- # Verify small size: keep aspect ratio
- image = Image.open(io.BytesIO(base64.b64decode(template.image_small)))
+ # Verify 64 size: keep aspect ratio
+ image = Image.open(io.BytesIO(base64.b64decode(template.image_64)))
self.assertEqual(image.size, (64, 36))
self.assertEqual(image.getpixel((image.size[0] / 2, image.size[1] / 2)), jpeg_blue, "blue")
- image = Image.open(io.BytesIO(base64.b64decode(product_red.image_small)))
+ image = Image.open(io.BytesIO(base64.b64decode(product_red.image_64)))
self.assertEqual(image.size, (64, 40))
self.assertEqual(image.getpixel((image.size[0] / 2, image.size[1] / 2)), jpeg_red, "red")
- image = Image.open(io.BytesIO(base64.b64decode(product_green.image_small)))
+ image = Image.open(io.BytesIO(base64.b64decode(product_green.image_64)))
self.assertEqual(image.size, (64, 36))
self.assertEqual(image.getpixel((image.size[0] / 2, image.size[1] / 2)), jpeg_green, "green")
@@ -210,25 +216,27 @@ class TestWebsiteSaleImage(odoo.tests.HttpCase):
self.start_tour("/", 'shop_zoom', login="admin")
# CASE: unlink move image to fallback if fallback image empty
- template.image = False
+ template.image_1920 = False
product_red.unlink()
- self.assertEqual(template.image_original, red_image)
+ self.assertEqual(template.image_1920, red_image)
# CASE: unlink does nothing special if fallback image already set
self.env['product.product'].create({
'product_tmpl_id': template.id,
- 'image': green_image,
+ 'image_1920': green_image,
}).unlink()
- self.assertEqual(template.image_original, red_image)
+ self.assertEqual(template.image_1920, red_image)
# CASE: display variant image first if set
- self.assertEqual(product_green._get_images()[0].image_original, green_image)
+ self.assertEqual(product_green._get_images()[0].image_1920, green_image)
# CASE: display variant fallback after variant o2m, correct fallback
- # write on the raw field, otherwise it will write on the fallback here
- product_green.image_raw_original = False
+ # write on the variant field, otherwise it will write on the fallback
+ product_green.image_variant_max = False
images = product_green._get_images()
- self.assertEqual(images[0].image_original, image_png)
- self.assertEqual(images[1].image_original, red_image)
- self.assertEqual(images[2].image_original, image_gif)
- self.assertEqual(images[3].image_original, image_svg)
+ # images on fields are resized to max 1920
+ image = Image.open(io.BytesIO(base64.b64decode(images[0].image_1920)))
+ self.assertEqual(image.size, (1268, 1920))
+ self.assertEqual(images[1].image_1920, red_image)
+ self.assertEqual(images[2].image_1920, image_gif)
+ self.assertEqual(images[3].image_1920, image_svg)
diff --git a/addons/website_sale/views/product_views.xml b/addons/website_sale/views/product_views.xml
index 25a1aa61181..43284ead368 100644
--- a/addons/website_sale/views/product_views.xml
+++ b/addons/website_sale/views/product_views.xml
@@ -145,7 +145,7 @@
<field name="arch" type="xml">
<form string="Website Public Categories">
<sheet>
- <field name="image_medium" widget='image' class="oe_avatar"/>
+ <field name="image_1920" widget="image" class="oe_avatar" options="{'preview_image': 'image_128'}"/>
<div class="oe_left">
<group>
<field name="name"/>
@@ -227,7 +227,7 @@
<div class="col-md-6 col-xl-7 text-center o_website_sale_image_modal_container">
<div class="row">
<div class="col">
- <field name="image_original" widget="image"/>
+ <field name="image_1920" widget="image"/>
</div>
<div class="col" attrs="{'invisible': [('video_url', 'in', ['', False])]}">
<div class="o_video_container p-2">
@@ -251,13 +251,13 @@
<kanban string="Product Images" default_order="sequence">
<field name="id"/>
<field name="name"/>
- <field name="image_original"/>
+ <field name="image_1920"/>
<field name="sequence" widget="handle"/>
<templates>
<t t-name="kanban-box">
<div class="card oe_kanban_global_click p-0">
<div class="o_squared_image">
- <img class="card-img-top" t-att-src="kanban_image('product.image', 'image_original', record.id.value)" t-att-alt="record.name.value"/>
+ <img class="card-img-top" t-att-src="kanban_image('product.image', 'image_1920', record.id.value)" t-att-alt="record.name.value"/>
</div>
<div class="card-body p-0">
<h4 class="card-title p-2 m-0 bg-200">
@@ -265,12 +265,12 @@
</h4>
</div>
<!-- below 100 Kb: good -->
- <t t-if="record.image_original.raw_value.length &lt; 100*1000">
+ <t t-if="record.image_1920.raw_value.length &lt; 100*1000">
<t t-set="size_status" t-value="'badge-success'"/>
<t t-set="message">Acceptable file size</t>
</t>
<!-- below 1000 Kb: decent -->
- <t t-elif="record.image_original.raw_value.length &lt; 1000*1000">
+ <t t-elif="record.image_1920.raw_value.length &lt; 1000*1000">
<t t-set="size_status" t-value="'badge-warning'" />
<t t-set="message">Huge file size. The image should be optimized/reduced.</t>
</t>
@@ -279,7 +279,7 @@
<t t-set="size_status" t-value="'badge-danger'"/>
<t t-set="message">Optimization required! Reduce the image size or increase your compression settings.</t>
</t>
- <span t-attf-class="badge #{size_status} o_product_image_size" t-esc="record.image_original.value" t-att-title="message"/>
+ <span t-attf-class="badge #{size_status} o_product_image_size" t-esc="record.image_1920.value" t-att-title="message"/>
</div>
</t>
</templates>
diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml
index ca4a23d6418..0e32d3c58c9 100644
--- a/addons/website_sale/views/templates.xml
+++ b/addons/website_sale/views/templates.xml
@@ -145,8 +145,8 @@
<a href="#" role="button" class="ribbon btn btn-danger">Sale</a>
</div>
<a t-att-href="product_href" class="d-block h-100" itemprop="url">
- <span t-field="product.image"
- t-options="{'widget': 'image', 'preview_image': 'image' if product_image_big else 'image_large'}"
+ <span t-field="product.image_1920"
+ t-options="{'widget': 'image', 'preview_image': 'image_1024' if product_image_big else 'image_256'}"
class="d-flex h-100 justify-content-center align-items-center"/>
</a>
</div>
@@ -573,8 +573,8 @@
<div class="mt16 text-center" style="height: 100%;">
<t t-set="combination_info" t-value="alt_product._get_combination_info()"/>
<t t-set="product_variant" t-value="alt_product.env['product.product'].browse(combination_info['product_id'])"/>
- <div t-if="product_variant" t-field="product_variant.image_small" t-options="{'widget': 'image', 'class': 'rounded shadow o_alternative_product' }" />
- <div t-else="" t-field="alt_product.image_small" t-options="{'widget': 'image', 'class': 'rounded shadow o_alternative_product' }" />
+ <div t-if="product_variant" t-field="product_variant.image_64" t-options="{'widget': 'image', 'class': 'rounded shadow o_alternative_product' }" />
+ <div t-else="" t-field="alt_product.image_64" t-options="{'widget': 'image', 'class': 'rounded shadow o_alternative_product' }" />
<h6>
<a t-attf-href="/shop/product/#{ slug(alt_product) }" style="display: block">
<span t-att-title="alt_product.name" t-field="alt_product.name" class="o_text_overflow" style="display: block;" />
@@ -837,7 +837,7 @@
<tr t-att-class="'optional_product info' if line.linked_line_id else None">
<td colspan="2" t-if="not line.product_id.product_tmpl_id" class='td-img'></td>
<td align="center" t-if="line.product_id.product_tmpl_id" class='td-img'>
- <span t-field="line.product_id.image_small" t-options="{'widget': 'image', 'class': 'rounded'}" />
+ <span t-field="line.product_id.image_64" t-options="{'widget': 'image', 'class': 'rounded'}" />
</td>
<td t-if="line.product_id.product_tmpl_id" class='td-product_name'>
<div>
@@ -961,7 +961,7 @@
<t t-foreach="website_sale_order.website_order_line" t-as="line">
<div class="row mb8 cart_line">
<div class="col-3 text-center">
- <span t-field="line.product_id.image_small" t-options="{'widget': 'image', 'class': 'rounded'}" />
+ <span t-field="line.product_id.image_64" t-options="{'widget': 'image', 'class': 'rounded'}" />
</div>
<div class="col-9">
<div>
@@ -995,7 +995,7 @@
<t t-set="combination_info" t-value="product._get_combination_info_variant()"/>
<td class='td-img'>
<a t-attf-href="/shop/product/#{ slug(product.product_tmpl_id) }">
- <span t-field="product.image_small" t-options="{'widget': 'image', 'class': 'rounded'}" />
+ <span t-field="product.image_64" t-options="{'widget': 'image', 'class': 'rounded'}" />
</a>
</td>
<td class='td-product_name'>
@@ -1442,7 +1442,7 @@
<tr t-foreach="website_sale_order.website_order_line" t-as="line">
<td class='' colspan="2" t-if="not line.product_id.product_tmpl_id"></td>
<td class='td-img text-center' t-if="line.product_id.product_tmpl_id">
- <span t-field="line.product_id.image_small" t-options="{'widget': 'image', 'class': 'rounded'}" />
+ <span t-field="line.product_id.image_64" t-options="{'widget': 'image', 'class': 'rounded'}" />
</td>
<td class='td-product_name' t-if="line.product_id.product_tmpl_id">
<div>
@@ -1724,7 +1724,7 @@
<div t-if="product_image._name == 'product.image' and product_image.embed_code" class="d-flex align-items-center justify-content-center h-100 embed-responsive embed-responsive-16by9">
<t t-raw="product_image.embed_code"/>
</div>
- <div t-else="" t-field="product_image.image" class="d-flex align-items-center justify-content-center h-100" t-options='{"widget": "image", "preview_image": "image", "class": "product_detail_img mh-100", "alt-field": "name", "zoom": product_image.can_image_be_zoomed and "image_original"}'/>
+ <div t-else="" t-field="product_image.image_1920" class="d-flex align-items-center justify-content-center h-100" t-options='{"widget": "image", "preview_image": "image_1024", "class": "product_detail_img mh-100", "alt-field": "name", "zoom": product_image.can_image_1024_be_zoomed and "image_1920"}'/>
</div>
</t>
</div>
@@ -1740,7 +1740,7 @@
<div t-ignore="True" class="d-none d-md-block text-center">
<ol t-if="len(product_images) > 1" class="carousel-indicators d-inline-block position-static mx-auto my-0 p-1 text-left">
<t t-foreach="product_images" t-as="product_image"><li t-attf-class="d-inline-block m-1 align-top {{'active' if product_image_first else ''}}" data-target="#o-carousel-product" t-att-data-slide-to="str(product_image_index)">
- <div t-field="product_image.image_small" class="d-flex align-items-center justify-content-center h-100" t-options='{"widget": "image", "alt-field": "name"}'/>
+ <div t-field="product_image.image_64" class="d-flex align-items-center justify-content-center h-100" t-options='{"widget": "image", "alt-field": "name"}'/>
<i t-if="product_image._name == 'product.image' and product_image.embed_code" class="fa fa-2x fa-play-circle-o o_product_video_thumb"/>
</li></t>
</ol>
diff --git a/addons/website_sale_comparison/views/website_sale_comparison_template.xml b/addons/website_sale_comparison/views/website_sale_comparison_template.xml
index 06cf34d6b64..9eb1d4da7df 100644
--- a/addons/website_sale_comparison/views/website_sale_comparison_template.xml
+++ b/addons/website_sale_comparison/views/website_sale_comparison_template.xml
@@ -97,7 +97,7 @@
<strong class='float-right'>x</strong>
</a>
<a t-att-href="'/shop/product/%s' % slug(product.product_tmpl_id)">
- <img t-attf-src="/web/image/product.product/#{product.id}/image_large" class="img img-fluid" style="margin:auto;" alt="Product image"/>
+ <img t-attf-src="/web/image/product.product/#{product.id}/image_256" class="img img-fluid" style="margin:auto;" alt="Product image"/>
</a>
<div class='product_summary'>
<a class="o_product_comparison_table" t-attf-href="/shop/product/#{ slug(product.product_tmpl_id) }">
@@ -143,7 +143,7 @@
<t t-set="combination_info" t-value="product._get_combination_info_variant()"/>
<div class="row no-gutters align-items-center mt-2 o_product_row" t-att-data-category_ids="product.public_categ_ids.ids">
<div class="col-3">
- <img class="img img-fluid" t-attf-src="/web/image/product.product/#{product.id}/image_small" style="max-height: 50px;" alt="Product image"/>
+ <img class="img img-fluid" t-attf-src="/web/image/product.product/#{product.id}/image_64" style="max-height: 50px;" alt="Product image"/>
</div>
<div class="col-8 pl-2">
<h6>
diff --git a/addons/website_sale_digital/data/product_demo.xml b/addons/website_sale_digital/data/product_demo.xml
index 2388f15a023..444ea7f5dc0 100644
--- a/addons/website_sale_digital/data/product_demo.xml
+++ b/addons/website_sale_digital/data/product_demo.xml
@@ -7,7 +7,7 @@
<field name="list_price">4.50</field>
<field name="type">service</field>
<field name="website_published" eval="True"/>
- <field name="image" type="base64" file="website_sale_digital/static/digital_product_1.jpg"/>
+ <field name="image_1920" type="base64" file="website_sale_digital/static/digital_product_1.jpg"/>
<field name="categ_id" ref="product.product_category_6"/>
</record>
diff --git a/addons/website_sale_slides/data/website_sale_slides_demo.xml b/addons/website_sale_slides/data/website_sale_slides_demo.xml
index c5f8a3d1b35..f578264c907 100644
--- a/addons/website_sale_slides/data/website_sale_slides_demo.xml
+++ b/addons/website_sale_slides/data/website_sale_slides_demo.xml
@@ -9,7 +9,7 @@
<field name="list_price">100.0</field>
<field name="type">service</field>
<field name="website_published" eval="True"/>
- <field name="image" type="base64" file="website_sale_slides/static/img/product_course.png"/>
+ <field name="image_1920" type="base64" file="website_sale_slides/static/img/product_course.png"/>
</record>
<record id="website_slides.slide_channel_demo_6_furn3" model="slide.channel">
@@ -25,7 +25,7 @@
<field name="list_price">12.0</field>
<field name="type">consu</field>
<field name="website_published" eval="True"/>
- <field name="image" type="base64" file="website_sale_slides/static/img/water_can.jpg"/>
+ <field name="image_1920" type="base64" file="website_sale_slides/static/img/water_can.jpg"/>
</record>
<record id="product_course_channel_1_option_1" model="product.product">
@@ -34,7 +34,7 @@
<field name="list_price">4.5</field>
<field name="type">consu</field>
<field name="website_published" eval="True"/>
- <field name="image" type="base64" file="website_sale_slides/static/img/flower_pot.jpg"/>
+ <field name="image_1920" type="base64" file="website_sale_slides/static/img/flower_pot.jpg"/>
</record>
<record id="product_course_demo_1" model="product.product">
@@ -43,7 +43,7 @@
<field name="list_price">150.0</field>
<field name="type">service</field>
<field name="website_published" eval="True"/>
- <field name="image" type="base64" file="website_sale_slides/static/img/channel_demo_tree_1.jpg"/>
+ <field name="image_1920" type="base64" file="website_sale_slides/static/img/channel_demo_tree_1.jpg"/>
</record>
<record id="product_course_demo_1_product_template" model="product.template">
diff --git a/addons/website_sale_wishlist/views/website_sale_wishlist_template.xml b/addons/website_sale_wishlist/views/website_sale_wishlist_template.xml
index 77ac50e7823..e6f95956448 100644
--- a/addons/website_sale_wishlist/views/website_sale_wishlist_template.xml
+++ b/addons/website_sale_wishlist/views/website_sale_wishlist_template.xml
@@ -63,7 +63,7 @@
<tr t-att-data-wish-id='wish.id' t-att-data-product-id='wish.product_id.id'>
<td class='td-img'>
<a t-att-href="'/shop/product/%s' % slug(wish.product_id.product_tmpl_id)">
- <img t-attf-src="/web/image/product.product/#{wish.product_id.id}/image_medium" class="img img-fluid" style="margin:auto;" alt="Product image"/>
+ <img t-attf-src="/web/image/product.product/#{wish.product_id.id}/image_128" class="img img-fluid" style="margin:auto;" alt="Product image"/>
</a>
</td>
<td class='text-left'>
diff --git a/addons/website_slides/controllers/main.py b/addons/website_slides/controllers/main.py
index d6e1caceb93..57c25a04af0 100644
--- a/addons/website_slides/controllers/main.py
+++ b/addons/website_slides/controllers/main.py
@@ -324,7 +324,7 @@ class WebsiteSlides(WebsiteProfile):
return request.env['res.users'].sudo().search_read([
('karma', '>', 0),
('website_published', '=', True),
- ('image', '!=', False)], ['id'], limit=3, order='karma desc')
+ ('image_1920', '!=', False)], ['id'], limit=3, order='karma desc')
@http.route([
'/slides/<model("slide.channel"):channel>',
@@ -557,9 +557,9 @@ class WebsiteSlides(WebsiteProfile):
return response
@http.route('/slides/slide/<int:slide_id>/get_image', type='http', auth="public", website=True, sitemap=False)
- def slide_get_image(self, slide_id, field='image_medium', width=0, height=0, crop=False):
+ def slide_get_image(self, slide_id, field='image_128', width=0, height=0, crop=False):
# Protect infographics by limiting access to 256px (large) images
- if field not in ('image_small', 'image_medium', 'image_large'):
+ if field not in ('image_64', 'image_128', 'image_256', 'image_512', 'image_1024', 'image_1920'):
return werkzeug.exceptions.Forbidden()
slide = request.env['slide.slide'].sudo().browse(slide_id).exists()
@@ -846,7 +846,7 @@ class WebsiteSlides(WebsiteProfile):
def _get_valid_slide_post_values(self):
return ['name', 'url', 'tag_ids', 'slide_type', 'channel_id', 'is_preview',
- 'mime_type', 'datas', 'description', 'image', 'index_content', 'website_published']
+ 'mime_type', 'datas', 'description', 'image_1920', 'index_content', 'website_published']
@http.route(['/slides/tag/search_read'], type='json', auth='user', methods=['POST'], website=True)
def slide_tag_search_read(self, fields, domain):
diff --git a/addons/website_slides/data/gamification_data.xml b/addons/website_slides/data/gamification_data.xml
index 4bf7a829b9d..08606251fad 100644
--- a/addons/website_slides/data/gamification_data.xml
+++ b/addons/website_slides/data/gamification_data.xml
@@ -5,7 +5,7 @@
<record id="badge_data_register" model="gamification.badge">
<field name="name">Get started</field>
<field name="description">Register to the platform</field>
- <field name="image" type="base64" file="website_slides/static/src/img/standard_badge_bronze.svg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/standard_badge_bronze.svg"/>
<field name="website_published" eval="True"/>
<field name="level">bronze</field>
<field name="rule_auth">nobody</field>
@@ -46,7 +46,7 @@
<record id="badge_data_profile" model="gamification.badge">
<field name="name">Know yourself</field>
<field name="description">Complete your profile</field>
- <field name="image" type="base64" file="website_slides/static/src/img/standard_badge_bronze.svg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/standard_badge_bronze.svg"/>
<field name="website_published" eval="True"/>
<field name="level">bronze</field>
<field name="rule_auth">nobody</field>
@@ -88,7 +88,7 @@
<record id="badge_data_course" model="gamification.badge">
<field name="name">Power User</field>
<field name="description">Complete a course</field>
- <field name="image" type="base64" file="website_slides/static/src/img/standard_badge_silver.svg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/standard_badge_silver.svg"/>
<field name="website_published" eval="True"/>
<field name="level">silver</field>
<field name="rule_auth">nobody</field>
@@ -128,7 +128,7 @@
<record id="badge_data_certification" model="gamification.badge">
<field name="name">Certified Knowledge</field>
<field name="description">Get a certification</field>
- <field name="image" type="base64" file="website_slides/static/src/img/standard_badge_gold.svg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/standard_badge_gold.svg"/>
<field name="website_published" eval="False"/>
<field name="level">gold</field>
<field name="rule_auth">nobody</field>
@@ -169,7 +169,7 @@
<record id="badge_data_karma" model="gamification.badge">
<field name="name">Community hero</field>
<field name="description">Reach 2000 XP</field>
- <field name="image" type="base64" file="website_slides/static/src/img/standard_badge_gold.svg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/standard_badge_gold.svg"/>
<field name="website_published" eval="True"/>
<field name="level">gold</field>
<field name="rule_auth">nobody</field>
diff --git a/addons/website_slides/data/mail_data.xml b/addons/website_slides/data/mail_data.xml
index e00ddd2f78b..b14fea317a1 100644
--- a/addons/website_slides/data/mail_data.xml
+++ b/addons/website_slides/data/mail_data.xml
@@ -12,7 +12,7 @@
A new ${object.slide_type} <strong>${object.name}</strong> has been published on ${object.channel_id.name} at ${format_datetime(object.write_date, tz=user.tz)}
<div style="margin: 16px 8px 16px 8px; text-align: center;">
<a href="${object.website_url}">
- <img alt="${object.name}" src="${ctx['base_url']}/web/image/slide.slide/${object.id}/image" style="height:auto; width:150px; margin: 16px;"/>
+ <img alt="${object.name}" src="${ctx['base_url']}/web/image/slide.slide/${object.id}/image_1024" style="height:auto; width:150px; margin: 16px;"/>
</a>
</div>
<div style="margin: 16px 8px 16px 8px; text-align: center;">
@@ -39,7 +39,7 @@
${ctx['user'].name} shared the ${object.slide_type} <strong>${object.name}</strong> with you!
<div style="margin: 16px 8px 16px 8px; text-align: center;">
<a href="${(object.website_url + '?fullscreen=1') if ctx['fullscreen'] else object.website_url | safe}">
- <img alt="${object.name}" src="${ctx['base_url']}/web/image/slide.slide/${object.id}/image" style="height:auto; width:150px; margin: 16px;"/>
+ <img alt="${object.name}" src="${ctx['base_url']}/web/image/slide.slide/${object.id}/image_1024" style="height:auto; width:150px; margin: 16px;"/>
</a>
</div>
<div style="margin: 16px 8px 16px 8px; text-align: center;">
diff --git a/addons/website_slides/data/slide_channel_demo.xml b/addons/website_slides/data/slide_channel_demo.xml
index 1c6ae501db4..d88c30abe46 100644
--- a/addons/website_slides/data/slide_channel_demo.xml
+++ b/addons/website_slides/data/slide_channel_demo.xml
@@ -11,7 +11,7 @@
(4, ref('website_slides.slide_channel_tag_level_basic')),
(4, ref('website_slides.slide_channel_tag_role_gardener')),
(4, ref('website_slides.slide_channel_tag_other_2'))]"/>
- <field name="image" type="base64" file="website_slides/static/src/img/channel_demo_gardening.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/channel_demo_gardening.jpg"/>
<field name="description">Learn the basics of gardening !</field>
<field name="create_date" eval="DateTime.now() - relativedelta(days=8)"/>
</record>
@@ -27,7 +27,7 @@
(4, ref('website_slides.slide_channel_tag_level_intermediate')),
(4, ref('website_slides.slide_channel_tag_role_gardener')),
(4, ref('website_slides.slide_channel_tag_other_0'))]"/>
- <field name="image" type="base64" file="website_slides/static/src/img/channel_demo_gardening_2.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/channel_demo_gardening_2.jpg"/>
<field name="description">Learn how to take care of your favorite trees. Learn when to plant, how to manage potted trees, ...</field>
<field name="create_date" eval="DateTime.now() - relativedelta(days=7)"/>
</record>
@@ -55,7 +55,7 @@
(4, ref('website_slides.slide_channel_tag_role_carpenter')),
(4, ref('website_slides.slide_channel_tag_other_0')),
(4, ref('website_slides.slide_channel_tag_other_2'))]"/>
- <field name="image" type="base64" file="website_slides/static/src/img/channel_demo_flowers.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/channel_demo_flowers.jpg"/>
<field name="description">A lot of nice documentation: trees, wood, gardens. A gold mine for references.</field>
<field name="create_date" eval="DateTime.now() - relativedelta(days=6)"/>
</record>
@@ -83,7 +83,7 @@
(4, ref('website_slides.slide_channel_tag_role_carpenter')),
(4, ref('website_slides.slide_channel_tag_role_furniture')),
(4, ref('website_slides.slide_channel_tag_other_2'))]"/>
- <field name="image" type="base64" file="website_slides/static/src/img/channel_demo_tree_1.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/channel_demo_tree_1.jpg"/>
<field name="description">Knowing which kind of wood to use depending on your application is important. In this course you
will learn the basics of wood characteristics.</field>
<field name="create_date" eval="DateTime.now() - relativedelta(days=5)"/>
@@ -104,7 +104,7 @@ will learn the basics of wood characteristics.</field>
<field name="tag_ids" eval="[(5, 0),
(4, ref('website_slides.slide_channel_tag_level_basic')),
(4, ref('website_slides.slide_channel_tag_role_furniture'))]"/>
- <field name="image" type="base64" file="website_slides/static/src/img/channel_demo_furniture_2.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/channel_demo_furniture_2.jpg"/>
<field name="description">If you are looking for technical specifications, have a look at this documentation.</field>
<field name="create_date" eval="DateTime.now() - relativedelta(days=4)"/>
</record>
@@ -126,7 +126,7 @@ will learn the basics of wood characteristics.</field>
(4, ref('website_slides.slide_channel_tag_role_furniture')),
(4, ref('website_slides.slide_channel_tag_other_0')),
(4, ref('website_slides.slide_channel_tag_other_1'))]"/>
- <field name="image" type="base64" file="website_slides/static/src/img/channel_demo_furniture.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/channel_demo_furniture.jpg"/>
<field name="description">All you need to know about furniture creation.</field>
<field name="create_date" eval="DateTime.now() - relativedelta(days=3)"/>
</record>
@@ -159,7 +159,7 @@ will learn the basics of wood characteristics.</field>
(4, ref('website_slides.slide_channel_tag_role_carpenter')),
(4, ref('website_slides.slide_channel_tag_role_furniture')),
(4, ref('website_slides.slide_channel_tag_other_1'))]"/>
- <field name="image" type="base64" file="website_slides/static/src/img/channel_demo_diy.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/channel_demo_diy.jpg"/>
<field name="description">So much amazing certification.</field>
<field name="create_date" eval="DateTime.now() - relativedelta(days=2)"/>
</record>
diff --git a/addons/website_slides/data/slide_slide_demo.xml b/addons/website_slides/data/slide_slide_demo.xml
index 9407a408671..3e329b38c28 100644
--- a/addons/website_slides/data/slide_slide_demo.xml
+++ b/addons/website_slides/data/slide_slide_demo.xml
@@ -7,7 +7,7 @@
<field name="name">Know-How Summary</field>
<field name="sequence">1</field>
<field name="datas" type="base64" file="website_slides/static/src/img/presentation.pdf"/>
- <field name="image" type="base64" file="website_slides/static/src/img/channel-training-default.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/channel-training-default.jpg"/>
<field name="slide_type">presentation</field>
<field name="channel_id" ref="website_slides.channel_public"/>
<field name="category_id" eval="False"/>
@@ -21,7 +21,7 @@
<record id="slide_slide_demo_0_1" model="slide.slide">
<field name="name">Home Gardening</field>
<field name="sequence">2</field>
- <field name="image" type="base64" file="website_slides/static/src/img/slide_demo_gardening_1.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/slide_demo_gardening_1.jpg"/>
<field name="slide_type">infographic</field>
<field name="channel_id" ref="website_slides.channel_public"/>
<field name="category_id" eval="False"/>
@@ -38,7 +38,7 @@
<record id="slide_slide_demo_1_0" model="slide.slide">
<field name="name">Tree Infographic</field>
<field name="sequence">1</field>
- <field name="image" type="base64" file="website_slides/static/src/img/slide_demo_tree_infographic_1.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/slide_demo_tree_infographic_1.jpg"/>
<field name="slide_type">infographic</field>
<field name="channel_id" ref="website_slides.slide_channel_demo_1_gard1"/>
<field name="category_id" ref="website_slides.slide_category_demo_1_0"/>
@@ -52,7 +52,7 @@
<record id="slide_slide_demo_1_1" model="slide.slide">
<field name="name">Interesting Tree Facts</field>
<field name="sequence">2</field>
- <field name="image" type="base64" file="website_slides/static/src/img/slide_demo_tree_infographic_2.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/slide_demo_tree_infographic_2.jpg"/>
<field name="slide_type">infographic</field>
<field name="channel_id" ref="website_slides.slide_channel_demo_1_gard1"/>
<field name="category_id" ref="website_slides.slide_category_demo_1_0"/>
@@ -66,7 +66,7 @@
<record id="slide_slide_demo_1_2" model="slide.slide">
<field name="name">Energy Efficiency Facts</field>
<field name="sequence">3</field>
- <field name="image" type="base64" file="website_slides/static/src/img/slide_demo_tree_infographic_3.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/slide_demo_tree_infographic_3.jpg"/>
<field name="slide_type">infographic</field>
<field name="channel_id" ref="website_slides.slide_channel_demo_1_gard1"/>
<field name="category_id" ref="website_slides.slide_category_demo_1_0"/>
@@ -91,7 +91,7 @@
<field name="name">How to plant a potted tree</field>
<field name="sequence">4</field>
<field name="url">https://www.youtube.com/watch?v=QYmgrw0PgLU</field>
- <field name="image" type="base64" file="website_slides/static/src/img/slide_demo_thumb_QYmgrw0PgLU.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/slide_demo_thumb_QYmgrw0PgLU.jpg"/>
<field name="document_id">QYmgrw0PgLU</field>
<field name="slide_type">video</field>
<field name="channel_id" ref="website_slides.slide_channel_demo_1_gard1"/>
@@ -106,7 +106,7 @@
<record id="slide_slide_demo_1_4" model="slide.slide">
<field name="name">A little chat with Harry Potted</field>
<field name="sequence">5</field>
- <field name="image" type="base64" file="website_slides/static/src/img/slide_demo_tree_img_1.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/slide_demo_tree_img_1.jpg"/>
<field name="slide_type">webpage</field>
<field name="channel_id" ref="website_slides.slide_channel_demo_1_gard1"/>
<field name="category_id" ref="website_slides.slide_category_demo_1_1"/>
@@ -199,7 +199,7 @@
<field name="name">3 Main Methodologies</field>
<field name="sequence">6</field>
<field name="datas" type="base64" file="website_slides/static/src/img/presentation.pdf"/>
- <field name="image" type="base64" file="website_slides/static/src/img/channel-training-default.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/channel-training-default.jpg"/>
<field name="slide_type">presentation</field>
<field name="channel_id" ref="website_slides.slide_channel_demo_1_gard1"/>
<field name="category_id" ref="website_slides.slide_category_demo_1_1"/>
@@ -217,7 +217,7 @@
<field name="name">Main Trees Categories</field>
<field name="sequence">1</field>
<field name="datas" type="base64" file="website_slides/static/src/img/presentation.pdf"/>
- <field name="image" type="base64" file="website_slides/static/src/img/slide_demo_tree_img_2.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/slide_demo_tree_img_2.jpg"/>
<field name="slide_type">presentation</field>
<field name="channel_id" ref="website_slides.slide_channel_demo_2_gard2"/>
<field name="category_id" ref="website_slides.slide_category_demo_2_0"/>
@@ -278,7 +278,7 @@
<record id="slide_slide_demo_2_1" model="slide.slide">
<field name="name">A Mighty Forest from Ages</field>
<field name="sequence">2</field>
- <field name="image" type="base64" file="website_slides/static/src/img/slide_demo_tree_img_3.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/slide_demo_tree_img_3.jpg"/>
<field name="slide_type">webpage</field>
<field name="channel_id" ref="website_slides.slide_channel_demo_2_gard2"/>
<field name="category_id" ref="website_slides.slide_category_demo_2_0"/>
@@ -327,7 +327,7 @@
<record id="slide_slide_demo_2_2" model="slide.slide">
<field name="name">Tree planting in hanging bottles on wall</field>
<field name="url">https://www.youtube.com/watch?v=ebBez6bcSEc</field>
- <field name="image" type="base64" file="website_slides/static/src/img/slide_demo_thumb_ebBez6bcSEc.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/slide_demo_thumb_ebBez6bcSEc.jpg"/>
<field name="document_id">ebBez6bcSEc</field>
<field name="slide_type">video</field>
<field name="channel_id" ref="website_slides.slide_channel_demo_2_gard2"/>
@@ -346,7 +346,7 @@
<field name="name">Unforgettable Tools</field>
<field name="sequence">1</field>
<field name="datas" type="base64" file="website_slides/static/src/img/presentation.pdf"/>
- <field name="image" type="base64" file="website_slides/static/src/img/channel-training-default.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/channel-training-default.jpg"/>
<field name="slide_type">presentation</field>
<field name="channel_id" ref="website_slides.slide_channel_demo_5_furn2"/>
<field name="category_id" ref="website_slides.slide_category_demo_5_0"/>
@@ -370,7 +370,7 @@
<record id="slide_slide_demo_5_1" model="slide.slide">
<field name="name">How to find quality wood</field>
<field name="sequence">2</field>
- <field name="image" type="base64" file="website_slides/static/src/img/slide_demo_thumb_5WMqwTnZ-qs.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/slide_demo_thumb_5WMqwTnZ-qs.jpg"/>
<field name="url">https://www.youtube.com/watch?v=5WMqwTnZ-qs</field>
<field name="document_id">5WMqwTnZ-qs</field>
<field name="slide_type">video</field>
@@ -386,7 +386,7 @@
<record id="slide_slide_demo_5_2" model="slide.slide">
<field name="name">How to create your own piece of furniture</field>
<field name="sequence">3</field>
- <field name="image" type="base64" file="website_slides/static/src/img/slide_demo_thumb_ptjeDDoURL8.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/slide_demo_thumb_ptjeDDoURL8.jpg"/>
<field name="url">https://www.youtube.com/watch?v=ptjeDDoURL8</field>
<field name="document_id">ptjeDDoURL8</field>
<field name="slide_type">video</field>
@@ -402,7 +402,7 @@
<record id="slide_slide_demo_5_3" model="slide.slide">
<field name="name">Test your knowledge !</field>
<field name="sequence">4</field>
- <field name="image" type="base64" file="website_slides/static/src/img/slide_demo_owl.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/slide_demo_owl.jpg"/>
<field name="slide_type">quiz</field>
<field name="channel_id" ref="website_slides.slide_channel_demo_5_furn2"/>
<field name="category_id" ref="website_slides.slide_category_demo_5_0"/>
diff --git a/addons/website_slides/models/slide_slide.py b/addons/website_slides/models/slide_slide.py
index 4a0523e5593..d369a297afa 100644
--- a/addons/website_slides/models/slide_slide.py
+++ b/addons/website_slides/models/slide_slide.py
@@ -287,8 +287,8 @@ class Slide(models.Model):
if not values.get('index_content'):
values['index_content'] = values.get('description')
- if values.get('slide_type') == 'infographic' and not values.get('image'):
- values['image'] = values['datas']
+ if values.get('slide_type') == 'infographic' and not values.get('image_1920'):
+ values['image_1920'] = values['datas']
if values.get('website_published') and not values.get('date_published'):
values['date_published'] = datetime.datetime.now()
if values.get('url') and not values.get('document_id'):
@@ -604,7 +604,7 @@ class Slide(models.Model):
return values
values.update({
'name': snippet['title'],
- 'image': self._fetch_data(snippet['thumbnails']['high']['url'], {}, 'image')['values'],
+ 'image_1920': self._fetch_data(snippet['thumbnails']['high']['url'], {}, 'image')['values'],
'description': snippet['description'],
'mime_type': False,
})
@@ -615,8 +615,8 @@ class Slide(models.Model):
def get_slide_type(vals):
# TDE FIXME: WTF ??
slide_type = 'presentation'
- if vals.get('image'):
- image = Image.open(io.BytesIO(base64.b64decode(vals['image'])))
+ if vals.get('image_1920'):
+ image = Image.open(io.BytesIO(base64.b64decode(vals['image_1920'])))
width, height = image.size
if height > width:
return 'document'
@@ -648,14 +648,14 @@ class Slide(models.Model):
values = {
'name': google_values['title'],
- 'image': self._fetch_data(google_values['thumbnailLink'].replace('=s220', ''), {}, 'image')['values'],
+ 'image_1920': self._fetch_data(google_values['thumbnailLink'].replace('=s220', ''), {}, 'image')['values'],
'mime_type': google_values['mimeType'],
'document_id': document_id,
}
if google_values['mimeType'].startswith('video/'):
values['slide_type'] = 'video'
elif google_values['mimeType'].startswith('image/'):
- values['datas'] = values['image']
+ values['datas'] = values['image_1920']
values['slide_type'] = 'infographic'
elif google_values['mimeType'].startswith('application/vnd.google-apps'):
values['slide_type'] = get_slide_type(values)
@@ -677,6 +677,6 @@ class Slide(models.Model):
res = super(Slide, self)._default_website_meta()
res['default_opengraph']['og:title'] = res['default_twitter']['twitter:title'] = self.name
res['default_opengraph']['og:description'] = res['default_twitter']['twitter:description'] = self.description
- res['default_opengraph']['og:image'] = res['default_twitter']['twitter:image'] = "/web/image/slide.slide/%s/image" % (self.id)
+ res['default_opengraph']['og:image'] = res['default_twitter']['twitter:image'] = "/web/image/slide.slide/%s/image_1024" % (self.id)
res['default_meta_description'] = self.description
return res
diff --git a/addons/website_slides/static/src/js/slides_course_fullscreen_player.js b/addons/website_slides/static/src/js/slides_course_fullscreen_player.js
index 22e8b126b2d..093f147aff6 100644
--- a/addons/website_slides/static/src/js/slides_course_fullscreen_player.js
+++ b/addons/website_slides/static/src/js/slides_course_fullscreen_player.js
@@ -498,7 +498,7 @@ odoo.define('website_slides.fullscreen', function (require) {
slideData.embedCode = $(slideData.embedCode).attr('src'); // embedCode containts an iframe tag, where src attribute is the url (youtube or embed document from odoo)
slideData.embedUrl = "https://" + slideData.embedCode + "&rel=0&autoplay=1&enablejsapi=1&origin=" + window.location.origin;
} else if (slideData.type === 'infographic') {
- slideData.embedUrl = _.str.sprintf('/web/image/slide.slide/%s/image', slideData.id);
+ slideData.embedUrl = _.str.sprintf('/web/image/slide.slide/%s/image_1024', slideData.id);
} else if (_.contains(['document', 'presentation'], slideData.type)) {
slideData.embedUrl = $(slideData.embedCode).attr('src');
}
diff --git a/addons/website_slides/static/src/xml/website_slides_fullscreen.xml b/addons/website_slides/static/src/xml/website_slides_fullscreen.xml
index 6793dd5c736..ceebb9d246c 100644
--- a/addons/website_slides/static/src/xml/website_slides_fullscreen.xml
+++ b/addons/website_slides/static/src/xml/website_slides_fullscreen.xml
@@ -8,7 +8,7 @@
</t>
<t t-if="widget.get('slide').type === 'infographic'">
<div class="o_wslides_fs_player w-100 h-100 overflow-auto d-flex align-items-start justify-content-center">
- <img t-att-src="'/web/image/slide.slide/'+ widget.get('slide').id +'/image'" class="img-fluid position-relative m-auto" alt="Slide image"/>
+ <img t-att-src="'/web/image/slide.slide/'+ widget.get('slide').id +'/image_1024'" class="img-fluid position-relative m-auto" alt="Slide image"/>
</div>
</t>
</t>
diff --git a/addons/website_slides/views/slide_channel_views.xml b/addons/website_slides/views/slide_channel_views.xml
index 27dbd5742c3..7cdf9e63d96 100644
--- a/addons/website_slides/views/slide_channel_views.xml
+++ b/addons/website_slides/views/slide_channel_views.xml
@@ -64,7 +64,7 @@
<field name="is_published" widget="website_button"/>
</button>
</div>
- <field name="image" widget="image" class="oe_avatar" options="{'preview_image': 'image_medium'}"/>
+ <field name="image_1920" widget="image" class="oe_avatar" options="{'preview_image': 'image_128'}"/>
<div class="oe_title">
<label for="name" class="oe_edit_only" string="Name"/>
<h1><field name="name" default_focus="1" placeholder="Name"/></h1>
diff --git a/addons/website_slides/views/slide_slide_views.xml b/addons/website_slides/views/slide_slide_views.xml
index 9ee8fd67c98..5fcb30dbad4 100644
--- a/addons/website_slides/views/slide_slide_views.xml
+++ b/addons/website_slides/views/slide_slide_views.xml
@@ -47,7 +47,7 @@
<field name="is_published" widget="website_button"/>
</button>
</div>
- <field name="image" widget="image" class="oe_avatar" options='{"preview_image": "image_large"}'
+ <field name="image_1920" widget="image" class="oe_avatar" options='{"preview_image": "image_256"}'
attrs="{'readonly': [('slide_type', 'in', ('document', 'presentation', 'video'))]}"
/>
<div class="oe_title">
diff --git a/addons/website_slides/views/website_slides_templates_course.xml b/addons/website_slides/views/website_slides_templates_course.xml
index 8f90923b485..9fac350ac71 100644
--- a/addons/website_slides/views/website_slides_templates_course.xml
+++ b/addons/website_slides/views/website_slides_templates_course.xml
@@ -120,7 +120,7 @@
<!-- ==== Header Left ==== -->
<div class="col-12 col-md-4 col-lg-3">
<div class="d-flex align-items-start justify-content-around h-100">
- <div class="o_wslides_course_pict d-inline-block mb-2 mt-3 my-md-0" t-attf-style="background-image:url(/web/image/slide.channel/#{channel.id}/image)" t-ignore="True"/>
+ <div class="o_wslides_course_pict d-inline-block mb-2 mt-3 my-md-0" t-attf-style="background-image:url(/web/image/slide.channel/#{channel.id}/image_1024)" t-ignore="True"/>
</div>
</div>
@@ -534,7 +534,7 @@
<!-- Featured lesson -->
<div t-if="not search and not search_slide_type and slide_promoted" class="container py-1 mb-2">
<div class="card flex-column flex-lg-row">
- <t t-set="image_url" t-value="'/web/image/slide.slide/%s/image' % slide_promoted.id"/>
+ <t t-set="image_url" t-value="'/web/image/slide.slide/%s/image_1024' % slide_promoted.id"/>
<a t-if="slide_promoted.is_preview or channel.is_member or is_slides_publisher"
t-attf-href="/slides/slide/#{slug(slide_promoted)}#{query_string}" class="w-100 w-lg-50 flex-shrink-0 rounded">
@@ -608,8 +608,8 @@
<div class="card w-100 o_wslides_lesson_card mb-4">
<t t-set="can_access" t-value="slide.is_preview or channel.is_member or channel.can_publish"/>
- <t t-if="slide.image">
- <t t-set="lesson_image" t-value="'/web/image/slide.slide/%s/image' % slide.id"/>
+ <t t-if="slide.image_1024">
+ <t t-set="lesson_image" t-value="'/web/image/slide.slide/%s/image_1024' % slide.id"/>
<a t-if="can_access" t-attf-href="/slides/slide/#{slug(slide)}#{query_string}" t-title="slide.name">
<div class="card-img-top border-bottom" t-attf-style="padding-top: 50%; background-image: url(#{lesson_image}); background-size: cover; background-position:center"/>
</a>
diff --git a/addons/website_slides/views/website_slides_templates_homepage.xml b/addons/website_slides/views/website_slides_templates_homepage.xml
index 5e689745e4b..de824406f1f 100644
--- a/addons/website_slides/views/website_slides_templates_homepage.xml
+++ b/addons/website_slides/views/website_slides_templates_homepage.xml
@@ -15,7 +15,7 @@
<t t-foreach="top3_users" t-as="user">
<img class="rounded-circle img-fluid shadow ml-n4"
style="border: 6px solid white"
- t-attf-src="/web/image/res.users/#{user['id']}/image_medium"/>
+ t-attf-src="/web/image/res.users/#{user['id']}/image_128"/>
</t>
</div>
</div>
@@ -283,9 +283,9 @@
<template id='course_card' name="Course Card">
<div t-attf-class="card w-100 o_wslides_course_card mb-4 #{'o_wslides_course_unpublished' if not channel.is_published else ''}">
- <t t-set="course_image" t-value="'/web/image/slide.channel/%s/image' % channel.id"/>
+ <t t-set="course_image" t-value="'/web/image/slide.channel/%s/image_1024' % channel.id"/>
<a t-attf-href="/slides/#{slug(channel)}" t-title="channel.name">
- <div t-if="channel.image_large" class="card-img-top" t-attf-style="padding-top: 50%; background-image: url(#{course_image}); background-size: cover; background-position:center"/>
+ <div t-if="channel.image_1024" class="card-img-top" t-attf-style="padding-top: 50%; background-image: url(#{course_image}); background-size: cover; background-position:center"/>
<div t-else="" class="o_wslides_gradient card-img-top position-relative" style="padding-top: 50%; opacity: 0.8">
<i class="fa fa-graduation-cap fa-2x mr-3 mb-3 position-absolute text-white-75" style="right:0; bottom: 0"/>
</div>
@@ -394,7 +394,7 @@
<div class="o_wslides_home_aside">
<div t-if="user.rank_id" class="d-flex align-items-center">
<span class="font-weight-bold text-muted mr-2">Current rank:</span>
- <img t-attf-src="/web/image/gamification.karma.rank/#{user.rank_id.id}/image_small" height="16" alt="" class="mr-1"/>
+ <img t-attf-src="/web/image/gamification.karma.rank/#{user.rank_id.id}/image_64" height="16" alt="" class="mr-1"/>
<a href="/profile/ranks_badges" t-field="user.rank_id"/>
</div>
<t t-set="next_rank_id" t-value="user._get_next_rank()"/>
@@ -415,7 +415,7 @@
<div t-attf-class="d-flex mb-3 align-items-center #{'o_wslides_entry_muted' if not challenge_done else ''}">
<img class="mr-2"
style="max-height: 36px;"
- t-att-src="'/web/image/gamification.badge/%s/image_medium' % challenge.reward_id.id"
+ t-att-src="'/web/image/gamification.badge/%s/image_128' % challenge.reward_id.id"
t-att-alt="challenge.reward_id.name"/>
<div class="flex-grow-1">
<b class="text_small_caps" t-esc="challenge.reward_id.name"/><br/>
@@ -430,7 +430,7 @@
<template id='slides_misc_user_image' name="User Avatar">
<img t-att-class="img_class if img_class else 'rounded-circle float-left'"
t-att-style="img_style if img_style else 'max-height: 32px;'"
- t-att-src="'/profile/avatar/%s?field=image_medium' % user.id"
+ t-att-src="'/profile/avatar/%s?field=image_128' % user.id"
t-att-alt="user.name"/>
</template>
</data></odoo>
diff --git a/addons/website_slides/views/website_slides_templates_lesson.xml b/addons/website_slides/views/website_slides_templates_lesson.xml
index ea6b1b74b66..642e097aa64 100644
--- a/addons/website_slides/views/website_slides_templates_lesson.xml
+++ b/addons/website_slides/views/website_slides_templates_lesson.xml
@@ -89,9 +89,9 @@
<!-- Slide sub-template: display an item in a list of related slides (Related, Most Viewed, ...) -->
<template id="slide_aside_card" name="Related Slide">
<a class="list-group-item list-group-item-action d-flex align-items-start px-2" t-att-href="'/slides/slide/%s' % (slug(aside_slide))">
- <t t-set="slide_image" t-value="'/web/image/slide.slide/%s/image' % aside_slide.id"/>
+ <t t-set="slide_image" t-value="'/web/image/slide.slide/%s/image_1024' % aside_slide.id"/>
- <div t-if="aside_slide.image" class="flex-shrink-0 mr-1 border" t-attf-style="width: 20%; padding-top: 20%; background-image: url(#{slide_image}); background-size: cover; background-position:center"/>
+ <div t-if="aside_slide.image_1024" class="flex-shrink-0 mr-1 border" t-attf-style="width: 20%; padding-top: 20%; background-image: url(#{slide_image}); background-size: cover; background-position:center"/>
<div t-else="" class="o_wslides_gradient flex-shrink-0 mr-1" t-attf-style="width: 20%; padding-top: 20%;"/>
<div class="overflow-hidden d-flex flex-column justify-content-start">
<h6 t-esc="aside_slide.name" class="o_wslides_desc_truncate_2 mb-1" style="line-height: 1.15"/>
@@ -234,7 +234,7 @@
</div>
<div class="o_wslides_lesson_content_type">
<img t-if="slide.slide_type == 'infographic'"
- t-attf-src="/web/image/slide.slide/#{slide.id}/image" class="img-fluid" style="width:100%" t-att-alt="slide.name"/>
+ t-attf-src="/web/image/slide.slide/#{slide.id}/image_1024" class="img-fluid" style="width:100%" t-att-alt="slide.name"/>
<div t-if="slide.slide_type in ('presentation', 'document')" class="embed-responsive embed-responsive-4by3 embed-responsive-item mb8" style="height: 600px;">
<t t-raw="slide.embed_code"/>
</div>
diff --git a/addons/website_slides/views/website_slides_templates_lesson_embed.xml b/addons/website_slides/views/website_slides_templates_lesson_embed.xml
index e6fe7a1ae81..d69ddef3215 100644
--- a/addons/website_slides/views/website_slides_templates_lesson_embed.xml
+++ b/addons/website_slides/views/website_slides_templates_lesson_embed.xml
@@ -58,7 +58,7 @@
<div class="col-6 col-md-4 col-lg-3 oe_slides_suggestion_media">
<div class="card mb-3">
<a t-att-href="suggest_slide.website_url" target="_new" class="card-img-top embed-responsive embed-responsive-16by9">
- <img t-attf-src="/web/image/slide.slide/#{suggest_slide.id}/image" class="card-img-top embed-responsive-item" t-att-alt="suggest_slide.name"/>
+ <img t-attf-src="/web/image/slide.slide/#{suggest_slide.id}/image_1024" class="card-img-top embed-responsive-item" t-att-alt="suggest_slide.name"/>
</a>
<div class="card-body">
<h6 class="card-title">
@@ -80,14 +80,14 @@
<i class="fa fa-circle-o-notch fa-spin mr-2"/><b>Loading...</b>
</div>
<div class="toast-body p-0">
- <img class="img-fluid w-100" t-attf-src="/web/image/slide.slide/#{slide.id}/image_large"/>
+ <img class="img-fluid w-100" t-attf-src="/web/image/slide.slide/#{slide.id}/image_256"/>
</div>
</div>
</div>
<canvas id="PDFViewerCanvas" class="img-fluid w-100" style="display: none;"></canvas>
</t>
<t t-if="slide.slide_type == 'infographic'">
- <img t-attf-src="/web/image/slide.slide/#{slide.id}/image" class="img-fluid" style="width: 100%" alt="Slide image"/>
+ <img t-attf-src="/web/image/slide.slide/#{slide.id}/image_1024" class="img-fluid" style="width: 100%" alt="Slide image"/>
</t>
</div>
<!-- Fixed bottom navbar -->
diff --git a/addons/website_slides/views/website_slides_templates_profile.xml b/addons/website_slides/views/website_slides_templates_profile.xml
index 212b0ad9993..e083fd724d6 100644
--- a/addons/website_slides/views/website_slides_templates_profile.xml
+++ b/addons/website_slides/views/website_slides_templates_profile.xml
@@ -39,7 +39,7 @@
<div class="card-body o_wprofile_slides_course_card_body p-0 d-flex"
t-attf-onclick="location.href='/slides/#{slug(course.channel_id)}';">
- <div t-if="course.channel_id.image" class="pl-5 pr-4 rounded-left" t-attf-style="background-image:url(/web/image/slide.channel/#{course.channel_id.id}/image); background-size: cover; background-position: center"/>
+ <div t-if="course.channel_id.image_1024" class="pl-5 pr-4 rounded-left" t-attf-style="background-image:url(/web/image/slide.channel/#{course.channel_id.id}/image_1024); background-size: cover; background-position: center"/>
<div t-else="" class="o_wslides_gradient pl-5 pr-4 rounded-left position-relative" style="opacity: 0.8">
<i class="fa fa-graduation-cap fa-fw mr-2 mt-3 position-absolute text-white-75" style="right:0; top: 0"/>
</div>
diff --git a/addons/website_slides_survey/data/slide_slide_demo.xml b/addons/website_slides_survey/data/slide_slide_demo.xml
index fe4642fbaf5..bf9cc7c95f9 100644
--- a/addons/website_slides_survey/data/slide_slide_demo.xml
+++ b/addons/website_slides_survey/data/slide_slide_demo.xml
@@ -6,7 +6,7 @@
<record id="slide_slide_demo_5_4" model="slide.slide">
<field name="name">Furniture Creation Certification</field>
<field name="sequence">5</field>
- <field name="image" type="base64" file="website_slides/static/src/img/channel_demo_furniture.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/channel_demo_furniture.jpg"/>
<field name="slide_type">certification</field>
<field name="channel_id" ref="website_slides.slide_channel_demo_5_furn2"/>
<field name="category_id" ref="website_slides.slide_category_demo_5_0"/>
@@ -21,7 +21,7 @@
<record id="slide_slide_demo_6_0" model="slide.slide">
<field name="name">DIY Furniture Certification</field>
<field name="sequence">1</field>
- <field name="image" type="base64" file="website_slides/static/src/img/channel_demo_furniture_3.jpg"/>
+ <field name="image_1920" type="base64" file="website_slides/static/src/img/channel_demo_furniture_3.jpg"/>
<field name="slide_type">certification</field>
<field name="channel_id" ref="website_slides.slide_channel_demo_6_furn3"/>
<field name="category_id" eval="False"/>
diff --git a/addons/website_slides_survey/views/website_profile.xml b/addons/website_slides_survey/views/website_profile.xml
index 105a5843861..dd80c485308 100644
--- a/addons/website_slides_survey/views/website_profile.xml
+++ b/addons/website_slides_survey/views/website_profile.xml
@@ -17,7 +17,7 @@
<div class="col-12 col-lg-6" t-foreach="certificates" t-as="certificate">
<div class="card mb-2">
<div class="card-body o_wprofile_slides_course_card_body p-0 d-flex">
- <div class="pl-5 pr-4 rounded-left" t-attf-style="background-image:url(/web/image/slide.slide/#{certificate.slide_id.id}/image_medium); background-position: center"/>
+ <div class="pl-5 pr-4 rounded-left" t-attf-style="background-image:url(/web/image/slide.slide/#{certificate.slide_id.id}/image_128); background-position: center"/>
<div class="p-2 w-100">
<h5 class="mt-0 mb-1" t-esc="certificate.survey_id.title"/>
<div t-if="user.id == uid">