[Erp5-report] r32278 kazuhiko - /erp5/trunk/products/ERP5/MovementCollectionDiff.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Feb 5 09:38:48 CET 2010
Author: kazuhiko
Date: Fri Feb 5 09:38:47 2010
New Revision: 32278
URL: http://svn.erp5.org?rev=32278&view=rev
Log:
do not include acquired categories when copying values from temporary simulation movement.
Modified:
erp5/trunk/products/ERP5/MovementCollectionDiff.py
Modified: erp5/trunk/products/ERP5/MovementCollectionDiff.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/MovementCollectionDiff.py?rev=32278&r1=32277&r2=32278&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/MovementCollectionDiff.py [utf8] (original)
+++ erp5/trunk/products/ERP5/MovementCollectionDiff.py [utf8] Fri Feb 5 09:38:47 2010
@@ -88,7 +88,9 @@
"""
property_dict = self._property_dict_dict.get(movement)
if property_dict is None:
- return _getPropertyAndCategoryList(movement)
+ property_dict = _getPropertyList(movement)
+ property_dict.update(_getCategoryList(movement, acquire=False))
+ return property_dict
else:
return property_dict
@@ -106,9 +108,14 @@
Returns a dict that includes all property values, based on property
sheet configuration and all category values.
"""
+ property_dict = {}
+ property_dict.update(_getPropertyList(document))
+ property_dict.update(_getCategoryList(document))
+ return property_dict
+
+def _getPropertyList(document, acquire=True):
property_map = document.getPropertyMap()
bad_property_list = ['id', 'uid', 'categories_list', 'int_index', 'last_id',]
- bad_category_list = ['solver',]
# we don't want acquired properties without acquisition_mask_value
for x in property_map:
if x.has_key('acquisition_base_category') and not x.get('acquisition_mask_value', 0):
@@ -133,20 +140,25 @@
default = default_value_dict[key]
if value == default:
return False
+ if not acquire and not document.hasProperty(key):
+ return False
if isinstance(value, (list, tuple)) and \
isinstance(default, (list, tuple)) and \
tuple(value) == tuple(default):
return False
return True
- property_dict = dict(filter(filter_property_func,
- [(x, getter_dict[x](x)) for x in \
- document.getPropertyIdList()]))
+ return dict(filter(filter_property_func,
+ [(x, getter_dict[x](x)) for x in \
+ document.getPropertyIdList()]))
+def _getCategoryList(document, acquire=True):
+ bad_category_list = ['solver',]
+ getPropertyList = document.getPropertyList
def filter_category_func(x):
- return len(x[1]) != 0 and x[0] not in bad_category_list
+ return len(x[1]) != 0 and x[0] not in bad_category_list and \
+ (acquire or document.hasProperty(x[0]))
- property_dict.update(dict(filter(filter_category_func,
- [(x, getPropertyList(x)) for x in \
- document.getBaseCategoryList()])))
- return property_dict
+ return dict(filter(filter_category_func,
+ [(x, getPropertyList(x)) for x in \
+ document.getBaseCategoryList()]))
More information about the Erp5-report
mailing list