Commit dfb5f28b authored by Julien Muchembled's avatar Julien Muchembled

Finish r21301 (always convert in float).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21303 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 148c6c06
...@@ -132,7 +132,7 @@ class Measure(XMLMatrix): ...@@ -132,7 +132,7 @@ class Measure(XMLMatrix):
metric_type = self.getMetricType() metric_type = self.getMetricType()
if quantity_unit is not None and metric_type and \ if quantity_unit is not None and metric_type and \
quantity_unit.getParentId() == metric_type.split('/', 1)[0]: quantity_unit.getParentId() == metric_type.split('/', 1)[0]:
return quantity_unit.getProperty('quantity') return float(quantity_unit.getProperty('quantity'))
security.declareProtected(AccessContentsInformation, 'getConvertedQuantity') security.declareProtected(AccessContentsInformation, 'getConvertedQuantity')
def getConvertedQuantity(self, variation_list=()): def getConvertedQuantity(self, variation_list=()):
...@@ -190,7 +190,7 @@ class Measure(XMLMatrix): ...@@ -190,7 +190,7 @@ class Measure(XMLMatrix):
if quantity is not None: if quantity is not None:
quantity *= quantity_unit quantity *= quantity_unit
if (not default or quantity == if (not default or quantity ==
resource.getQuantityUnitValue().getProperty('quantity')): float(resource.getQuantityUnitValue().getProperty('quantity'))):
return (uid, resource_uid, '^', metric_type_uid, quantity), return (uid, resource_uid, '^', metric_type_uid, quantity),
return () return ()
......
...@@ -887,7 +887,7 @@ class Resource(XMLMatrix, Variated): ...@@ -887,7 +887,7 @@ class Resource(XMLMatrix, Variated):
# At this point, we know there is no default measure and we must add # At this point, we know there is no default measure and we must add
# a row for the management unit, with the resource's uid as uid, and # a row for the management unit, with the resource's uid as uid, and
# a generic metric_type. # a generic metric_type.
quantity = quantity_unit_value.getProperty('quantity') quantity = float(quantity_unit_value.getProperty('quantity'))
metric_type_uid = self.getPortalObject().portal_categories \ metric_type_uid = self.getPortalObject().portal_categories \
.getCategoryUid(metric_type, 'metric_type') .getCategoryUid(metric_type, 'metric_type')
if quantity and metric_type_uid: if quantity and metric_type_uid:
......
...@@ -1222,8 +1222,8 @@ class SimulationTool(BaseTool): ...@@ -1222,8 +1222,8 @@ class SimulationTool(BaseTool):
table_alias_list=(("measure", "measure"),)) table_alias_list=(("measure", "measure"),))
if isinstance(quantity_unit, str): if isinstance(quantity_unit, str):
quantity_unit = getCategory(quantity_unit, quantity_unit = float(getCategory(quantity_unit, 'quantity_unit')
'quantity_unit').getProperty('quantity') .getProperty('quantity'))
method = getattr(self,'get%sInventoryList' % simulation_period) method = getattr(self,'get%sInventoryList' % simulation_period)
return method(quantity_unit=quantity_unit, **kw) return method(quantity_unit=quantity_unit, **kw)
......
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