Quintiq file version 2.0
#parent: #root
Method UpdateUOMAndCurrencyBasedOnPISP () id:Method_DialogCreateEditSalesDemand_UpdateUOMAndCurrencyBasedOnPISP
{
  #keys: '[134266.0.1429275220]'
  Body:
  [*
    // When user changes the selection of product or stocking point,
    // we update the UOM based on their selection PISP, if no such
    // PISP can be found, we just make the UOM the default one
    product := SelectionProduct.Data()
    sp := guard( SelectionStockingPoint.Data(), null( StockingPoint_MP ) )
    
    uom := MacroPlan.DefaultUnitOfMeasure();
    
    if( not isnull( product ) )
    {
      pisp := select( product, ProductInStockingPoint_MP, e, 
                      e.StockingPoint_MP() = sp )
      
      uom := guard( pisp.UnitOfMeasure_MP(), uom )               
    }
    
    SelectionUnitOfMeasure.Data( uom );
    Dialog.SetCurrencyAndUOMForLabels();
  *]
}
