Quintiq file version 2.0
#parent: #root
Method NewInventorySupplyCost (
  internal[GUIComponent] parent,
  shadow[InventorySupply] owner,
  ProductInStockingPoint_MP pisp
) id:Method_DialogCreateEditInventorySupplyCost_NewInventorySupplyCost_761
{
  #keys: '[124808.1.1623090000]'
  Body:
  [*
    // New shadow inventory supply cost
    
    data := owner.InventorySupplyCost( relnew,
                                       ID := MacroPlan.IDHolder().GetInventorySupplyCostID() );
    
    Dialog.Data( data );
    
    // Set default value
    Dialog.SetDefaultValue();
    
    Dialog.SetValueForStringSelections( InventorySupplyCost::GetDefinitionName() );
    
    Dialog.SetHolders( guard( pisp.StockingPoint_MP().Currency_MP(), MacroPlan.BaseCurrency() ),
                       guard( pisp.UnitOfMeasure_MP(), MacroPlan.DefaultUnitOfMeasure() ) );
    
    result := Dialog.DoModal( parent );
    
    if( result > 0 )
    {
      data.Commit();
    }
    else
    {
      // If user cancels, delete the instance
      data.Delete();
    }
  *]
}
