[Erp5-report] r27678 - /erp5/trunk/products/ERP5/Document/TradeModelLine.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Jun 19 13:07:43 CEST 2009
Author: fabien
Date: Fri Jun 19 13:07:39 2009
New Revision: 27678
URL: http://svn.erp5.org?rev=27678&view=rev
Log:
set some categories on the movement using business path.
In this way, it's possible define that for a precise trade_phase, a precise source and destination will be set on movements.
Modified:
erp5/trunk/products/ERP5/Document/TradeModelLine.py
Modified: erp5/trunk/products/ERP5/Document/TradeModelLine.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TradeModelLine.py?rev=27678&r1=27677&r2=27678&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TradeModelLine.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TradeModelLine.py [utf8] Fri Jun 19 13:07:39 2009
@@ -133,6 +133,51 @@
# having cells
update = 1
else:
+ # get source and destination using Business Process
+ document = self.getParentValue()
+ if getattr(document, 'findSpecialiseValueList', None) is None:
+ # if parent don't have findSpecialiseValueList, this mean it's on the
+ # specialise_value
+ document = self.getParentValue().getSpecialiseValue()
+ business_process_list = document.findSpecialiseValueList(\
+ context=self, portal_type_list=['Business Process'])
+ business_process = None
+ property_dict = {}
+ if len(business_process_list):
+ # XXX currently, is too complicated to use more than
+ # one Business Process, so the first (which is the nearest from the
+ # delivery) is took
+ business_process = business_process_list[0]
+ business_path_list = business_process.getPathValueList(trade_phase=\
+ self.getTradePhase())
+ if len(business_path_list) > 1:
+ raise NotImplementedError, 'For now, it can not support more '\
+ 'than one business_path with same trade_phase. '\
+ '%s have same trade_phase' % repr(business_path_list)
+ 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)
+ }
+
common_params = {
'causality': self.getRelativeUrl(),
'resource': self.getResource(),
@@ -144,6 +189,8 @@
'create_line': self.isCreateLine(),
'trade_phase_list': self.getTradePhaseList(),
}
+ common_params.update(property_dict)
+
update = 0
base_category_list = self.getVariationBaseCategoryList()
category_list_list = []
More information about the Erp5-report
mailing list