2 I create a Product Template "Tablate PC" with variant "2GB, Wi-Fi , 6in and set Variant Price Margin(%) = 10 and Variant Price Extra = 30."
4 !record {model: product.template, id: product_template_test1}:
7 categ_id: product_category_8
8 uom_id: product_uom_unit
9 uom_po_id: product_uom_unit
11 - variants: 2GB, Wi-Fi , 6in
16 Now I check new sale price after setting price margins and price extra is equal to (20 + ((20 * 10) / 100)) + 30.
18 !python {model: product.template}: |
19 template = self.browse(cr, uid, ref("product_template_test1"))
20 for variant_id in template.product_variant_ids:
21 product = self.pool.get('product.product').browse(cr,uid,variant_id.id,context=context)
22 assert product.lst_price == (20 + ((20 * 10) / 100)) + 30, "Sell price is not correspond."
24 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)).
26 !python {model: product.template}: |
27 template = self.browse(cr, uid, ref("product_template_test1"))
28 for variant_id in template.product_variant_ids:
29 self.pool.get('product.product').write(cr,uid,variant_id.id,{'lst_price':32},context=context)
30 product = self.pool.get('product.product').browse(cr,uid,variant_id.id,context=context)
31 assert product.lst_price == 32, "Sale Price should be 32."
32 assert product.list_price == 20, "Template Sale Price should not be changed."
33 assert product.price_extra == 10, "Extra Price should be 10."