[IMP]added test case for extra price and remove copy_translations method from product_product.
bzr revid: dka@tinyerp.com-20140109132515-my03lj9haj9ex90k
This commit is contained in:
parent
c0076916f3
commit
c103be840c
|
@ -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'])))
|
||||
|
|
|
@ -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."
|
||||
|
|
Loading…
Reference in New Issue