[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>
This commit is contained in:
Robot Odoo
2019-08-02 20:36:51 +02:00
committed by GitHub
206 changed files with 951 additions and 1094 deletions
+1 -1
View File
@@ -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>
@@ -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">
@@ -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>
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -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',
}
}
+3 -3
View File
@@ -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>
+2 -2
View File
@@ -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')))
+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_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)
+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_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)
@@ -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"/>
@@ -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">
+3 -4
View File
@@ -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>
+5 -5
View File
@@ -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>
@@ -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>
+1 -1
View File
@@ -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']}
+2 -23
View File
@@ -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:
@@ -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:
+4 -5
View File
@@ -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">
+1 -1
View File
@@ -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>
@@ -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>
+1 -1
View File
@@ -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">
+1 -1
View File
@@ -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>
@@ -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: {
+1 -1
View File
@@ -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">
+19 -19
View File
@@ -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>
+5 -13
View File
@@ -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
+12 -6
View File
@@ -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):
+1 -1
View File
@@ -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:
+1 -1
View File
@@ -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>
+3 -3
View File
@@ -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">
+4 -4
View File
@@ -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"/>
+2 -2
View File
@@ -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>
@@ -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>
@@ -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>
@@ -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">
@@ -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"/>
+2 -2
View File
@@ -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">
+3 -3
View File
@@ -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"/>
@@ -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>
@@ -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">
+2 -2
View File
@@ -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">
@@ -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>
@@ -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>
@@ -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/>
@@ -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>
@@ -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>
@@ -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)"/>
@@ -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
# --------------------------
@@ -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>
@@ -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">
+1 -1
View File
@@ -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']),
+22 -22
View File
@@ -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">
+2 -26
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
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)
@@ -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>
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -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>
+3 -3
View File
@@ -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">
+2 -3
View File
@@ -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')
@@ -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>
+1 -1
View File
@@ -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
+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=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'):
+1 -1
View File
@@ -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})
@@ -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';
},
+2 -2
View File
@@ -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);
@@ -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';
}
@@ -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, {
@@ -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;
},
/**
+3 -3
View File
@@ -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>
+2 -2
View File
@@ -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"/>
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -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"/>
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -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>
@@ -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">
+13 -13
View File
@@ -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">
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -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>
@@ -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;
}
@@ -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"/>' +
+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_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
@@ -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>
+2 -2
View File
@@ -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>
@@ -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"/>
@@ -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">
@@ -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">
+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_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):
+2 -2
View File
@@ -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)
+1 -1
View File
@@ -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) {
@@ -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

Some files were not shown because too many files have changed in this diff Show More