Quintiq file version 2.0
#parent: #root
Method CopySupplySpecification (
  SupplySpecification selection,
  internal[GUIComponent] parent
) as SupplySpecification id:Method_DialogCreateEditSupplySpecification_CopySupplySpecification
{
  #keys: '[112884.0.305206635]'
  Body:
  [*
    // Copy supply specification
    
    data := shadow( selection );
    data.ResetWrapped();
    Dialog.Data( data );
    Dialog.EnableDisableComponent();
    Dialog.EnableDisableEditorMaxQuantity();
    
    result := this.DoModal( parent );
    newobj := null( SupplySpecification );
    
    if ( result > 0 )
    {
      newobj := SupplySpecification::Create( data.Unit(),
                                             data.Product_MP(),
                                             GUIDateTimeSelectorStart.DateTime(), // Read-only, apply changes to shadow is not taking place for read-only attribute when editing
                                             GUIDateTimeSelectorEnd.DateTime(), // Read-only, apply changes to shadow is not taking place for read-only attribute when editing
                                             data.MinQuantity(),
                                             data.TargetQuantity(),
                                             data.HasMaxQuantity(),
                                             data.MaxQuantity(),
                                             false );
    }
    
    return newobj;
  *]
}
