Quintiq file version 2.0
#parent: #root
Method NewProduct (
  internal[GUIComponent] parent,
  Product_MP product
) as Product_MP id:Method_DialogCreateEditProduct_NewProduct
{
  #keys: '[11660.0.54834723]'
  Body:
  [*
    // New product
    data := MacroPlan.Product_MP( relshadow, ID := "" );// ID set to empty, will be defined by user in the interface
    Dialog.Data( data );
    
    this.SetCheckBoxVisibility( false );
    
    // Set default values
    CheckBoxHasParentProduct.Checked( not isnull( product ) );
    SelectionParentProduct.BoundValue( guard( product.Name(), '' ));
    DataHolderParentProduct.Data( product );
    
    EditorProductName.SetFocus();
    
    result := this.DoModal( parent );
    
    if ( result > 0 )
    {
      data.Commit();
    }
    
    
    return data.WrappedInstance();
  *]
}
