Commit d89813a7 authored by Jean-Paul Smets's avatar Jean-Paul Smets

OpenOrderRule tries to delegate if possible the implementation of expand to...

OpenOrderRule tries to delegate if possible the implementation of expand to the OpenOrderExpander (an OpenOrder or SubscriptionItem subclass) if available. This way, it is easy to encapsulate OpenOrder logic in an Item and combine many different Open Order logic in the same site without touching the code of the Open Order class. For example, Payroll simulation will be implemented by creating an EmploymentContractItem (subsclass of SubscriptionItem) for every worker's contract. The EmploymentContractItem generated in the simulation future Parysheer LInes for work which are themselves expanded using the appropriate Paysheet Model, as defined in the career. 

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26442 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 971e6270
......@@ -32,7 +32,6 @@ from Products.ERP5.Document.DeliveryRule import DeliveryRule
from zLOG import LOG, WARNING
from DateTime import DateTime
class OpenOrderRule(DeliveryRule):
"""
Order Rule object make sure an Order in the simulation
......@@ -73,8 +72,12 @@ class OpenOrderRule(DeliveryRule):
delivered child, and is in order, it can be modified.
Else, it cannot be modified.
"""
movement_type = 'Simulation Movement'
order = applied_rule.getDefaultCausalityValue()
if getattr(order, 'expandOpenOrderRule', None) is not None:
# Delegate implementation of expand to the SubscriptionItem or
# to the OpenOrder instance
return order.expandOpenOrderRule(applied_rule, force=force, **kw)
movement_type = 'Simulation Movement'
if order is not None:
order_movement_list = order.getMovementList(
portal_type=order.getPortalOrderMovementTypeList())
......
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