Commit 009a3412 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

make _getPropertyAndCategoryList() usable from outside.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31194 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1bbae412
...@@ -103,12 +103,12 @@ class MovementCollectionDiff(object): ...@@ -103,12 +103,12 @@ class MovementCollectionDiff(object):
self._updatable_movement_list.append(movement) self._updatable_movement_list.append(movement)
self._property_dict_dict[movement] = property_dict self._property_dict_dict[movement] = property_dict
def _getPropertyAndCategoryList(self, movement): def _getPropertyAndCategoryList(document):
""" """
Returns a dict that includes all property values, based on property Returns a dict that includes all property values, based on property
sheet configuration and all category values. sheet configuration and all category values.
""" """
property_map = movement.getPropertyMap() property_map = document.getPropertyMap()
bad_property_list = ['id', 'uid', 'categories_list', 'int_index'] bad_property_list = ['id', 'uid', 'categories_list', 'int_index']
# we don't want acquired properties without acquisition_mask_value # we don't want acquired properties without acquisition_mask_value
for x in property_map: for x in property_map:
...@@ -117,8 +117,8 @@ class MovementCollectionDiff(object): ...@@ -117,8 +117,8 @@ class MovementCollectionDiff(object):
default_value_dict = dict([(x['id'], x.get('default', None)) \ default_value_dict = dict([(x['id'], x.get('default', None)) \
for x in property_map]) for x in property_map])
getPropertyList = movement.getPropertyList getPropertyList = document.getPropertyList
getProperty = movement.getProperty getProperty = document.getProperty
getter_list_type_dict = { getter_list_type_dict = {
True:getPropertyList, True:getPropertyList,
False:getProperty False:getProperty
...@@ -142,16 +142,12 @@ class MovementCollectionDiff(object): ...@@ -142,16 +142,12 @@ class MovementCollectionDiff(object):
property_dict = dict(filter(filter_property_func, property_dict = dict(filter(filter_property_func,
[(x, getter_dict[x](x)) for x in \ [(x, getter_dict[x](x)) for x in \
movement.getPropertyIdList()])) document.getPropertyIdList()]))
def filter_category_func(x): def filter_category_func(x):
return len(x[1]) != 0 return len(x[1]) != 0
property_dict.update(dict(filter(filter_category_func, property_dict.update(dict(filter(filter_category_func,
[(x, getPropertyList(x)) for x in \ [(x, getPropertyList(x)) for x in \
movement.getBaseCategoryList()]))) document.getBaseCategoryList()])))
# update order category if exist
order = getattr(aq_base(movement), 'order', None)
if order is not None:
property_dict['order'] = order
return property_dict return property_dict
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