Browse Source

[FIX] Cancel Statement

adrielso 6 years ago
parent
commit
8e3e202b77
2 changed files with 5 additions and 3 deletions
  1. 5 3
      model/account_bank_voucher_import.py
  2. BIN
      model/account_bank_voucher_import.pyc

+ 5 - 3
model/account_bank_voucher_import.py

@@ -5,9 +5,9 @@ from openerp.exceptions import Warning
 class AccountBankStatement(models.Model):
     _inherit = 'account.bank.statement'
 
-    def button_cancel(self, cr, uid, ids, context=None):
-        context['cancel_from_statement'] = True
-        return super(AccountBankStatement, self).button_cancel(cr, uid, ids, context=context)
+    @api.multi
+    def button_cancel(self):
+        return super(AccountBankStatement, self.with_context(cancel_from_statement=True)).button_cancel()
 
 class AccountBankStatementLine(models.Model):
     _inherit = 'account.bank.statement.line'
@@ -15,6 +15,8 @@ class AccountBankStatementLine(models.Model):
     voucher_id = fields.Many2one('account.voucher', 'Voucher', readonly=True)
 
     def cancel(self, cr, uid, ids, context=None):
+
+        # import web_pdb; web_pdb.set_trace()
         # if we are canceling the statement then we dont raise the warning
         if context.get('cancel_from_statement', False):
             none_voucher_ids = self.search(cr, uid, [('id', 'in', ids), ('voucher_id', '=', False)])

BIN
model/account_bank_voucher_import.pyc