diff --git a/tests/scenario_purchase_shipment_cost.rst b/tests/scenario_purchase_shipment_cost.rst index 79429a49d3..14b9e03bef 100644 --- a/tests/scenario_purchase_shipment_cost.rst +++ b/tests/scenario_purchase_shipment_cost.rst @@ -32,28 +32,27 @@ Create products:: >>> ProductUom = Model.get('product.uom') >>> ProductTemplate = Model.get('product.template') - >>> Product = Model.get('product.product') >>> unit, = ProductUom.find([('name', '=', 'Unit')]) - >>> product = Product() + >>> template = ProductTemplate() >>> template.name = 'Product' >>> template.default_uom = unit >>> template.type = 'goods' >>> template.list_price = Decimal('20') - >>> template.cost_price = Decimal('8') + >>> product, = template.products + >>> product.cost_price = Decimal('8') >>> template.save() - >>> product.template = template - >>> product.save() - >>> carrier_product = Product() + >>> product, = template.products + >>> carrier_template = ProductTemplate() >>> carrier_template.name = 'Carrier Product' >>> carrier_template.default_uom = unit >>> carrier_template.type = 'service' >>> carrier_template.list_price = Decimal('5') - >>> carrier_template.cost_price = Decimal('3') + >>> carrier_product, = carrier_template.products + >>> carrier_product.cost_price = Decimal('3') >>> carrier_template.save() - >>> carrier_product.template = carrier_template - >>> carrier_product.save() + >>> carrier_product, = carrier_template.products Create carrier:: diff --git a/tests/scenario_purchase_shipment_cost_with_account_stock.rst b/tests/scenario_purchase_shipment_cost_with_account_stock.rst index 25368b825c..52ff15ba01 100644 --- a/tests/scenario_purchase_shipment_cost_with_account_stock.rst +++ b/tests/scenario_purchase_shipment_cost_with_account_stock.rst @@ -63,15 +63,13 @@ Create products:: >>> ProductUom = Model.get('product.uom') >>> ProductTemplate = Model.get('product.template') - >>> Product = Model.get('product.product') >>> unit, = ProductUom.find([('name', '=', 'Unit')]) - >>> product = Product() + >>> template = ProductTemplate() >>> template.name = 'Product' >>> template.default_uom = unit >>> template.type = 'goods' >>> template.list_price = Decimal('20') - >>> template.cost_price = Decimal('8') >>> template.account_expense = expense >>> template.account_revenue = revenue >>> template.account_stock = stock @@ -82,28 +80,26 @@ Create products:: >>> template.account_journal_stock_supplier = stock_journal >>> template.account_journal_stock_customer = stock_journal >>> template.account_journal_stock_lost_found = stock_journal + >>> product, = template.products + >>> product.cost_price = Decimal('8') >>> template.save() - >>> product.template = template - >>> product.save() - >>> template_average, = ProductTemplate.duplicate([template]) - >>> template_average.cost_price_method = 'average' - >>> template_average.save() - >>> product_average, = Product.duplicate([product], { - ... 'template': template_average.id, + >>> product, = template.products + >>> template_average, = template.duplicate({ + ... 'cost_price_method': 'average', ... }) + >>> product_average, = template_average.products - >>> carrier_product = Product() >>> carrier_template = ProductTemplate() >>> carrier_template.name = 'Carrier Product' >>> carrier_template.default_uom = unit >>> carrier_template.type = 'service' >>> carrier_template.list_price = Decimal('5') - >>> carrier_template.cost_price = Decimal('3') >>> carrier_template.account_expense = expense >>> carrier_template.account_revenue = revenue + >>> carrier_product, = carrier_template.products + >>> carrier_product.cost_price = Decimal('3') >>> carrier_template.save() - >>> carrier_product.template = carrier_template - >>> carrier_product.save() + >>> carrier_product, = carrier_template.products Create carrier:: diff --git a/tests/scenario_purchase_shipment_cost_with_account_stock_anglo_saxon.rst b/tests/scenario_purchase_shipment_cost_with_account_stock_anglo_saxon.rst index d29acca1a0..8b74cbc5ae 100644 --- a/tests/scenario_purchase_shipment_cost_with_account_stock_anglo_saxon.rst +++ b/tests/scenario_purchase_shipment_cost_with_account_stock_anglo_saxon.rst @@ -71,15 +71,13 @@ Create product:: >>> ProductUom = Model.get('product.uom') >>> unit, = ProductUom.find([('name', '=', 'Unit')]) >>> ProductTemplate = Model.get('product.template') - >>> Product = Model.get('product.product') - >>> product = Product() + >>> template = ProductTemplate() >>> template.name = 'product' >>> template.default_uom = unit >>> template.type = 'goods' >>> template.purchasable = True >>> template.list_price = Decimal('10') - >>> template.cost_price = Decimal('5') >>> template.cost_price_method = 'average' >>> template.account_expense = expense >>> template.account_revenue = revenue @@ -92,21 +90,22 @@ Create product:: >>> template.account_journal_stock_supplier = stock_journal >>> template.account_journal_stock_customer = stock_journal >>> template.account_journal_stock_lost_found = stock_journal + >>> product, = template.products + >>> product.cost_price = Decimal('5') >>> template.save() - >>> product.template = template - >>> product.save() - >>> carrier_product = Product() + >>> product, = template.products + >>> carrier_template = ProductTemplate() >>> carrier_template.name = 'Carrier Product' >>> carrier_template.default_uom = unit >>> carrier_template.type = 'service' >>> carrier_template.list_price = Decimal('5') - >>> carrier_template.cost_price = Decimal('3') >>> carrier_template.account_expense = expense >>> carrier_template.account_revenue = revenue + >>> carrier_product, = carrier_template.products + >>> carrier_product.cost_price = Decimal('3') >>> carrier_template.save() - >>> carrier_product.template = carrier_template - >>> carrier_product.save() + >>> carrier_product, = carrier_template.products Create carrier::