From 6a60befe94ae017c1b2100b5756f94cded234c14 Mon Sep 17 00:00:00 2001 From: Raimon Esteve Date: Mon, 27 Aug 2018 23:31:54 +0200 Subject: [PATCH] Upgrade Scenario test --- tests/scenario_sale_payment.rst | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/tests/scenario_sale_payment.rst b/tests/scenario_sale_payment.rst index 3fe55d2..fd7718f 100644 --- a/tests/scenario_sale_payment.rst +++ b/tests/scenario_sale_payment.rst @@ -9,37 +9,24 @@ Imports:: >>> from decimal import Decimal >>> from operator import attrgetter >>> from proteus import config, Model, Wizard + >>> from trytond.tests.tools import activate_modules >>> from trytond.modules.company.tests.tools import create_company, \ ... get_company >>> from trytond.modules.account.tests.tools import create_fiscalyear, \ - ... create_chart, get_accounts, create_tax, set_tax_code + ... create_chart, get_accounts, create_tax >>> from.trytond.modules.account_invoice.tests.tools import \ ... set_fiscalyear_invoice_sequences, create_payment_term >>> today = datetime.date.today() -Create database:: - - >>> config = config.set_trytond() - >>> config.pool.test = True - Install sale:: - >>> Module = Model.get('ir.module') - >>> module, = Module.find([('name', '=', 'sale_payment')]) - >>> module.click('install') - >>> Wizard('ir.module.install_upgrade').execute('upgrade') + >>> config = activate_modules('sale_payment') Create company:: >>> _ = create_company() >>> company = get_company() -Reload the context:: - - >>> User = Model.get('res.user') - >>> Group = Model.get('res.group') - >>> config._context = User.get_preferences(True, config.context) - Create fiscal year:: >>> fiscalyear = set_fiscalyear_invoice_sequences( @@ -58,12 +45,8 @@ Create chart of accounts:: Create tax:: - >>> tax = set_tax_code(create_tax(Decimal('.10'))) + >>> tax = create_tax(Decimal('.10')) >>> tax.save() - >>> invoice_base_code = tax.invoice_base_code - >>> invoice_tax_code = tax.invoice_tax_code - >>> credit_note_base_code = tax.credit_note_base_code - >>> credit_note_tax_code = tax.credit_note_tax_code Create parties:: @@ -92,14 +75,13 @@ 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.customer_taxes.append(tax) + >>> product, = template.products + >>> product.cost_price = Decimal('5') >>> template.save() - >>> product.template = template - >>> product.save() + >>> product, = template.products Create payment term::