[FIX] Account Voucher: Correct cancel on bank stetements with voucher
bzr revid: mra@mra-laptop-20101001035139-k3flqjxanuj42u35
This commit is contained in:
parent
3a60e60b1d
commit
5b559ba356
|
@ -847,6 +847,17 @@ account_voucher_line()
|
|||
class account_bank_statement(osv.osv):
|
||||
_inherit = 'account.bank.statement'
|
||||
|
||||
def button_cancel(self, cr, uid, ids, context=None):
|
||||
done = []
|
||||
for st in self.browse(cr, uid, ids, context):
|
||||
voucher_ids = []
|
||||
for line in st.line_ids:
|
||||
if line.voucher_id:
|
||||
voucher_ids.append(line.voucher_id.id)
|
||||
self.pool.get('account.voucher').cancel_voucher(cr, uid, voucher_ids, context)
|
||||
self.pool.get('account.voucher').unlink(cr, uid, voucher_ids, context)
|
||||
return super(account_bank_statement, self).button_cancel(cr, uid, ids, context=context)
|
||||
|
||||
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, next_number, context=None):
|
||||
voucher_obj = self.pool.get('account.voucher')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
|
@ -855,7 +866,7 @@ class account_bank_statement(osv.osv):
|
|||
voucher_obj.write(cr, uid, [st_line.voucher_id.id], {'number': next_number}, context=context)
|
||||
wf_service.trg_validate(uid, 'account.voucher', st_line.voucher_id.id, 'proforma_voucher', cr)
|
||||
return self.pool.get('account.move.line').write(cr, uid, [x.id for x in st_line.voucher_id.move_ids], {'statement_id': st_line.statement_id.id}, context=context)
|
||||
return super(account_bank_statement, self).create_move_from_st_line(cr, uid, st_line, company_currency_id, next_number, context=context)
|
||||
return super(account_bank_statement, self).create_move_from_st_line(cr, uid, st_line.id, company_currency_id, next_number, context=context)
|
||||
|
||||
account_bank_statement()
|
||||
|
||||
|
@ -892,7 +903,8 @@ class account_bank_statement_line(osv.osv):
|
|||
statement_line = self.browse(cr, uid, ids, context)
|
||||
unlink_ids = []
|
||||
for st_line in statement_line:
|
||||
unlink_ids.append(st_line.voucher_id.id)
|
||||
if st_line.voucher_id:
|
||||
unlink_ids.append(st_line.voucher_id.id)
|
||||
self.pool.get('account.voucher').unlink(cr, uid, unlink_ids, context=context)
|
||||
return super(account_bank_statement_line, self).unlink(cr, uid, ids, context=context)
|
||||
|
||||
|
|
Loading…
Reference in New Issue