[ADD]: adding changes from account_voucher_payment module to account_voucher module
authorMantavya Gajjar <mga@tinyerp.com>
Fri, 20 Aug 2010 19:05:02 +0000 (00:35 +0530)
committerMantavya Gajjar <mga@tinyerp.com>
Fri, 20 Aug 2010 19:05:02 +0000 (00:35 +0530)
bzr revid: mga@tinyerp.com-20100820190502-s8kc60flvr8on6ar

addons/account_voucher/__openerp__.py
addons/account_voucher/voucher_payment_receipt_view.xml
addons/account_voucher/wizard/__init__.py
addons/account_voucher/wizard/account_voucher_unreconcile.py [new file with mode: 0644]
addons/account_voucher/wizard/account_voucher_unreconcile_view.xml [new file with mode: 0644]

index d76f188..d02011d 100644 (file)
         "voucher_workflow.xml",
         "voucher_report.xml",
         "wizard/account_voucher_open_view.xml",
+        "wizard/account_voucher_unreconcile_view.xml",
         "voucher_view.xml",
         "voucher_sales_purchase_view.xml",
         "voucher_payment_receipt_view.xml",
-        "voucher_wizard.xml"
+        "voucher_wizard.xml",
     ],
     "test" : [
 #         "test/account_voucher.yml",
index b204896..02c7d7d 100644 (file)
@@ -53,6 +53,7 @@
                         <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>
index bd436ec..a5c9a5e 100644 (file)
@@ -20,3 +20,4 @@
 ##############################################################################
 
 import account_voucher_open
+import account_voucher_unreconcile
diff --git a/addons/account_voucher/wizard/account_voucher_unreconcile.py b/addons/account_voucher/wizard/account_voucher_unreconcile.py
new file mode 100644 (file)
index 0000000..d12bee5
--- /dev/null
@@ -0,0 +1,63 @@
+# -*- 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:
diff --git a/addons/account_voucher/wizard/account_voucher_unreconcile_view.xml b/addons/account_voucher/wizard/account_voucher_unreconcile_view.xml
new file mode 100644 (file)
index 0000000..3f8dd9c
--- /dev/null
@@ -0,0 +1,39 @@
+<?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>