Commit 424201ea authored by Vincent Pelletier's avatar Vincent Pelletier

XML values for quantity and check_quantity can be "1.0", so to get an integer...

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
parent aab846df
...@@ -17,10 +17,10 @@ def CheckbookReception_importItemFile(self, import_file=None, REQUEST=None, **kw ...@@ -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,)) #self.log("import checkbook", "file_item_list = %s" %(file_item_list,))
for item in file_item_list: for item in file_item_list:
checkbook_id = item.xpath("string(@id)") 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_min = str(item.xpath("string(./reference_min)"))
reference_max = str(item.xpath("string(./reference_max)")) 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)") internal_account_number = item.xpath("string(./numero_interne)")
checkbook_type = item.xpath("string(./checkbook_type)") checkbook_type = item.xpath("string(./checkbook_type)")
type = str(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 ...@@ -53,7 +53,7 @@ def CheckbookReception_importItemFile(self, import_file=None, REQUEST=None, **kw
if is_checkbook: if is_checkbook:
for amount in resource.objectValues( for amount in resource.objectValues(
portal_type="Checkbook Model Check Amount Variation"): 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() amount.getRelativeUrl()
for (account, account_dict) in checkbook_dict.items(): for (account, account_dict) in checkbook_dict.items():
for (gid, item_dict) in account_dict.items(): for (gid, item_dict) in account_dict.items():
......
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