[FIX] account_voucher: avoid trying unreconcile a move twice
authorRavi Gohil <rgo@tinyerp.com>
Thu, 10 Jul 2014 11:39:15 +0000 (17:09 +0530)
committerMartin Trigaux <mat@openerp.com>
Wed, 30 Jul 2014 13:56:19 +0000 (15:56 +0200)
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

addons/account_voucher/account_voucher.py

index ce080d9..a7c7646 100644 (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)