From c103be840c91ac0f38f80dff1ae00d08474a46f8 Mon Sep 17 00:00:00 2001 From: "Darshan Kalola (OpenERP)" Date: Thu, 9 Jan 2014 18:55:15 +0530 Subject: [PATCH] [IMP]added test case for extra price and remove copy_translations method from product_product. bzr revid: dka@tinyerp.com-20140109132515-my03lj9haj9ex90k --- addons/product/product.py | 11 ----------- addons/product/test/compute_price_margin.yml | 9 +++++++++ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/addons/product/product.py b/addons/product/product.py index e09719c1a59..3020568a30c 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -944,17 +944,6 @@ class product_product(osv.osv): return super(product_product, self).copy(cr, uid, id, default=default, context=context) - def copy_translations(self, cr, uid, old_id, new_id, context=None): - """ When we do not copy the template along the variant, - copy_translations sometimes receives 2 identical IDs. - That's because the ORM follows the o2m to copy the translations, - so in that case, it follows 'variant_ids' and for each variant, - it copy the translations. One of the variant is the 'new_id'. - Just skip the identical IDs. - """ - if old_id == new_id: - return super(product_product, self).copy_translations(cr, uid, old_id, new_id, context=context) - def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): if context and context.get('search_default_categ_id'): args.append((('categ_id', 'child_of', context['search_default_categ_id']))) diff --git a/addons/product/test/compute_price_margin.yml b/addons/product/test/compute_price_margin.yml index 575af11802e..5443b37f103 100644 --- a/addons/product/test/compute_price_margin.yml +++ b/addons/product/test/compute_price_margin.yml @@ -20,3 +20,12 @@ for variant_id in template.product_variant_ids: product = self.pool.get('product.product').browse(cr,uid,variant_id.id,context=context) assert product.lst_price == (20 + ((20 * 10) / 100)) + 30, "Sell price is not correspond." +- + In order to check the Price Extra after setting 'public sale price(lst_price)' of a product. +- + !python {model: product.template}: | + 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':30},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."