[Erp5-report] r37250 nicolas.dumazet - /erp5/trunk/products/ERP5/Document/Measure.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Jul 23 08:19:23 CEST 2010
Author: nicolas.dumazet
Date: Fri Jul 23 08:19:22 2010
New Revision: 37250
URL: http://svn.erp5.org?rev=37250&view=rev
Log:
Fix indexation of default Measures now that quantity_unit is
not anymore acquired by Measures from the Resource
Modified:
erp5/trunk/products/ERP5/Document/Measure.py
Modified: erp5/trunk/products/ERP5/Document/Measure.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Measure.py?rev=37250&r1=37249&r2=37250&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Measure.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Measure.py [utf8] Fri Jul 23 08:19:22 2010
@@ -168,7 +168,22 @@ class Measure(XMLMatrix):
Returns the list of rows to insert in the measure table of the catalog.
Called by Resource.getMeasureRowList.
"""
+ # The only purpose of the defining a default measure explicitly is to
+ # set a specific metric_type for the management unit.
+ # Therefore, the measure mustn't be variated and the described quantity
+ # (quantity * quantity_unit) must match the management unit.
+ # If the conditions aren't met, return an empty list.
+ default = self.isDefaultMeasure()
+
+ resource = self.getResourceValue()
+ resource_uid = resource.getUid()
+
quantity_unit_value = self.getQuantityUnitValue()
+ if default and quantity_unit_value is None:
+ # for default measure candidates, we do not care if the
+ # quantity is not set: use the resource quantity unit!
+ quantity_unit_value = resource.getQuantityUnitValue()
+
metric_type = self.getMetricType()
if quantity_unit_value is None or not metric_type or \
quantity_unit_value.getParentId() != metric_type.split('/', 1)[0]:
@@ -187,8 +202,6 @@ class Measure(XMLMatrix):
return None
uid = self.getUid()
- resource = self.getResourceValue()
- resource_uid = resource.getUid()
metric_type_uid = self.getMetricTypeUid()
quantity = self.getQuantity()
@@ -196,13 +209,6 @@ class Measure(XMLMatrix):
if quantity_unit is None:
return ()
- # The only purpose of the defining a default measure explicitly is to
- # set a specific metric_type for the management unit.
- # Therefore, the measure mustn't be variated and the described quantity
- # (quantity * quantity_unit) must match the management unit.
- # If the conditions aren't met, return an empty list.
- default = self.isDefaultMeasure()
-
measure_variation_base_category_list = \
self.getMeasureVariationBaseCategoryList()
if not measure_variation_base_category_list:
More information about the Erp5-report
mailing list