- In order to check the calculation of price of the products according to pricelist, - I check sale price of Assemble Computer - !python {model: product.product}: | context.update({'pricelist': ref("customer_pricelist"), 'quantity':1}) product = self.browse(cr, uid, ref("product_product_4"), context=context) assert product.price == (product.lst_price-product.lst_price*(0.10)), "Wrong sale price: Assemble Computer." - I check sale price of Laptop. - !python {model: product.product}: | product = self.browse(cr, uid, ref("product_product_25"), context=context) assert product.price == product.lst_price + 1, "Wrong sale price: Laptop." - I check sale price of IT component. - !python {model: product.product}: | product = self.browse(cr, uid, ref("product_product_7"), context=context) assert product.price == product.lst_price, "Wrong sale price: IT component." - I check sale price of IT component if more than 3 Unit. - !python {model: product.product}: | context.update({'quantity':5}) product = self.browse(cr, uid, ref("product_product_26"), context=context) assert product.price == product.lst_price-product.lst_price*(0.05), "Wrong sale price: IT component if more than 3 Unit." - I check sale price of LCD Monitor. - !python {model: product.product}: | context.update({'quantity':1}) product = self.browse(cr, uid, ref("product_product_6"), context=context) assert product.price == product.lst_price, "Wrong sale price: LCD Monitor." - I check sale price of LCD Monitor on end of year. - !python {model: product.product}: | context.update({'quantity':1, 'date': '2011-12-31'}) product = self.browse(cr, uid, ref("product_product_6"), context=context) assert product.price == product.lst_price-product.lst_price*(0.30), "Wrong sale price: LCD Monitor on end of year." - I check cost price of LCD Monitor. - !python {model: product.product}: | context.update({'quantity':1, 'date': False, 'partner': ref('base.res_partner_4'), 'pricelist': ref("supplier_pricelist")}) product = self.browse(cr, uid, ref("product_product_6"), context=context) assert product.price == 792, "wrong cost price: LCD Monitor." - I check cost price of LCD Monitor if more than 3 Unit. - !python {model: product.product}: | context.update({'quantity':3}) product = self.browse(cr, uid, ref("product_product_6"), context=context) assert product.price == 787, "wrong cost price: LCD Monitor if more than 3 Unit." - I print the sale prices report. - !python {model: product.product}: | ctx = {'model': 'product.product', 'date': '2011-12-30', 'active_ids': [ref('product.product_product_3'), ref('product.product_product_4'), ref('product.product_product_5'), ref('product.product_product_6')]} data_dict = { 'qty1': 1, 'qty2': 5, 'qty3': 10, 'qty4': 15, 'qty5': 30, 'price_list':ref('customer_pricelist'), } from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_product_price_list',wiz_data=data_dict, context=ctx, our_module='product')