Stop ship when not enough inventory

cwigintoncwiginton Member Posts: 16
Trying to stop shipping if not enough inventory.

Using Nav3.7, have the following code in codeunit 22 just after InsertItemLedgEntry and the system still let's me ship when no inventory. Can anyone tell me what I did wrong?

IF ItemLedgEntry.Open THEN BEGIN
IF (((ItemLedgEntry."Entry Type" IN
[ItemLedgEntry."Entry Type"::"Negative Adjmt.",
ItemLedgEntry."Entry Type"::Consumption,
ItemLedgEntry."Entry Type"::Sale]) AND
("Source Type" = "Source Type"::Item)) OR
(ItemLedgEntry."Entry Type" = ItemLedgEntry."Entry Type"::Transfer)) AND
(ItemLedgEntry.Quantity < 0)
ERROR(Text005,ItemLedgEntry."Item No.");

Help is greatly appreciated!
Catherine :-k


  • Options
    ara3nara3n Member Posts: 9,256
    source type is not item for entry type sales.

    i suggest to add new code and don't modify the existing if statement
    Ahmed Rashed Amini
    Independent Consultant/Developer

    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    cwigintoncwiginton Member Posts: 16
    Ah! Thank you and I'll take your advise!
  • Options
    David_SingletonDavid_Singleton Member Posts: 5,479
    WOW do you get paid per line of code :wink:

    Try this:

    http://wiki.dynamicsbook.com/index.php? ... ory_in_NAV
    Add a field to the Location Table
     Block Negative Inventory::Boolean
     IN CU22 look for ILE.Modify and ILE.Insert, and add code
     IF "remaining Quantity" < 0 then
     if OldItemLedgEntry."Remaining Qty." < 0 then 
    David Singleton
  • Options
    themavethemave Member Posts: 1,058
    Or, goto sales and receiveable setup

    and check the box

    Stock Out Warning

    then if you try to put an item on a sales order without stock on hand, a pop up a warning box will appear.

    If you edit the form, to hide the yes button it can't be entered on an order.

    Not quite what you were looking for, but it also doesn't require any programming.
Sign In or Register to comment.