<button name="recheck_voucher" string="Approve" states="recheck" icon="terp-check"/>
<button name="cancel_voucher" string="Cancel" states="draft,proforma,recheck" icon="gtk-cancel"/>
<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/>
+ <button name="%(action_view_account_voucher_unreconcile)d" string="Unreconcile" type="action" states="posted" icon="terp-stock_effects-object-colorize"/>
</group>
</form>
</field>
<button name="recheck_voucher" string="Approve" states="recheck" icon="terp-check"/>
<button name="cancel_voucher" string="Cancel" states="draft,proforma,recheck" icon="gtk-cancel"/>
<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/>
+ <button name="%(action_view_account_voucher_unreconcile)d" string="Unreconcile" type="action" states="posted" icon="terp-stock_effects-object-colorize"/>
</group>
</form>
</field>
--- /dev/null
+# -*- 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/>.
+#
+##############################################################################
+
+import netsvc
+from osv import osv
+from osv import fields
+
+class account_voucher_unreconcile(osv.osv_memory):
+ _name = "account.voucher.unreconcile"
+ _description = "Account voucher unreconcile"
+
+ _columns = {
+ 'remove':fields.boolean('Want to remove accounting entries too ?', required=False),
+ }
+
+ _defaults = {
+ 'remove': lambda *a: True,
+ }
+
+ def trans_unrec(self, cr, uid, ids, context=None):
+ res = self.browse(cr, uid, ids[0])
+ 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'):
+ voucher = voucher_pool.browse(cr, uid, context.get('active_id'), context)
+ recs = []
+ for line in voucher.move_ids:
+ if line.reconcile_id:
+ recs = [line.reconcile_id.id]
+
+ for rec in recs:
+ reconcile_pool.unlink(cr, uid, rec)
+
+ if res.remove:
+ voucher_pool.cancel_voucher(cr, uid, [context.get('active_id')], context)
+# wf_service = netsvc.LocalService("workflow")
+# wf_service.trg_validate(uid, 'account.voucher', context.get('active_id'), 'cancel_voucher', cr)
+
+ return {}
+
+account_voucher_unreconcile()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+
+ <record id="view_account_voucher_unreconcile" model="ir.ui.view">
+ <field name="name">Account voucher unreconcile</field>
+ <field name="model">account.voucher.unreconcile</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Unreconciliation">
+ <separator colspan="4" string="Unreconciliation transactions" />
+ <label string="If you unreconciliate transactions, you must also verify all the actions that are linked to those transactions because they will not be disable" colspan="2"/>
+ <separator colspan="4"/>
+ <field name="remove"/>
+ <separator colspan="4"/>
+ <button special="cancel" string="Cancel" icon="gtk-cancel"/>
+ <button name="trans_unrec" default_focus="1" string="Unreconcile" type="object" icon="gtk-ok"/>
+ </form>
+ </field>
+ </record>
+ <record model="ir.actions.act_window" id="action_view_account_voucher_unreconcile">
+ <field name="name">Unreconcile entries</field>
+ <field name="res_model">account.voucher.unreconcile</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">form</field>
+ <field name="view_id" ref="view_account_voucher_unreconcile"/>
+ <field name="target">new</field>
+ </record>
+
+<!-- <act_window name="Unreconcile entries" -->
+<!-- res_model="account.voucher.unreconcile"-->
+<!-- src_model="account.voucher"-->
+<!-- view_mode="form"-->
+<!-- target="new" -->
+<!-- key2="client_action_multi" -->
+<!-- id="action_view_account_voucher_unreconcile"/>-->
+
+ </data>
+</openerp>