[Erp5-report] r18489 - /erp5/trunk/bt5/erp5_banking_check/ExtensionTemplateItem/

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Dec 24 14:39:11 CET 2007


Author: vincent
Date: Mon Dec 24 14:39:11 2007
New Revision: 18489

URL: http://svn.erp5.org?rev=18489&view=rev
Log:
XML values for quantity and check_quantity can be "1.0", so to get an integer it must be converted first to a float.
Remove extra string cast, use original int instead.

Modified:
    erp5/trunk/bt5/erp5_banking_check/ExtensionTemplateItem/CheckbookReceptionImport.py

Modified: erp5/trunk/bt5/erp5_banking_check/ExtensionTemplateItem/CheckbookReceptionImport.py
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_check/ExtensionTemplateItem/CheckbookReceptionImport.py?rev=18489&r1=18488&r2=18489&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_check/ExtensionTemplateItem/CheckbookReceptionImport.py (original)
+++ erp5/trunk/bt5/erp5_banking_check/ExtensionTemplateItem/CheckbookReceptionImport.py Mon Dec 24 14:39:11 2007
@@ -17,10 +17,10 @@
   #self.log("import checkbook", "file_item_list = %s" %(file_item_list,))
   for item in file_item_list:
     checkbook_id = item.xpath("string(@id)")
-    check_quantity = str(item.xpath("string(./check_quantity)"))
+    check_quantity = int(float(item.xpath("string(./check_quantity)")))
     reference_min = str(item.xpath("string(./reference_min)"))
     reference_max = str(item.xpath("string(./reference_max)"))
-    quantity = str(item.xpath("string(./quantity)"))
+    quantity = int(float(item.xpath("string(./quantity)")))
     internal_account_number = item.xpath("string(./numero_interne)")
     checkbook_type = item.xpath("string(./checkbook_type)")
     type = str(item.xpath("string(./checkbook_type)"))
@@ -53,7 +53,7 @@
     if is_checkbook:
       for amount in resource.objectValues(
           portal_type="Checkbook Model Check Amount Variation"):
-        resource_amount_dict["%i" % amount.getQuantity()] = "check_amount/%s" % \
+        resource_amount_dict[int(amount.getQuantity())] = "check_amount/%s" % \
                                                        amount.getRelativeUrl()
     for  (account, account_dict) in checkbook_dict.items():
       for (gid, item_dict) in account_dict.items():




More information about the Erp5-report mailing list