Rifakat (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-5716-rha into 
lp:openobject-addons/6.0.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)
  nel (nel-tinyerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-5716-rha/+merge/91024

Hello,

Partial reconcile disappears when we cancel 2nd payment order.

While we do partial payments for customer/supplier invoice and cancel one of 
the partial payment then reconcile gets deleted and hence rest of the partial 
payments history is not maintained.

This fixes the problem, kindly review it.

Regards,
Rifakat
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-5716-rha/+merge/91024
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-5716-rha.
=== modified file 'account_voucher/account_voucher.py'
--- account_voucher/account_voucher.py	2011-10-24 07:25:44 +0000
+++ account_voucher/account_voucher.py	2012-02-01 08:07:19 +0000
@@ -581,17 +581,29 @@
     def cancel_voucher(self, cr, uid, ids, context=None):
         reconcile_pool = self.pool.get('account.move.reconcile')
         move_pool = self.pool.get('account.move')
+        wf_service = netsvc.LocalService("workflow")
 
         for voucher in self.browse(cr, uid, ids, context=context):
             recs = []
             for line in voucher.move_ids:
                 if line.reconcile_id:
-                    recs += [line.reconcile_id.id]
-                if line.reconcile_partial_id:
-                    recs += [line.reconcile_partial_id.id]
-
-            reconcile_pool.unlink(cr, uid, recs)
-
+                    invoice_id = [rec_line.invoice.id for rec_line in line.reconcile_id.line_id if rec_line.invoice]
+                    recs.append(line.reconcile_id.id)
+                    move_lines = [move_line.id for move_line in line.reconcile_id.line_id]
+                    move_lines.remove(line.id)
+                    partial_ids = reconcile_pool.create(cr, uid, {
+                        'type': 'auto',
+                        'line_id': False,
+                        'line_partial_ids': [(6, 0, move_lines)]})
+                    
+                    self.pool.get('account.move.line').write(cr, uid, move_lines, {
+                        'reconcile_id': False,
+                        'reconcile_partial_id': partial_ids
+                    }, update_check=False)
+                elif line.reconcile_partial_id:
+                    invoice_id = [rec_line.invoice.id for rec_line in line.reconcile_partial_id.line_partial_ids if rec_line.invoice]
+            if recs:
+                reconcile_pool.unlink(cr, uid, recs)
             if voucher.move_id:
                 move_pool.button_cancel(cr, uid, [voucher.move_id.id])
                 move_pool.unlink(cr, uid, [voucher.move_id.id])
@@ -599,6 +611,7 @@
             'state':'cancel',
             'move_id':False,
         }
+        wf_service.trg_validate(uid, 'account.invoice', invoice_id[0], 'open_test', cr)
         self.write(cr, uid, ids, res)
         return True
 

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to