diff --git a/account_statement_cancel_line/__openerp__.py b/account_statement_cancel_line/__openerp__.py index d3541a31..a881ff8d 100644 --- a/account_statement_cancel_line/__openerp__.py +++ b/account_statement_cancel_line/__openerp__.py @@ -61,6 +61,7 @@ ], 'demo_xml': [], 'test': [ + 'test/cancel_line.yml', ], 'installable': True, 'images': [], diff --git a/account_statement_cancel_line/statement.py b/account_statement_cancel_line/statement.py index 5d0aeec4..ce05adfe 100644 --- a/account_statement_cancel_line/statement.py +++ b/account_statement_cancel_line/statement.py @@ -27,7 +27,8 @@ class Statement(orm.Model): """Bank Statement. - Minimal changes to allow cancelling single lines. + Minimal changes to allow cancelling single lines and checking if there are + any lines that are already reconciled. """ diff --git a/account_statement_cancel_line/test/cancel_line.yml b/account_statement_cancel_line/test/cancel_line.yml index e69de29b..b16e8f13 100644 --- a/account_statement_cancel_line/test/cancel_line.yml +++ b/account_statement_cancel_line/test/cancel_line.yml @@ -0,0 +1,80 @@ +- + In order to test the cancellation of statement lines, I need a statement + profile. +- + !record {model: account.statement.profile, id: profile_test}: + name: Bank EUR Profile for automatic checks + journal_id: account.bank_journal + commission_account_id: account.a_expense + company_id: base.main_company +- + Now I create a statement. I create statment lines separately because I need + to find each one by XML id +- + !record {model: account.bank.statement, id: statement_test}: + name: My Statement + profile_id: profile_test + company_id: base.main_company +- + I create a first statement line +- + !record {model: account.bank.statement.line, id: statement_line_1}: + name: line1 + statement_id: profile_test + ref: ref1 + date: '2014-01-20' + amount: 100.0 +- + I create a second statement line +- + !record {model: account.bank.statement.line, id: statement_line_2}: + name: line2 + statement_id: profile_test + ref: ref2 + date: '2014-01-25' + amount: 200.0 +- + I check that the state of the statement is "Draft" +- + !assert {model: account.bank.statement, id: statement_test}: + - state == 'draft' +- + I confirm the statement +- + !python {model: account.bank.statement}: | + result = self.button_confirm_bank(cr, uid, [ref("statement_test")]) +- + I check that the state of the statement is "Closed" +- + !assert {model: account.bank.statement, id: statement_test}: + - state == 'confirm' +- + I check that the state of the statement line is "Confirmed" +- + !assert {model: account.bank.statement, id: statement_line_1}: + - state == 'confirmed' +- + I check that a move was generated +- + !assert {model: account.bank.statement, id: statement_line_1}: + - move_id +- + Now I cancel a statement line +- + !python {model: account.bank.statement.line}: | + result = self.button_cancel(cr, uid, [ref("statement_line_1")]) +- + I check that the state of the statement went back to "Draft" +- + !assert {model: account.bank.statement, id: statement_test}: + - state == 'draft' +- + I also check that the state of the statement line went back to "Draft" +- + !assert {model: account.bank.statement.line, id: statement_line_1}: + - state == 'draft' +- + And the move is not there anymore +- + !assert {model: account.bank.statement.line, id: statement_line_1}: + - move_id is False