Upgrade scenario
This commit is contained in:
parent
e40c016030
commit
5267405247
|
@ -12,6 +12,8 @@ Imports::
|
|||
>>> from dateutil.relativedelta import relativedelta
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import config, Model, Wizard
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> now = datetime.datetime.now()
|
||||
>>> yesterday = datetime.datetime.now() - relativedelta(days=1)
|
||||
>>> today = datetime.date.today()
|
||||
|
@ -23,38 +25,18 @@ Create database::
|
|||
|
||||
Install farm::
|
||||
|
||||
>>> Module = Model.get('ir.module.module')
|
||||
>>> Module = Model.get('ir.module')
|
||||
>>> modules = Module.find([
|
||||
... ('name', '=', 'farm_nutrition_program'),
|
||||
... ])
|
||||
>>> Module.install([x.id for x in modules], config.context)
|
||||
>>> Wizard('ir.module.module.install_upgrade').execute('upgrade')
|
||||
>>> Wizard('ir.module.install_upgrade').execute('upgrade')
|
||||
|
||||
Create company::
|
||||
|
||||
>>> Currency = Model.get('currency.currency')
|
||||
>>> CurrencyRate = Model.get('currency.currency.rate')
|
||||
>>> Company = Model.get('company.company')
|
||||
>>> Party = Model.get('party.party')
|
||||
>>> company_config = Wizard('company.company.config')
|
||||
>>> company_config.execute('company')
|
||||
>>> company = company_config.form
|
||||
>>> party = Party(name='NaN·tic')
|
||||
>>> party.save()
|
||||
>>> company.party = party
|
||||
>>> currencies = Currency.find([('code', '=', 'EUR')])
|
||||
>>> if not currencies:
|
||||
... currency = Currency(name='Euro', symbol=u'€', code='EUR',
|
||||
... rounding=Decimal('0.01'), mon_grouping='[3, 3, 0]',
|
||||
... mon_decimal_point=',')
|
||||
... currency.save()
|
||||
... CurrencyRate(date=now.date() + relativedelta(month=1, day=1),
|
||||
... rate=Decimal('1.0'), currency=currency).save()
|
||||
... else:
|
||||
... currency, = currencies
|
||||
>>> company.currency = currency
|
||||
>>> company_config.execute('add')
|
||||
>>> company, = Company.find()
|
||||
>>> _ = create_company()
|
||||
>>> company = get_company()
|
||||
>>> party = company.party
|
||||
|
||||
Reload the context::
|
||||
|
||||
|
|
Loading…
Reference in New Issue