Commit 4a167c02 authored by Nicolas Delaby's avatar Nicolas Delaby

always convert in float

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21301 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 977ada81
...@@ -794,12 +794,12 @@ class Resource(XMLMatrix, Variated): ...@@ -794,12 +794,12 @@ class Resource(XMLMatrix, Variated):
if management_unit == quantity_unit: if management_unit == quantity_unit:
return 1.0 return 1.0
traverse = self.portal_categories['quantity_unit'].unrestrictedTraverse traverse = self.portal_categories['quantity_unit'].unrestrictedTraverse
quantity = traverse(quantity_unit).getProperty('quantity') quantity = float(traverse(quantity_unit).getProperty('quantity'))
if quantity_unit.split('/', 1)[0] != management_unit.split('/', 1)[0]: if quantity_unit.split('/', 1)[0] != management_unit.split('/', 1)[0]:
measure = self.getDefaultMeasure(quantity_unit) measure = self.getDefaultMeasure(quantity_unit)
quantity /= measure.getConvertedQuantity(variation_list) quantity /= measure.getConvertedQuantity(variation_list)
else: else:
quantity /= traverse(management_unit).getProperty('quantity') quantity /= float(traverse(management_unit).getProperty('quantity'))
return quantity return quantity
# Unit conversion # Unit conversion
......
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