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

Requested reviews:
  Priyesh (OpenERP) (pso-openerp)
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-576484-rha/+merge/114640

Hello,

I have fixed wrong calculation of residual(Amount) when reconcile move lines 
through
'Manual Reconciliation'.

Problem arises when we do manual reconciliation of several sales move line 
entries
against the payment entries and it applies partial reconciliation tag to all 
the sales
entries. I have restircted to add residual amount for all the move lines to 
residual of
invoice which contains same tag.

To reproduce this issue:
1. create an customer invoice for any customer for a product with unit price 
4000EUR, with 25% payment term
   so we will have 1000EUR sales entry for 4 month(as per payment term).
2. Create bank statement and encode 2 manual entries 1200 and 1500 for same 
customer. validate it.
3. Go to 'Manual Reconciliation'. We need to reconcile 1200+1500=2700 so we 
will reconcile this
   amount against 3x1000EUR.
4. Invocie residual should be 1300 but I will show 1900. That's the bug.

Please review this fix.

Regards,
Rifakat Haradwala
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-576484-rha/+merge/114640
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-opw-576484-rha.
=== modified file 'account/account_invoice.py'
--- account/account_invoice.py	2012-07-04 16:33:07 +0000
+++ account/account_invoice.py	2012-07-12 13:30:29 +0000
@@ -93,11 +93,17 @@
     def _amount_residual(self, cr, uid, ids, name, args, context=None):
         result = {}
         for invoice in self.browse(cr, uid, ids, context=context):
+            checked_partial_rec_ids = []
             result[invoice.id] = 0.0
             if invoice.move_id:
-                for m in invoice.move_id.line_id:
-                    if m.account_id.type in ('receivable','payable'):
-                        result[invoice.id] += m.amount_residual_currency
+                for move_line in invoice.move_id.line_id:
+                    if move_line.account_id.type in ('receivable','payable'):
+                        if move_line.reconcile_partial_id:
+                            partial_reconcile_id = move_line.reconcile_partial_id.id
+                            if partial_reconcile_id in checked_partial_rec_ids:
+                                continue
+                            checked_partial_rec_ids.append(partial_reconcile_id)
+                        result[invoice.id] += move_line.amount_residual_currency
         return result
 
     # Give Journal Items related to the payment reconciled to this invoice

_______________________________________________
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