[FIX] website_sale: backport commit 3cc4785ba6 of master

This fix aimed saas-5, not master.
original Commit message:
display accessory field in form view and display the good accessory product inside ecommerce
This is related to previous rev 86055fb8cd
This commit is contained in:
Denis Ledoux 2014-06-04 11:25:51 +02:00
parent 86055fb8cd
commit 489742873d
2 changed files with 4 additions and 4 deletions

View File

@ -111,10 +111,10 @@ class sale_order(osv.Model):
def _cart_accessories(self, cr, uid, ids, context=None):
for order in self.browse(cr, uid, ids, context=context):
s = set(j.product_tmpl_id.id for l in (order.website_order_line or []) for j in (l.product_id.accessory_product_ids or []))
s = set(j.id for l in (order.website_order_line or []) for j in (l.product_id.accessory_product_ids or []))
s -= set(l.product_id.id for l in order.order_line)
product_ids = random.sample(s, min(len(s),3))
return self.pool['product.template'].browse(cr, uid, product_ids, context=context)
return self.pool['product.product'].browse(cr, uid, product_ids, context=context)
class website(orm.Model):
_inherit = 'website'

View File

@ -726,14 +726,14 @@
<tr t-foreach="suggested_products" t-as="product">
<td>
<a t-attf-href="/shop/product/#{ slug(product) }">
<a t-attf-href="/shop/product/#{ slug(product.product_tmpl_id) }">
<span t-field="product.image_small"
t-field-options='{"widget": "image", "class": "img-rounded"}'/>
</a>
</td>
<td>
<div>
<a t-attf-href="/shop/product/#{ slug(product) }">
<a t-attf-href="/shop/product/#{ slug(product.product_tmpl_id) }">
<strong t-field="product.name"/>
</a>
</div>