I have been working on a requirement to don’t allow the sales force to put sales orders with negative inventory and checking the documentation so far I use in the “Sales & receivables setup” the Boolean “Stockout warning” but it only shows a notification. I tried to follow the C/Al Quantity - OnValidate() code and found that if the “Codeunit311.SalesLineCheck” function returns TRUE will raise the “Codeunit311.RaiseUpdateInterruptedError”.
However, the return variable was always FALSE, so looking deeper into the codeunit I found this LOCAL function “CreateAndSendNotification”, that creates the notification to show that the stock warning was always FALSE.
AvailabilityCheckNotification.ID(GetItemAvailabilityNotificationId); AvailabilityCheckNotification.MESSAGE(STRSUBSTNO(NotificationMsg,ItemNo)); AvailabilityCheckNotification.SCOPE(NOTIFICATIONSCOPE::LocalScope); AvailabilityCheckNotification.ADDACTION(DetailsTxt,CODEUNIT::"Item-Check Avail.",'ShowNotificationDetails'); ItemAvailabilityCheck.PopulateDataOnNotification(AvailabilityCheckNotification,ItemNo,UnitOfMeasureCode, InventoryQty,GrossReq,ReservedReq,SchedRcpt,ReservedRcpt,CurrentQuantity,CurrentReservedQty, TotalQuantity,EarliestAvailDate); AvailabilityCheckNotification.SEND; EXIT(FALSE);
I’m tempted to modify the function in question to always return TRUE to stop the quantity input. But I’m aware that could interfere with Sales Lines functions like “Copy Lines…”, can anyone help me some advice about this?