Quintiq file version 2.0
#parent: #root
Method SetDefaultValue (
  ProductInStockingPointInPeriod pispip
) id:Method_DialogCreateEditDisaggregationFactor_SetDefaultValue
{
  #keys: '[124808.0.1994363534]'
  Body:
  [*
    // Set the default value for the fields in the dialog
    
    data := Dialog.Data();
    
    // Creating disaggregation factor will initially not have any PISPIP related to it
    if( isnull( data.WrappedInstance() ) )
    {
      data.Start( guard( pispip.Start().Date(), MacroPlan.StartOfPlanningPeriod().StartDate() ) );
    }
    
    // Relate to the stocking point of the PISPIP when creating from PISPIP
    if( not isnull( pispip ) )
    {
      data.StockingPoint_MP( relset, pispip.ProductInStockingPoint_MP().StockingPoint_MP() );
    
    }
    
    data.Factor( guard( pispip.DisaggregationFactor().Factor(), 0 ) );
  *]
}
