← Back to team overview

banking-addons-team team mailing list archive

lp:~camptocamp/banking-addons/bank-statement-reconcile-70-fix-statement-cancel into lp:banking-addons/bank-statement-reconcile-70

 

Nicolas Bessi - Camptocamp has proposed merging lp:~camptocamp/banking-addons/bank-statement-reconcile-70-fix-statement-cancel into lp:banking-addons/bank-statement-reconcile-70.

Requested reviews:
  Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c)

For more details, see:
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-70-fix-statement-cancel/+merge/147114

Fixes statement that can't be canceled.

By overriding button_cancel we prevent the super to be call as we redefined ids.
"ids = []"
So we nerver finish the process of passing statement to draft.

The only difference with the base button_cancel is that we do not delete move_line once canceled.
Is it intended? If yes we have to remove the call to super and write the state of the statements to draft.

Regards

Nicolas
-- 
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-70-fix-statement-cancel/+merge/147114
Your team Banking Addons Team is subscribed to branch lp:banking-addons/bank-statement-reconcile-70.
=== modified file 'account_statement_ext/statement.py'
--- account_statement_ext/statement.py	2013-02-06 09:29:20 +0000
+++ account_statement_ext/statement.py	2013-02-07 13:54:26 +0000
@@ -179,23 +179,6 @@
          ['journal_id', 'period_id']),
     ]
 
-    def button_cancel(self, cr, uid, ids, context=None):
-        """
-        We cancel the related move, delete them and finally put the
-        statement in draft state. So no need to unreconcile all entries,
-        then unpost them, then finaly cancel the bank statement.
-        """
-        for st in self.browse(cr, uid, ids, context=context):
-            if st.state == 'draft':
-                continue
-            ids = []
-            for line in st.line_ids:
-                for move in line.move_ids:
-                    if move.state != 'draft':
-                        move.button_cancel(context=context)
-        return super(AccountBankSatement, self).button_cancel(
-                cr, uid, ids, context=context)
-
     def _prepare_move(self, cr, uid, st_line, st_line_number, context=None):
         """Add the period_id from the statement line date to the move preparation.
            Originaly, it was taken from the statement period_id


Follow ups