Quintiq file version 2.0
#parent: #root
Method Copy (
  FormStockingCosts formStockingCosts,
  structured[AccountCost] accountCosts
) id:Method_DialogCreateEditStockingCost_Copy
{
  #keys: '[144528.2.67597210]'
  Body:
  [*
    // Copy stocking cost (only allow one)
    DataHolderForm.Data( formStockingCosts ); // Form that opens the dialog, to select the newly created object in list
    
    // Stocking point cost we are copying
    stockingCost := accountCosts.First().astype( StockingPointCost );
    
    // Stocking point for the cost we are copying
    stockingPoint := stockingCost.StockingPoint_MP();
    
    // Create new shadow based on the Stocking point Cost we are copying
    shadowStockingCost := shadow( stockingCost )
    shadowStockingCost.ResetWrapped();
    shadowStockingCost.ID( MacroPlan.IDHolder().GetStockingPointCostID() );
    
    DataHolderDialogData.Data( &shadowStockingCost );
    
    // Populate owner DH
    SPsforSPCost := construct( StockingPoint_MPs );
    SPsforSPCost.Add( stockingPoint );
    DataHolderStockingPoint.Data( &SPsforSPCost );
    
    this.Initialize();
  *]
}
