[FIX] website_sale: accessory_product_ids are product.product, not product.template

This many2many field should actually have product.template as relation
But, in a stable release, we cannot alter the database
Therefore, when displaying accessory products in the card, it display the product_tmpl_id of the product.product, not itself
This relation should be changed in trunk
+ Actually displaying this field in the backend
This commit is contained in:
Denis Ledoux 2014-06-04 10:44:56 +02:00
parent b1c0bc0b46
commit 86055fb8cd
2 changed files with 2 additions and 1 deletions

View File

@ -111,7 +111,7 @@ 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.id for l in (order.website_order_line or []) for j in (l.product_id.accessory_product_ids or []))
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(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)

View File

@ -25,6 +25,7 @@
<field name="public_categ_ids" widget="many2many_tags"/>
<field name="website_published" class="pull-right" widget="website_button"/>
<field name="alternative_product_ids" widget="many2many_tags"/>
<field name="accessory_product_ids" widget="many2many_tags"/>
<field name="website_style_ids" widget="many2many_tags"/>
<field name="website_sequence"/>
</group>