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
from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces
from Products.ERP5.Document.Rule import Rule
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
class ProductionOrderRule(TransformationRuleMixin, OrderRule):
class ProductionOrderRule(OrderRule):
"""
Prouction Order Rule object use a Supply Chain to expand a
Production Order.
......@@ -48,6 +49,9 @@ class ProductionOrderRule(TransformationRuleMixin, OrderRule):
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
__implements = ( interfaces.IPredicate,
interfaces.IRule )
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
......@@ -89,17 +93,25 @@ class ProductionOrderRule(TransformationRuleMixin, OrderRule):
'quantity_unit',
)
root_explanation = self.getRootExplanation(
self.getBusinessProcess(applied_rule=applied_rule))
property_dict['source_section'] = root_explanation.getSourceSection()
source_method_id = root_explanation.getSourceMethodId()
if source_method_id is None:
property_dict['source'] = root_explanation.getSource()
else:
property_dict['source'] = getattr(root_explanation, source_method_id)()
property_dict['causality'] = root_explanation.getRelativeUrl()
supply_chain = self.getSupplyChain(applied_rule)
# We got a supply chain
# Try to get the last SupplyLink
last_link = supply_chain.getLastLink()
# We got a valid industrial_phase
# Now, we have to generate Simulation Movement, in order to
# create a ProductionPackingList.
destination_node = last_link.getDestinationValue()
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:
property_dict[prop] = movement.getProperty(prop)
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):
else:
variation_category_list = self._getVariationCategoryList()
variation_category_list_defined_by = self.getRelativeUrl()
trade_phase = self.getTradePhase()
if hasattr(self,"getTradePhase"):
# After installing BPM, trade_phase category to be exists
trade_phase = self.getTradePhase()
else:
trade_phase = None
# Store values in Amount
tmp_amount._edit(
# 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