diff --git a/tests/scenario_purchase.rst b/tests/scenario_purchase.rst index b2896392d9..c554b2326f 100644 --- a/tests/scenario_purchase.rst +++ b/tests/scenario_purchase.rst @@ -97,8 +97,7 @@ 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 @@ -106,29 +105,28 @@ Create product:: >>> template.purchasable = True >>> template.salable = True >>> template.list_price = Decimal('10') - >>> template.cost_price = Decimal('5') >>> template.cost_price_method = 'fixed' >>> template.account_expense = expense >>> template.account_revenue = revenue >>> template.supplier_taxes.append(tax) + >>> product, = template.products + >>> product.cost_price = Decimal('5') >>> template.save() - >>> product.template = template - >>> product.save() + >>> product, = template.products - >>> service = Product() >>> template = ProductTemplate() >>> template.name = 'service' >>> template.default_uom = unit >>> template.type = 'service' >>> template.purchasable = True >>> template.list_price = Decimal('10') - >>> template.cost_price = Decimal('10') >>> template.cost_price_method = 'fixed' >>> template.account_expense = expense >>> template.account_revenue = revenue + >>> service, = template.products + >>> service.cost_price = Decimal('10') >>> template.save() - >>> service.template = template - >>> service.save() + >>> service, = template.products Create payment term:: diff --git a/tests/test_purchase.py b/tests/test_purchase.py index 7f87b57630..1eee37c0aa 100644 --- a/tests/test_purchase.py +++ b/tests/test_purchase.py @@ -50,8 +50,9 @@ class PurchaseTestCase(ModuleTestCase): 'default_uom': g.id, 'purchase_uom': kg.id, 'list_price': Decimal(5), - 'cost_price': Decimal(2), - 'products': [('create', [{}])], + 'products': [('create', [{ + 'cost_price': Decimal(2), + }])], }]) product, = template.products