[IMP] website_portal_sale: display product images
on quotations and sales orders for portal users.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, exceptions, models
|
||||
from odoo import api, exceptions, fields, models
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
@@ -55,3 +55,11 @@ class SaleOrder(models.Model):
|
||||
action='/mail/view',
|
||||
model=self._name,
|
||||
res_id=self.id)[self.partner_id.id]
|
||||
|
||||
|
||||
class SaleOrderLine(models.Model):
|
||||
|
||||
_inherit = 'sale.order.line'
|
||||
|
||||
# Non-stored related field to allow portal user to see the image of the product he has ordered
|
||||
product_image = fields.Binary('Product Image', related="product_id.image", store=False)
|
||||
|
||||
@@ -324,7 +324,7 @@
|
||||
<t t-foreach="order.order_line" t-as="ol">
|
||||
<div class="row orders_vertical_align">
|
||||
<div class="col-md-1 text-center">
|
||||
<img t-att-src="'/web/image/product.product/%s/image_small/48x48' % ol.product_id.id"/>
|
||||
<img t-att-src="'/web/image/sale.order.line/%s/product_image/48x48' % ol.id"/>
|
||||
</div>
|
||||
<div id='product_name' class="col-md-5">
|
||||
<span t-esc="ol.product_id.name"/>
|
||||
|
||||
Reference in New Issue
Block a user