[FIX] Account : When Payment is done by bank statement with a different currency...
authorJay,Vra <>
Tue, 6 Jul 2010 14:34:23 +0000 (20:04 +0530)
committerJay (Open ERP) <jvo@tinyerp.com>
Tue, 6 Jul 2010 14:34:23 +0000 (20:04 +0530)
bzr revid: jvo@tinyerp.com-20100706143423-p0axe89zcqbhioy3

addons/account/wizard/wizard_statement_from_invoice.py

index 6c50144..3946069 100644 (file)
@@ -120,14 +120,20 @@ def _populate_statement(obj, cursor, user, data, context):
         # else:
         ctx['date'] = line_date
         amount = 0.0
+        
+        if line.debit > 0:
+            amount = line.debit
+        elif line.credit > 0:
+            amount = -line.credit
+                
         if line.amount_currency:
             amount = currency_obj.compute(cursor, user, line.currency_id.id,
                 statement.currency.id, line.amount_currency, context=ctx)
-        else:
-            if line.debit > 0:
-                amount=line.debit
-            elif line.credit > 0:
-                amount=-line.credit
+        elif (line.invoice and line.invoice.currency_id.id <> statement.currency.id):
+            amount = currency_obj.compute(cursor, user, line.invoice.currency_id.id,
+                statement.currency.id, amount, context=ctx)
+            
+            
         reconcile_id = statement_reconcile_obj.create(cursor, user, {
             'line_ids': [(6, 0, [line.id])]
             }, context=context)