[Erp5-report] r34527 kazuhiko - in /erp5/trunk/products: ERP5/Document/ ERP5/mixin/ ERP5Leg...
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Apr 13 18:48:37 CEST 2010
Author: kazuhiko
Date: Tue Apr 13 18:48:31 2010
New Revision: 34527
URL: http://svn.erp5.org?rev=34527&view=rev
Log:
make category calculation through Business Path much faster.
Modified:
erp5/trunk/products/ERP5/Document/BusinessPath.py
erp5/trunk/products/ERP5/Document/TradeModelLine.py
erp5/trunk/products/ERP5/mixin/movement_generator.py
erp5/trunk/products/ERP5Legacy/Document/Rule.py
Modified: erp5/trunk/products/ERP5/Document/BusinessPath.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BusinessPath.py?rev=34527&r1=34526&r2=34527&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessPath.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BusinessPath.py [utf8] Tue Apr 13 18:48:31 2010
@@ -141,6 +141,22 @@
#'destination_transport'
)
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getArrowCategoryDict')
+ def getArrowCategoryDict(self, context=None, **kw):
+ result = {}
+ dynamic_category_list = self._getDynamicCategoryList(context)
+ for base_category in self.getSourceArrowBaseCategoryList() +\
+ self.getDestinationArrowBaseCategoryList():
+ category_url_list = Path._getAcquiredCategoryMembershipList(
+ self, base_category, **kw)
+ if len(category_url_list) == 0 and context is not None:
+ category_url_list = self._filterCategoryList(dynamic_category_list,
+ base_category, **kw)
+ if len(category_url_list) > 0:
+ result[base_category] = category_url_list
+ return result
+
# ICategoryAccessProvider overridden methods
def _getCategoryMembershipList(self, category, **kw):
"""
Modified: erp5/trunk/products/ERP5/Document/TradeModelLine.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TradeModelLine.py?rev=34527&r1=34526&r2=34527&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TradeModelLine.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TradeModelLine.py [utf8] Tue Apr 13 18:48:31 2010
@@ -221,26 +221,20 @@
if len(business_path_list) == 1:
business_path = business_path_list[0]
property_dict={
- 'source_value_list': business_path.getSourceValueList(context=context),
- 'destination_value_list':
- business_path.getDestinationValueList(context=context),
- 'source_section_value_list':
- business_path.getSourceSectionValueList(context=context),
- 'destination_section_value_list':
- business_path.getDestinationSectionValueList(context=context),
- 'source_decision_value_list':
- business_path.getSourceDecisionValueList(context=context),
- 'source_administration_value_list':
- business_path.getSourceAdministrationValueList(context=context),
- 'source_payment_value_list':
- business_path.getSourcePaymentValueList(context=context),
- 'destination_decision_value_list':
- business_path.getDestinationDecisionValueList(context=context),
- 'destination_administration_value_list':
- business_path.getDestinationAdministrationValueList(context=context),
- 'destination_payment_value_list':
- business_path.getDestinationPaymentValueList(context=context)
+ 'source':context.getSourceList(),
+ 'destination':context.getDestinationList(),
+ 'source_section':context.getSourceSectionList(),
+ 'destination_section':context.getDestinationSectionList(),
+ 'source_decision':context.getSourceDecisionList(),
+ 'source_administration':context.getSourceAdministrationList(),
+ 'source_payment':context.getSourcePaymentList(),
+ 'destination_decision':context.getDestinationDecisionList(),
+ 'destination_administration':
+ context.getDestinationAdministrationList(),
+ 'destination_payment':context.getDestinationPaymentList()
}
+ property_dict.update(
+ business_path.getArrowCategoryDict(context=context))
common_params = {
'title':self.getTitle(),
Modified: erp5/trunk/products/ERP5/mixin/movement_generator.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/mixin/movement_generator.py?rev=34527&r1=34526&r2=34527&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/mixin/movement_generator.py [utf8] (original)
+++ erp5/trunk/products/ERP5/mixin/movement_generator.py [utf8] Tue Apr 13 18:48:31 2010
@@ -96,13 +96,10 @@
return property_dict
# Arrow
- for base_category in \
- business_path.getSourceArrowBaseCategoryList() +\
- business_path.getDestinationArrowBaseCategoryList():
- category_url = business_path.getDefaultAcquiredCategoryMembership(
- base_category, context=movement)
- if category_url not in ['', None]:
- property_dict[base_category] = [category_url]
+ for base_category, category_url_list in \
+ business_path.getArrowCategoryDict(context=movement).iteritems():
+ property_dict[base_category] = category_url_list
+
# Amount
if business_path.getQuantity():
property_dict['quantity'] = business_path.getQuantity()
Modified: erp5/trunk/products/ERP5Legacy/Document/Rule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Legacy/Document/Rule.py?rev=34527&r1=34526&r2=34527&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Legacy/Document/Rule.py [utf8] (original)
+++ erp5/trunk/products/ERP5Legacy/Document/Rule.py [utf8] Tue Apr 13 18:48:31 2010
@@ -558,14 +558,9 @@
return property_dict
# Arrow
- for base_category in \
- business_path.getSourceArrowBaseCategoryList() +\
- business_path.getDestinationArrowBaseCategoryList():
- # XXX: we need to use _list for categories *always*
- category_url = business_path.getDefaultAcquiredCategoryMembership(
- base_category, context=movement)
- if category_url not in ['', None]:
- property_dict['%s_list' % base_category] = [category_url]
+ for base_category, category_url_list in \
+ business_path.getArrowCategoryDict(context=movement).iteritems():
+ property_dict['%s_list' % base_category] = category_url_list
# Amount
property_dict['quantity'] = business_path.getExpectedQuantity(movement)
More information about the Erp5-report
mailing list