Commit c8de7eb1 authored by Jérome Perrin's avatar Jérome Perrin

When checking debit == credit, use the currency precision from section's price currencies

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17389 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 05b35969
...@@ -222,12 +222,22 @@ if transaction.getPortalType() not in (\'Balance Transaction\',) :\n ...@@ -222,12 +222,22 @@ if transaction.getPortalType() not in (\'Balance Transaction\',) :\n
\'bank_account_currency\':\n \'bank_account_currency\':\n
unicode(payment.getPriceCurrencyReference(), \'utf8\')})\n unicode(payment.getPriceCurrencyReference(), \'utf8\')})\n
\n \n
# TODO: should use currency precision instead of hardcoding 100 !\n source_precision = destination_precision = 2\n
if int(source_sum*100) != 0:\n if source_section is not None and\\\n
source_section.getPortalType() == \'Organisation\':\n
source_currency = source_section.getPriceCurrencyValue()\n
if source_currency is not None:\n
source_precision = source_currency.getQuantityPrecision()\n
if round(source_sum, source_precision) != 0:\n
raise ValidationFailed, N_(\n raise ValidationFailed, N_(\n
\'Action failed: transaction is not balanced for source section.\')\n \'Action failed: transaction is not balanced for source section.\')\n
\n \n
if int(destination_sum*100) != 0:\n if destination_section is not None and\\\n
destination_section.getPortalType() == \'Organisation\':\n
destination_currency = destination_section.getPriceCurrencyValue()\n
if destination_currency is not None:\n
destination_precision = destination_currency.getQuantityPrecision()\n
if round(destination_sum, destination_precision) != 0:\n
raise ValidationFailed, N_(\n raise ValidationFailed, N_(\n
\'Action failed: transaction is not balanced for destination section.\')\n \'Action failed: transaction is not balanced for destination section.\')\n
\n \n
...@@ -326,7 +336,11 @@ transaction.AccountingTransaction_deleteEmptyLines(redirect=0)\n ...@@ -326,7 +336,11 @@ transaction.AccountingTransaction_deleteEmptyLines(redirect=0)\n
<string>third_party</string> <string>third_party</string>
<string>unicode</string> <string>unicode</string>
<string>bank_account_currency</string> <string>bank_account_currency</string>
<string>int</string> <string>source_precision</string>
<string>destination_precision</string>
<string>source_currency</string>
<string>round</string>
<string>destination_currency</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
481 487
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment