← Back to team overview

banking-addons-team team mailing list archive

[Merge] lp:~camptocamp/banking-addons/already_delete_reconcile_id into lp:banking-addons/bank-statement-reconcile-70

 

Vincent Renaville@camptocamp has proposed merging lp:~camptocamp/banking-addons/already_delete_reconcile_id into lp:banking-addons/bank-statement-reconcile-70.

Requested reviews:
  Banking Addons Core Editors (banking-addons-team)

For more details, see:
https://code.launchpad.net/~camptocamp/banking-addons/already_delete_reconcile_id/+merge/177149

[FIX] prevent to delete an already deleted reconcile_id
-- 
https://code.launchpad.net/~camptocamp/banking-addons/already_delete_reconcile_id/+merge/177149
Your team Banking Addons Core Editors is requested to review the proposed merge of lp:~camptocamp/banking-addons/already_delete_reconcile_id into lp:banking-addons/bank-statement-reconcile-70.
=== modified file 'account_statement_ext/account.py'
--- account_statement_ext/account.py	2012-12-20 13:37:01 +0000
+++ account_statement_ext/account.py	2013-07-26 13:40:34 +0000
@@ -31,8 +31,12 @@
         Delete the reconciliation when we delete the moves. This
         allow an easier way of cancelling the bank statement.
         """
+        all_ready_delete = []
         for move in self.browse(cr, uid, ids, context=context):
             for move_line in move.line_id:
                 if move_line.reconcile_id:
-                    move_line.reconcile_id.unlink(context=context)
+                    ## We check if the reconcile is still there
+                    if move_line.reconcile_id.id not in all_ready_delete:
+                        all_ready_delete.append(move_line.reconcile_id.id)
+                        move_line.reconcile_id.unlink(context=context)
         return super(account_move, self).unlink(cr, uid, ids, context=context)


Follow ups