[Erp5-report] r17389 - in /erp5/trunk/bt5/erp5_accounting: WorkflowTemplateItem/portal_work...

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Nov 5 16:54:03 CET 2007


Author: jerome
Date: Mon Nov  5 16:54:02 2007
New Revision: 17389

URL: http://svn.erp5.org?rev=17389&view=rev
Log:
When checking debit == credit, use the currency precision from section's price currencies

Modified:
    erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransactionLines.xml
    erp5/trunk/bt5/erp5_accounting/bt/revision

Modified: erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransactionLines.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransactionLines.xml?rev=17389&r1=17388&r2=17389&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransactionLines.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransactionLines.xml Mon Nov  5 16:54:02 2007
@@ -222,12 +222,22 @@
                                  \'bank_account_currency\':\n
                      unicode(payment.getPriceCurrencyReference(), \'utf8\')})\n
     \n
-  # TODO: should use currency precision instead of hardcoding 100 !\n
-  if int(source_sum*100) != 0:\n
+  source_precision = destination_precision = 2\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
             \'Action failed: transaction is not balanced for source section.\')\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
         \'Action failed: transaction is not balanced for destination section.\')\n
 \n
@@ -326,7 +336,11 @@
                             <string>third_party</string>
                             <string>unicode</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>
                         </value>
                     </item>

Modified: erp5/trunk/bt5/erp5_accounting/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/bt/revision?rev=17389&r1=17388&r2=17389&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/bt/revision (original)
+++ erp5/trunk/bt5/erp5_accounting/bt/revision Mon Nov  5 16:54:02 2007
@@ -1,1 +1,1 @@
-481
+487




More information about the Erp5-report mailing list