← Back to team overview

banking-addons-team team mailing list archive

lp:~therp-nl/banking-addons/ba61-lp1098699-fix_clieop_rounding_issue into lp:banking-addons

 

Stefan Rijnhart (Therp) has proposed merging lp:~therp-nl/banking-addons/ba61-lp1098699-fix_clieop_rounding_issue into lp:banking-addons.

Requested reviews:
  Banking Addons Team (banking-addons-team)
Related bugs:
  Bug #1098699 in Banking Addons: "[nl_clieop] Rounding difference in payment export lines"
  https://bugs.launchpad.net/banking-addons/+bug/1098699

For more details, see:
https://code.launchpad.net/~therp-nl/banking-addons/ba61-lp1098699-fix_clieop_rounding_issue/+merge/142978

This branch fixes a rounding issue in the "clieop" export, which contains the amount encoded without the comma separator between euros and cents, i.e. as an integer. Amounts like €1,05 come out as €1,04 due to the internal Python representation of 100 * 1,05 as 104,99999999999. Using round() will thus give better results than int().
-- 
https://code.launchpad.net/~therp-nl/banking-addons/ba61-lp1098699-fix_clieop_rounding_issue/+merge/142978
Your team Banking Addons Team is requested to review the proposed merge of lp:~therp-nl/banking-addons/ba61-lp1098699-fix_clieop_rounding_issue into lp:banking-addons.
=== modified file 'account_banking_nl_clieop/wizard/clieop.py'
--- account_banking_nl_clieop/wizard/clieop.py	2011-07-21 11:30:59 +0000
+++ account_banking_nl_clieop/wizard/clieop.py	2013-01-11 19:50:46 +0000
@@ -278,7 +278,7 @@
         self.transaction.transactiontype = type_
         self.transaction.accountno_beneficiary = accountno_beneficiary
         self.transaction.accountno_payer = accountno_payer
-        self.transaction.amount = int(amount * 100)
+        self.transaction.amount = round(amount * 100)
         if reference:
             self.paymentreference.paymentreference = reference
         # Allow long message lines to redistribute over multiple message


Follow ups