From 424201ea1694c0d0cf66e5ef59701afcee21b80b Mon Sep 17 00:00:00 2001 From: Vincent Pelletier <vincent@nexedi.com> Date: Mon, 24 Dec 2007 13:39:11 +0000 Subject: [PATCH] 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. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18489 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../ExtensionTemplateItem/CheckbookReceptionImport.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bt5/erp5_banking_check/ExtensionTemplateItem/CheckbookReceptionImport.py b/bt5/erp5_banking_check/ExtensionTemplateItem/CheckbookReceptionImport.py index 3a6b18dc2f..5e753b4e8e 100644 --- a/bt5/erp5_banking_check/ExtensionTemplateItem/CheckbookReceptionImport.py +++ b/bt5/erp5_banking_check/ExtensionTemplateItem/CheckbookReceptionImport.py @@ -17,10 +17,10 @@ def CheckbookReception_importItemFile(self, import_file=None, REQUEST=None, **kw #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 @@ def CheckbookReception_importItemFile(self, import_file=None, REQUEST=None, **kw 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(): -- 2.30.9