diff --git a/tests/scenario_commission.rst b/tests/scenario_commission.rst index 3a1c650180..f4be57f52c 100644 --- a/tests/scenario_commission.rst +++ b/tests/scenario_commission.rst @@ -47,20 +47,16 @@ Create commission product:: >>> Uom = Model.get('product.uom') >>> Template = Model.get('product.template') - >>> Product = Model.get('product.product') >>> unit, = Uom.find([('name', '=', 'Unit')]) - >>> commission_product = Product() >>> template = Template() >>> template.name = 'Commission' >>> template.default_uom = unit >>> template.type = 'service' >>> template.list_price = Decimal(0) - >>> template.cost_price = Decimal(0) >>> template.account_expense = accounts['expense'] >>> template.account_revenue = accounts['revenue'] >>> template.save() - >>> commission_product.template = template - >>> commission_product.save() + >>> commission_product, = template.products Create commission plan:: @@ -102,7 +98,6 @@ Create principal:: Create product sold:: - >>> product = Product() >>> template = Template() >>> template.name = 'Product' >>> template.default_uom = unit @@ -113,8 +108,7 @@ Create product sold:: >>> template.account_revenue = accounts['revenue'] >>> template.principals.append(principal) >>> template.save() - >>> product.template = template - >>> product.save() + >>> product, = template.products Create invoice:: diff --git a/tests/test_commission.py b/tests/test_commission.py index 461ddc4cef..fd30747fb7 100644 --- a/tests/test_commission.py +++ b/tests/test_commission.py @@ -15,7 +15,7 @@ from trytond.pool import Pool from trytond.modules.company.tests import create_company, set_company -def create_product(name, list_price, cost_price, categories=None): +def create_product(name, list_price, categories=None): pool = Pool() Template = pool.get('product.template') Product = pool.get('product.product') @@ -26,7 +26,6 @@ def create_product(name, list_price, cost_price, categories=None): name=name, type='service', list_price=list_price, - cost_price=cost_price, default_uom=unit, products=None, ) @@ -42,8 +41,7 @@ def create_plan(lines): pool = Pool() Plan = pool.get('commission.plan') - commission_product = create_product("Commission", Decimal(10), - Decimal(3), []) + commission_product = create_product("Commission", Decimal(10), []) plan, = Plan.create([{ 'name': "Commission Plan", 'commission_product': commission_product.id, @@ -68,8 +66,7 @@ class CommissionTestCase(ModuleTestCase): company = create_company() with set_company(company): - product = create_product( - "Other", Decimal(10), Decimal(3), [category]) + product = create_product("Other", Decimal(10), [category]) plan = create_plan([{ 'category': category.id, @@ -98,7 +95,7 @@ class CommissionTestCase(ModuleTestCase): company = create_company() with set_company(company): - product = create_product("Other", Decimal(10), Decimal(3)) + product = create_product("Other", Decimal(10)) plan = create_plan([{ 'category': category.id, 'formula': 'amount * 0.8',