[IMP]improved test case in compute_price_margin.

bzr revid: dka@tinyerp.com-20140116084128-4g5cqtuf6bqf9mh8
This commit is contained in:
Darshan Kalola (OpenERP) 2014-01-16 14:11:28 +05:30
parent acde6d86c1
commit 79778888e7
2 changed files with 5 additions and 3 deletions

View File

@ -672,7 +672,7 @@ class product_product(osv.osv):
res = dict.fromkeys(ids, False)
for product in self.browse(cr, uid, ids, context=context):
no_varaints = [x for x in product.product_tmpl_id.product_variant_ids if x.variants == False]
res[product.id] = {'standard_variants' : len(no_varaints) and True or False}
res[product.id] = len(no_varaints) and True or False
return res
_defaults = {

View File

@ -27,5 +27,7 @@
template = self.browse(cr, uid, ref("product_template_test1"))
for variant_id in template.product_variant_ids:
self.pool.get('product.product').write(cr,uid,variant_id.id,{'lst_price':32},context=context)
product = product = self.pool.get('product.product').browse(cr,uid,variant_id.id,context=context)
assert product.price_extra == 10, "Price Extra should be 10."
product = self.pool.get('product.product').browse(cr,uid,variant_id.id,context=context)
assert product.lst_price == 32, "Sale Price should be 32."
assert product.list_price == 20, "Template Sale Price should not be changed."
assert product.price_extra == 10, "Extra Price should be 10."