From dfb5f28b64de1213af4a6deac22eea9350c80e2b Mon Sep 17 00:00:00 2001 From: Julien Muchembled <jm@nexedi.com> Date: Tue, 3 Jun 2008 17:47:21 +0000 Subject: [PATCH] Finish r21301 (always convert in float). git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21303 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/Measure.py | 4 ++-- product/ERP5/Document/Resource.py | 2 +- product/ERP5/Tool/SimulationTool.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/product/ERP5/Document/Measure.py b/product/ERP5/Document/Measure.py index 136e5be661..df4e8fb6b2 100644 --- a/product/ERP5/Document/Measure.py +++ b/product/ERP5/Document/Measure.py @@ -132,7 +132,7 @@ class Measure(XMLMatrix): metric_type = self.getMetricType() if quantity_unit is not None and metric_type and \ quantity_unit.getParentId() == metric_type.split('/', 1)[0]: - return quantity_unit.getProperty('quantity') + return float(quantity_unit.getProperty('quantity')) security.declareProtected(AccessContentsInformation, 'getConvertedQuantity') def getConvertedQuantity(self, variation_list=()): @@ -190,7 +190,7 @@ class Measure(XMLMatrix): if quantity is not None: quantity *= quantity_unit if (not default or quantity == - resource.getQuantityUnitValue().getProperty('quantity')): + float(resource.getQuantityUnitValue().getProperty('quantity'))): return (uid, resource_uid, '^', metric_type_uid, quantity), return () diff --git a/product/ERP5/Document/Resource.py b/product/ERP5/Document/Resource.py index e6842866f3..14017d4261 100644 --- a/product/ERP5/Document/Resource.py +++ b/product/ERP5/Document/Resource.py @@ -887,7 +887,7 @@ class Resource(XMLMatrix, Variated): # 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 generic metric_type. - quantity = quantity_unit_value.getProperty('quantity') + quantity = float(quantity_unit_value.getProperty('quantity')) metric_type_uid = self.getPortalObject().portal_categories \ .getCategoryUid(metric_type, 'metric_type') if quantity and metric_type_uid: diff --git a/product/ERP5/Tool/SimulationTool.py b/product/ERP5/Tool/SimulationTool.py index eb4e4c3efe..3f6bb44ef1 100644 --- a/product/ERP5/Tool/SimulationTool.py +++ b/product/ERP5/Tool/SimulationTool.py @@ -1222,8 +1222,8 @@ class SimulationTool(BaseTool): table_alias_list=(("measure", "measure"),)) if isinstance(quantity_unit, str): - quantity_unit = getCategory(quantity_unit, - 'quantity_unit').getProperty('quantity') + quantity_unit = float(getCategory(quantity_unit, 'quantity_unit') + .getProperty('quantity')) method = getattr(self,'get%sInventoryList' % simulation_period) return method(quantity_unit=quantity_unit, **kw) -- 2.30.9