[FIX] OPW 576406: bank.statement: fix incorrect test + cleanup bad variable names

bzr revid: odo@openerp.com-20120704144721-9moczgo1k3shuh7j
This commit is contained in:
Olivier Dony
2012-07-04 16:47:21 +02:00
parent 64297873d4
commit 4805c12199
2 changed files with 8 additions and 6 deletions
+4 -4
View File
@@ -373,11 +373,11 @@ class account_bank_statement(osv.osv):
for st in self.browse(cr, uid, ids, context=context):
if st.state=='draft':
continue
ids = []
move_ids = []
for line in st.line_ids:
ids += [x.id for x in line.move_ids]
account_move_obj.button_cancel(cr, uid, ids, context=context)
account_move_obj.unlink(cr, uid, ids, context)
move_ids += [x.id for x in line.move_ids]
account_move_obj.button_cancel(cr, uid, move_ids, context=context)
account_move_obj.unlink(cr, uid, move_ids, context)
done.append(st.id)
return self.write(cr, uid, done, {'state':'draft'}, context=context)
@@ -69,5 +69,7 @@
!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!'
assert False, "An exception should have been raised, the journal should not let us cancel moves!"
except Exception:
# exception was raised as expected, as the journal does notallow cancelling moves
pass