Upgrade Scenario test

This commit is contained in:
Raimon Esteve 2018-08-27 23:31:54 +02:00
parent d2af005934
commit 6a60befe94

View File

@ -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::