[IMP] price computation and yml testcase.

bzr revid: amb@tinyerp.com-20140110132921-klxgy71bas9jjef2
This commit is contained in:
Amit Bhavsar (Open ERP)
2014-01-10 18:59:21 +05:30
parent c103be840c
commit 81c8320a2f
2 changed files with 5 additions and 2 deletions
+3
View File
@@ -587,6 +587,9 @@ class product_product(osv.osv):
if field_value > 0.0:
product = self.browse(cr, uid, product_id, context=context)
price_extra = (field_value - product.list_price)
if product.price_margin:
price = (product.list_price + (product.list_price * (product.price_margin / 100)))
price_extra = (field_value - price)
return self.write(cr, uid, [product_id], {'price_extra': price_extra}, context=context)
def _get_partner_code_name(self, cr, uid, ids, product, partner_id, context=None):
+2 -2
View File
@@ -21,11 +21,11 @@
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.
In order to check the Price Extra after setting 'public sale price(lst_price)' of a product. price extra is equal to 32 - (20 + ((20 * 10) / 100)).
-
!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)
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."