Commit 3f4c8e91 authored by Arnaud Fontaine's avatar Arnaud Fontaine

simulation: The parent SM may have several BLs as 'causality'.

Simulation Tree:
  SM_PPL
    AR(Inventory Accounting Transaction)
      SM_IAT(ledger=A)
      SM_IAT(ledger=B)

Where SM_IAT.isBuildable() returns True iff:
  * SM_IAT(ledger=A): SM_PPL delivery state == 'started' (Shipped).
  * SM_IAT(ledger=B): SM_PPL delivery state == 'stopped' (Received).

Defining this in a single BP lead to the following Business Links:
  * BL_PPL_started:
    - predecessor=trade/ordered
    - successor=trade/delivery_started
    - completed_state_list=['started']
    - trade_phase=trade/delivery
  * BL_IAT_ledger_A:
    - predecessor=trade/delivery_started
    - successor=trade/inventory_accounted
    - trade_phase=trade/inventory_accounting
    - predicate: ledger == A

  * BL_PPL_delivered:
    - predecessor=trade/ordered
    - successor=trade/delivered
    - completed_state_list=['stopped', 'delivered']
    - trade_phase=trade/delivery
  * BL_IAT_ledger_B:
    - predecessor=trade/delivered
    - successor=trade/inventory_accounted
    - trade_phase=trade/inventory_accounting
    - predicate: ledger == B

This means that SM_PPL will have both BL_PPL_started and
BBL_PPL_delivered Business Links as causality which was not handled
by isBuildable.

Another solution would have been to add this logic on the Builder
'Simulation Select Method' but IMO this should not be done there.
parent 70653d64
...@@ -571,8 +571,8 @@ class SimulationMovement(PropertyRecordableMixin, Movement, ExplainableMixin): ...@@ -571,8 +571,8 @@ class SimulationMovement(PropertyRecordableMixin, Movement, ExplainableMixin):
causality_dict = {} causality_dict = {}
current = self.getParentValue().getParentValue() current = self.getParentValue().getParentValue()
while current.getPortalType() == "Simulation Movement": while current.getPortalType() == "Simulation Movement":
causality_dict[current.getCausality(portal_type='Business Link')] = \ for causality in current.getCausalityList(portal_type='Business Link'):
current causality_dict[causality] = current
current = current.getParentValue().getParentValue() current = current.getParentValue().getParentValue()
remaining_path_set = set() remaining_path_set = set()
......
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