[IMP] merge bank_statement coverage
bzr revid: fp@tinyerp.com-20111111093632-7nv93c11udseda2u
This commit is contained in:
commit
2c8290b90e
|
@ -1,5 +1,23 @@
|
|||
-
|
||||
In order to test Bank Statement feature of account I create a bank statement line and confirm it and check it's move created
|
||||
-
|
||||
I select the period and journal for the bank statement
|
||||
-
|
||||
!python {model: account.bank.statement}: |
|
||||
import time
|
||||
period = self._get_period(cr, uid, {'lang': u'en_US', 'tz': False, 'active_model': 'ir.ui.menu',
|
||||
'journal_type': 'bank', 'period_id':time.strftime('%m'), 'active_ids': [ref('menu_bank_statement_tree')], 'active_id': ref('menu_bank_statement_tree')})
|
||||
assert period, _('Period has not been selected')
|
||||
journal = self._default_journal_id(cr, uid, {'lang': u'en_US', 'tz': False, 'active_model': 'ir.ui.menu',
|
||||
'journal_type': 'bank', 'period_id': time.strftime('%m'), 'active_ids': [ref('menu_bank_statement_tree')], 'active_id': ref('menu_bank_statement_tree')})
|
||||
assert journal, _('Journal has not been selected')
|
||||
-
|
||||
I select the date
|
||||
-
|
||||
!python {model: account.bank.statement}: |
|
||||
import time
|
||||
date = self.onchange_date(cr, uid, [], time.strftime('%Y-%m-%d'), context=None)
|
||||
assert date, _('Date has not been selected')
|
||||
-
|
||||
I create a bank statement with Opening and Closing balance 0.
|
||||
-
|
||||
|
@ -8,29 +26,26 @@
|
|||
balance_start: 0.0
|
||||
date: !eval time.strftime('%Y-%m-%d')
|
||||
journal_id: account.bank_journal
|
||||
name: /
|
||||
period_id: account.period_10
|
||||
line_ids:
|
||||
- account_id: account.a_recv
|
||||
amount: 1000.0
|
||||
date: !eval time.strftime('%Y-%m-%d')
|
||||
name: a
|
||||
partner_id: base.res_partner_4
|
||||
sequence: 0.0
|
||||
type: general
|
||||
-
|
||||
I check that Initially bank statement is in the "Draft" state
|
||||
I create bank statement line
|
||||
-
|
||||
!assert {model: account.bank.statement, id: account_bank_statement_0}:
|
||||
- state == 'draft'
|
||||
!python {model: account.bank.statement.line}: |
|
||||
partner = self.onchange_partner_id(cr, uid, [], ref('base.res_partner_4'), context=None)
|
||||
vals = {
|
||||
'account_id': partner['value']['account_id'],
|
||||
'amount': 1000.0,
|
||||
'partner_id': ref('base.res_partner_4'),
|
||||
'statement_id': ref('account_bank_statement_0'),
|
||||
'name': 'EXT001'
|
||||
}
|
||||
vals.update(partner.get('value',{}))
|
||||
line_id = self.create(cr, uid, vals)
|
||||
assert line_id, "Account bank statement line has not been created"
|
||||
-
|
||||
I compute bank statement using Compute button
|
||||
-
|
||||
!python {model: account.bank.statement}: |
|
||||
self.button_dummy(cr, uid, [ref("account_bank_statement_0")], {"lang": "en_US",
|
||||
"tz": False, "active_model": "ir.ui.menu", "journal_type": "bank", "section_id":
|
||||
False, "period_id": 10, "active_ids": [ref("account.menu_bank_statement_tree")],
|
||||
"active_id": ref("account.menu_bank_statement_tree"), })
|
||||
self.button_dummy(cr, uid, [ref("account_bank_statement_0")])
|
||||
|
||||
-
|
||||
I modify the bank statement and set the Closing Balance.
|
||||
|
@ -42,10 +57,7 @@
|
|||
I confirm the bank statement using Confirm button
|
||||
-
|
||||
!python {model: account.bank.statement}: |
|
||||
self.button_confirm_bank(cr, uid, [ref("account_bank_statement_0")], {"lang":
|
||||
"en_US", "tz": False, "active_model": "ir.ui.menu", "journal_type": "bank",
|
||||
"section_id": False, "period_id": 10, "active_ids": [ref("account.menu_bank_statement_tree")],
|
||||
"active_id": ref("account.menu_bank_statement_tree"), })
|
||||
self.button_confirm_bank(cr, uid, [ref("account_bank_statement_0")])
|
||||
-
|
||||
I check that bank statement state is now "Closed"
|
||||
-
|
||||
|
@ -61,3 +73,11 @@
|
|||
assert bank_data.move_line_ids, "Move lines not created for bank statement"
|
||||
for line in bank_data.move_line_ids:
|
||||
assert line.move_id.state == 'posted', "Move state is not posted"
|
||||
-
|
||||
Then I cancel Bank Statements and verifies that it raises a warning
|
||||
-
|
||||
!python {model: account.bank.statement}: |
|
||||
try:
|
||||
self.button_cancel(cr, uid, [ref("account_bank_statement_0")])
|
||||
except Exception, e:
|
||||
assert e[0]=='UserError', 'Another exception has been raised!'
|
||||
|
|
Loading…
Reference in New Issue