Commit fd530345 authored by Yusuke Muraoka's avatar Yusuke Muraoka

- reverted wrong changes since after rev.26461(ProductionOrderRule) and...

- reverted wrong changes since after rev.26461(ProductionOrderRule) and rev.22242(Transformation*Rule) without the changed definition of interfaces
- added relation, which refer to trade_phase, to the TransformedResource


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27562 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 493c9916
...@@ -30,11 +30,12 @@ from AccessControl import ClassSecurityInfo ...@@ -30,11 +30,12 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces
from Products.ERP5.Document.Rule import Rule from Products.ERP5.Document.Rule import Rule
from Products.ERP5.Document.OrderRule import OrderRule from Products.ERP5.Document.OrderRule import OrderRule
from Products.ERP5.Document.TransformationRule import TransformationRuleMixin from Products.ERP5.Document.TransformationSourcingRule import\
TransformationSourcingRuleMixin
from zLOG import LOG, WARNING from zLOG import LOG, WARNING
class ProductionOrderRule(TransformationRuleMixin, OrderRule): class ProductionOrderRule(OrderRule):
""" """
Prouction Order Rule object use a Supply Chain to expand a Prouction Order Rule object use a Supply Chain to expand a
Production Order. Production Order.
...@@ -48,6 +49,9 @@ class ProductionOrderRule(TransformationRuleMixin, OrderRule): ...@@ -48,6 +49,9 @@ class ProductionOrderRule(TransformationRuleMixin, OrderRule):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
__implements = ( interfaces.IPredicate,
interfaces.IRule )
# Default Properties # Default Properties
property_sheets = ( PropertySheet.Base property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject , PropertySheet.XMLObject
...@@ -89,17 +93,25 @@ class ProductionOrderRule(TransformationRuleMixin, OrderRule): ...@@ -89,17 +93,25 @@ class ProductionOrderRule(TransformationRuleMixin, OrderRule):
'quantity_unit', 'quantity_unit',
) )
root_explanation = self.getRootExplanation( supply_chain = self.getSupplyChain(applied_rule)
self.getBusinessProcess(applied_rule=applied_rule)) # We got a supply chain
property_dict['source_section'] = root_explanation.getSourceSection() # Try to get the last SupplyLink
source_method_id = root_explanation.getSourceMethodId() last_link = supply_chain.getLastLink()
if source_method_id is None: # We got a valid industrial_phase
property_dict['source'] = root_explanation.getSource() # Now, we have to generate Simulation Movement, in order to
else: # create a ProductionPackingList.
property_dict['source'] = getattr(root_explanation, source_method_id)() destination_node = last_link.getDestinationValue()
property_dict['causality'] = root_explanation.getRelativeUrl() source_value = destination_node.getDestination()
source_section_value = last_link.getDestinationSection()
if source_value is not None:
property_dict["source"] = source_value
if source_section_value is not None:
property_dict["source_section"] = source_section_value
for prop in default_property_list: for prop in default_property_list:
property_dict[prop] = movement.getProperty(prop) property_dict[prop] = movement.getProperty(prop)
return property_dict return property_dict
from Products.ERP5Type.Utils import monkeyPatch
monkeyPatch(TransformationSourcingRuleMixin, ProductionOrderRule)
This diff is collapsed.
...@@ -322,7 +322,11 @@ class TransformedResource(Predicate, XMLObject, XMLMatrix, Amount): ...@@ -322,7 +322,11 @@ class TransformedResource(Predicate, XMLObject, XMLMatrix, Amount):
else: else:
variation_category_list = self._getVariationCategoryList() variation_category_list = self._getVariationCategoryList()
variation_category_list_defined_by = self.getRelativeUrl() variation_category_list_defined_by = self.getRelativeUrl()
if hasattr(self,"getTradePhase"):
# After installing BPM, trade_phase category to be exists
trade_phase = self.getTradePhase() trade_phase = self.getTradePhase()
else:
trade_phase = None
# Store values in Amount # Store values in Amount
tmp_amount._edit( tmp_amount._edit(
# Properties define on transformation line # Properties define on transformation line
......
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