Quintiq file version 2.0
#parent: #root
Method New (
  FormInventoryTargets formInventoryTargets
) id:Method_DialogCreateEditInventoryTarget_New
{
  #keys: '[139394.1.922899889]'
  Body:
  [*
    // New inventory target
    
    owner :=  ApplicationMacroPlanner.DataHolderProduct().Data().First();
    stockingpoint := ApplicationMacroPlanner.DataHolderStockingPoint().Data().First();
    
    data := owner.InventorySpecification( relshadow,
                                          ProductID := owner.ID(),
                                          StockingPointID := stockingpoint.ID(),
                                          StockingPoint_MP := stockingpoint,
                                          ProductInStockingPoint_MP := owner.FindProductInStockingPoint( stockingpoint.ID() ),
                                          Start := MacroPlan.StartOfPlanning().Date() );
    
    DataHolderForm.Data( formInventoryTargets );
    DataHolderDialogData.Data( &data );
    // set stocking point and product to dataholder to be use by OnUserUpdateUI method
    DataHolderProduct.Data( DataHolderDialogData.Data().Product_MP() );
    DataHolderStockingPoint.Data(DataHolderDialogData.Data().StockingPoint_MP() );
    this.InitializeComponents( false /*isbatchedit*/ );
    
    ApplicationMacroPlanner.ShowFormModal( this );
  *]
}
