Many years various clients asking for the functionality of preventing Negative entry which has been provided by Microsoft in Nav 2013 R2. This provision has been given by Microsoft in Inventory Setup.
If the Prevent Negative Inventory setup is marked at
Inventory Setup then, Inventory has been checked for all Items.
If the Prevent Negative Inventory setup is not marked at
Inventory Setup then, In Item Master there is field called Prevent Negative
Inventory needs to be checked. In this scenario, The Inventory will get checked for those Items which are marked with Prevent Negative Inventory
In Standard Navision, I observed that This Functionality is
only worked for Sales. But when I tried to post with Item journal and entry
type is “Negative Adjt.”. The entry get posted with negative Inventory. To prevent
user from posting negative Inventory, I have done a small change in the
function written in Item Ledger Entry Table Called “VerifyOnInventory”
Old Code
IF NOT Open
THEN
EXIT;
IF Quantity
>= 0 THEN
EXIT;
CASE
"Entry Type" OF
"Entry Type"::"Negative
Adjmt.","Entry Type"::Consumption,"Entry
Type"::"Assembly Consumption":
IF "Source Type" = "Source
Type"::Item THEN
ERROR(IsNotOnInventoryErr,"Item
No.");
"Entry Type"::Transfer:
ERROR(IsNotOnInventoryErr,"Item
No.");
ELSE BEGIN
IF Item.PreventNegativeInventory THEN
ERROR(IsNotOnInventoryErr,"Item
No.");
END;
END;
New Code
IF NOT Open
THEN
EXIT;
IF Quantity
>= 0 THEN
EXIT;
CASE
"Entry Type" OF
"Entry Type"::"Negative
Adjmt.","Entry Type"::Consumption,"Entry
Type"::"Assembly Consumption":
//AK Start
// IF "Source Type" = "Source Type"::Item THEN
// ERROR(IsNotOnInventoryErr,"Item
No.");
IF ("Source Type" = "Source
Type"::Item) OR ("Source Type" = "Source Type"::"
") THEN
ERROR(IsNotOnInventoryErr,"Item
No.");
//AK End
"Entry Type"::Transfer:
ERROR(IsNotOnInventoryErr,"Item
No.");
ELSE BEGIN
Item.GET("Item No.");
IF Item.PreventNegativeInventory THEN
ERROR(IsNotOnInventoryErr,"Item
No.");
END;
END;
No comments:
Post a Comment