simulation: The parent SM may have several BLs as 'causality'.
Necessary for a customer project using Real Time Inventory Accounting. No Unit Test yet as I wanted to know if this really should be done this way before going forward. No related Unit Tests failures: https://nexedi.erp5.net/test_result_module/20180920-5E024FF4
Simulation Tree:
- SM_PPL
- AR(Inventory Accounting Transaction)
- SM_IAT(ledger=A)
- SM_IAT(ledger=B)
- AR(Inventory Accounting Transaction)
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.