Quintiq file version 2.0
#parent: ListEntityTreeInPanel
Response OnClick (
  structured[Entity] selection
) id:Response_ListEntityTreeInPanel_MenuSmartPlanStockingPoint_OnClick
{
  #keys: '[127710.1.1015004041]'
  Body:
  [*
    // Smart plan for PISPIPs in stocking points
    dlg := construct( DialogSmartPlan );
    isviableonestepupstream := false;
    sps := selectset( selection, Elements.astype( StockingPoint_MP ), sp, true, true );
    dlg.SmartPlan( sps, this, isviableonestepupstream );
  *]
  CanBindMultiple: false
  DefinitionID => //ListUnitTree/Responsedef_ListUnitTree_Menu_OnClick
  Initiator: 'MenuSmartPlanStockingPoint'
  Precondition:
  [*
    // returns false when all the selected records are units.
    feedback := Translations::MP_Designer_ListEntity_CanSmartPlan();
    return not forall( selection, Elements, e, true, e.istype( Unit ) ) 
           and MacroPlan.CanPlan( feedback )
           and ScenarioManager::CanStartSmartPlan( ScenarioManager, SelectionScenario.Data(), true, feedback );
  *]
}
