[FIX] product: avoid traceback when product had no variant.

Compute price with a product template without product product
raises a traceback: index out of tuple
This commit is contained in:
Jeremy Kersten 2016-02-25 17:01:10 +01:00
parent 0eb9772ab8
commit cfcf8bb318
1 changed files with 1 additions and 2 deletions

View File

@ -277,8 +277,7 @@ class product_pricelist(osv.osv):
if is_product_template:
if rule.product_tmpl_id and product.id != rule.product_tmpl_id.id:
continue
if rule.product_id and \
(product.product_variant_count > 1 or product.product_variant_ids[0].id != rule.product_id.id):
if rule.product_id and not (product.product_variant_count == 1 and product.product_variant_ids[0].id == rule.product_id.id):
# product rule acceptable on template if has only one variant
continue
else: