← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/5.0-opw-4435-ach into lp:openobject-addons/5.0

 

Anup(OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/5.0-opw-4435-ach into lp:openobject-addons/5.0.

Requested reviews:
  Stephane Wirtel (OpenERP) (stephane-openerp)
  Jay Vora (OpenERP) (jvo-openerp)
Related bugs:
  Bug #730676 in OpenERP Addons: "[5.0] installment plan , payment term : Problem with invoice"
  https://bugs.launchpad.net/openobject-addons/+bug/730676

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/5.0-opw-4435-ach/+merge/62480

Hello,

The merge fixes the following issues.

 - When you pay the invoice partially using the payment term the residual amount was not being deducted.
 - When you pay invoice in different currency it caused an error.
 - Writeoff was being an issue due to the rounding of amount in different currencies.

All the issues has been fixed by this.

Thanks.

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/5.0-opw-4435-ach/+merge/62480
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/5.0-opw-4435-ach.
=== modified file 'account/account_move_line.py'
--- account/account_move_line.py	2010-12-16 16:06:42 +0000
+++ account/account_move_line.py	2011-05-26 13:01:38 +0000
@@ -563,7 +563,13 @@
             account_id = line['account_id']['id']
             account_type = line['account_id']['type']
             partner_id = (line['partner_id'] and line['partner_id']['id']) or False
-        writeoff = debit - credit
+        
+        if (line.invoice.currency_id != line.invoice.company_id.currency_id) or (line.currency_id != line.invoice.company_id.currency_id):
+            # Rounding issues with different currencies
+            writeoff = round(debit - credit,tools.config['price_accuracy']-1)
+        else:
+            writeoff = debit - credit
+        
         # Ifdate_p in context => take this date
         if context.has_key('date_p') and context['date_p']:
             date=context['date_p']

=== modified file 'account/invoice.py'
--- account/invoice.py	2011-02-28 10:53:53 +0000
+++ account/invoice.py	2011-05-26 13:01:38 +0000
@@ -114,7 +114,7 @@
             inv_total = inv.amount_total
             context_unreconciled = context.copy()
             for lines in inv.move_lines:
-                if lines.currency_id and lines.currency_id.id == inv.currency_id.id:
+                if lines.currency_id and lines.currency_id.id == inv.currency_id.id and lines.amount_currency:
                    if inv.type in ('out_invoice','in_refund'):
                         inv_total += lines.amount_currency
                    else:
@@ -144,8 +144,8 @@
                     ids_line = line.reconcile_id.line_id
                 elif line.reconcile_partial_id:
                     ids_line = line.reconcile_partial_id.line_partial_ids
+                    partial_ids.append(line.id)
                 l = map(lambda x: x.id, ids_line)
-                partial_ids.append(line.id)
                 res[id] =[x for x in l if x <> line.id and x not in partial_ids]
         return res