2010-08-20 19:05:02 +00:00
|
|
|
# -*- encoding: utf-8 -*-
|
|
|
|
##############################################################################
|
|
|
|
#
|
|
|
|
# OpenERP, Open Source Management Solution
|
|
|
|
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Affero General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
|
|
# License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
from osv import osv
|
|
|
|
from osv import fields
|
|
|
|
|
|
|
|
class account_voucher_unreconcile(osv.osv_memory):
|
|
|
|
_name = "account.voucher.unreconcile"
|
|
|
|
_description = "Account voucher unreconcile"
|
2010-10-26 13:33:52 +00:00
|
|
|
|
2010-08-20 19:05:02 +00:00
|
|
|
_columns = {
|
|
|
|
'remove':fields.boolean('Want to remove accounting entries too ?', required=False),
|
|
|
|
}
|
2010-10-26 13:33:52 +00:00
|
|
|
|
2010-08-20 19:05:02 +00:00
|
|
|
_defaults = {
|
2010-10-11 12:49:25 +00:00
|
|
|
'remove': True,
|
2010-08-20 19:05:02 +00:00
|
|
|
}
|
2010-10-26 13:33:52 +00:00
|
|
|
|
2010-08-20 19:05:02 +00:00
|
|
|
def trans_unrec(self, cr, uid, ids, context=None):
|
2010-10-11 12:49:25 +00:00
|
|
|
# res = self.browse(cr, uid, ids[0])
|
2010-08-20 19:05:02 +00:00
|
|
|
if context is None:
|
|
|
|
context = {}
|
|
|
|
voucher_pool = self.pool.get('account.voucher')
|
|
|
|
reconcile_pool = self.pool.get('account.move.reconcile')
|
|
|
|
if context.get('active_id'):
|
2010-11-19 13:48:01 +00:00
|
|
|
voucher = voucher_pool.browse(cr, uid, context.get('active_id'), context=context)
|
2010-08-20 19:05:02 +00:00
|
|
|
recs = []
|
|
|
|
for line in voucher.move_ids:
|
|
|
|
if line.reconcile_id:
|
2010-08-26 19:09:33 +00:00
|
|
|
recs += [line.reconcile_id.id]
|
2010-08-26 15:04:35 +00:00
|
|
|
if line.reconcile_partial_id:
|
2010-08-26 19:09:33 +00:00
|
|
|
recs += [line.reconcile_partial_id.id]
|
2010-08-26 15:04:35 +00:00
|
|
|
#for rec in recs:
|
|
|
|
reconcile_pool.unlink(cr, uid, recs)
|
2010-08-30 13:23:02 +00:00
|
|
|
# if res.remove:
|
|
|
|
voucher_pool.cancel_voucher(cr, uid, [context.get('active_id')], context)
|
2010-08-20 19:05:02 +00:00
|
|
|
# wf_service = netsvc.LocalService("workflow")
|
|
|
|
# wf_service.trg_validate(uid, 'account.voucher', context.get('active_id'), 'cancel_voucher', cr)
|
2010-10-26 13:33:52 +00:00
|
|
|
|
2010-12-28 10:44:45 +00:00
|
|
|
return {'type': 'ir.actions.act_window_close'}
|
2010-08-20 19:05:02 +00:00
|
|
|
|
|
|
|
account_voucher_unreconcile()
|
|
|
|
|
2010-10-26 13:33:52 +00:00
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|