[IMP] *: remove unnecessary image sizes

The big images are probably never going to be used for the following models:

- pos category
- fleet brand
- livechat channel
- mail channel
- payment acquirer

And if big images are needed some day the model should use image.mixin instead.

PR: #34925
This commit is contained in:
Sébastien Theys
2019-08-02 16:47:58 +00:00
parent 1b85ab93ec
commit f0ffbea173
26 changed files with 114 additions and 220 deletions
+66 -66
View File
@@ -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>
+1 -10
View File
@@ -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_128 = fields.Binary(related='model_id.image_128', string="Logo (medium)", readonly=False)
image_64 = fields.Binary(related='model_id.image_64', 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_128 = self.model_id.image
else:
self.image_128 = False
@api.model
def create(self, vals):
res = super(FleetVehicle, self).create(vals)
+3 -31
View File
@@ -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_128 = fields.Binary(related='brand_id.image_128', string="Logo (medium)", readonly=False)
image_64 = fields.Binary(related='brand_id.image_64', 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_128 = self.brand_id.image
else:
self.image_128 = 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_128 = 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_64 = 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)
@@ -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_64', 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">
+2 -3
View File
@@ -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_64', 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_64', 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>
@@ -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=(1024, 1024))
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_128 = 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_64 = 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
# --------------------------
@@ -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_128"}'/>
<field name="image_128" widget="image" class="oe_avatar"/>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
@@ -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">
+5 -18
View File
@@ -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=(1024, 1024))
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_128 = 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_64 = 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'):
@@ -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_64';
result.imageSRC = '/web/image/mail.channel/' + this.getID() + '/image_128';
}
var lastMessage = this.getLastMessage();
return _.extend(result, {
+1 -1
View File
@@ -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_128', '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"/>
+11 -11
View File
@@ -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">
+2 -15
View File
@@ -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_128 = 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_64 = 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
@@ -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_64" 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>
+2 -2
View File
@@ -61,7 +61,7 @@
</div>
</button>
</div>
<field name="image" widget='image' class="oe_avatar" options='{"preview_image": "image_128"}'/>
<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_64', 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>
@@ -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"/>
@@ -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"/>
@@ -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"/>
@@ -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"/>
@@ -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"/>
@@ -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"/>
@@ -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"/>
@@ -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"/>
@@ -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"/>
+3 -24
View File
@@ -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_128 = 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_64 = 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):
@@ -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,7 +41,6 @@
<field name="arch" type="xml">
<kanban class="o_kanban_mobile">
<field name="name"/>
<field name="image_128"/>
<field name="id"/>
<templates>
<t t-name="kanban-box">