[FIX] account_voucher: avoid trying unreconcile a move twice

When we cancel a voucher, we may be trying to unlink a reconciliation that was already removed on another move (just looking at the version in cache). In such cases, the unlink would fail with traceback. opw 610287
This commit is contained in:
Ravi Gohil 2014-07-10 17:09:15 +05:30 committed by Martin Trigaux
parent 873dc0370d
commit 8f0392b490
1 changed files with 2 additions and 0 deletions

View File

@ -957,6 +957,8 @@ class account_voucher(osv.osv):
# refresh to make sure you don't unlink an already removed move
voucher.refresh()
for line in voucher.move_ids:
# refresh to make sure you don't unreconcile an already unreconciled entry
line.refresh()
if line.reconcile_id:
move_lines = [move_line.id for move_line in line.reconcile_id.line_id]
move_lines.remove(line.id)