first commit
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
==============================
|
||||
Account Dunning Final Scenario
|
||||
==============================
|
||||
|
||||
Imports::
|
||||
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.modules.account.tests.tools import (
|
||||
... create_chart, create_fiscalyear, get_accounts)
|
||||
>>> from trytond.modules.company.tests.tools import create_company
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
|
||||
Activate modules::
|
||||
|
||||
>>> config = activate_modules('account_dunning', create_company, create_chart)
|
||||
|
||||
Create fiscal year::
|
||||
|
||||
>>> fiscalyear = create_fiscalyear()
|
||||
>>> fiscalyear.click('create_period')
|
||||
>>> period = fiscalyear.periods[0]
|
||||
|
||||
Create chart of accounts::
|
||||
|
||||
>>> accounts = get_accounts()
|
||||
>>> receivable = accounts['receivable']
|
||||
>>> revenue = accounts['revenue']
|
||||
>>> cash = accounts['cash']
|
||||
|
||||
Create dunning procedure::
|
||||
|
||||
>>> Procedure = Model.get('account.dunning.procedure')
|
||||
>>> procedure = Procedure(name='Procedure')
|
||||
>>> level = procedure.levels.new()
|
||||
>>> level.sequence = 1
|
||||
>>> level.overdue = dt.timedelta(0)
|
||||
>>> procedure.save()
|
||||
|
||||
Create parties::
|
||||
|
||||
>>> Party = Model.get('party.party')
|
||||
>>> customer = Party(name='Customer')
|
||||
>>> customer.dunning_procedure = procedure
|
||||
>>> customer.save()
|
||||
|
||||
Create some moves::
|
||||
|
||||
>>> Journal = Model.get('account.journal')
|
||||
>>> Move = Model.get('account.move')
|
||||
>>> journal_revenue, = Journal.find([
|
||||
... ('code', '=', 'REV'),
|
||||
... ])
|
||||
>>> journal_cash, = Journal.find([
|
||||
... ('code', '=', 'CASH'),
|
||||
... ])
|
||||
>>> move = Move()
|
||||
>>> move.period = period
|
||||
>>> move.journal = journal_revenue
|
||||
>>> move.date = period.start_date
|
||||
>>> line = move.lines.new()
|
||||
>>> line.account = revenue
|
||||
>>> line.credit = Decimal(100)
|
||||
>>> line = move.lines.new()
|
||||
>>> line.account = receivable
|
||||
>>> line.debit = Decimal(100)
|
||||
>>> line.party = customer
|
||||
>>> line.maturity_date = period.start_date
|
||||
>>> move.save()
|
||||
|
||||
Create dunning::
|
||||
|
||||
>>> Dunning = Model.get('account.dunning')
|
||||
>>> create_dunning = Wizard('account.dunning.create')
|
||||
>>> create_dunning.form.date = period.start_date + dt.timedelta(days=1)
|
||||
>>> create_dunning.execute('create_')
|
||||
>>> dunning, = Dunning.find([])
|
||||
>>> dunning.state
|
||||
'draft'
|
||||
|
||||
Process dunning::
|
||||
|
||||
>>> process_dunning = Wizard('account.dunning.process',
|
||||
... [dunning])
|
||||
>>> process_dunning.execute('process')
|
||||
>>> dunning.reload()
|
||||
>>> dunning.state
|
||||
'waiting'
|
||||
|
||||
Refresh dunning::
|
||||
|
||||
>>> create_dunning = Wizard('account.dunning.create')
|
||||
>>> create_dunning.form.date = period.start_date + dt.timedelta(days=2)
|
||||
>>> create_dunning.execute('create_')
|
||||
>>> dunning, = Dunning.find([])
|
||||
>>> dunning.state
|
||||
'final'
|
||||
Reference in New Issue
Block a user