Has there been a change to the software (2013) that now allows you to delete a finished Production Order, even if there are Item Ledger Entries associated with it? It didn't let you do this previously but, now it seems that it does. Is this a bug or "by design"?
Thanks
*This post is locked for comments
Can you delete more than once at a time?
If you want to stop deleting if there are entries then you can use same old code.
So, is there any way to restrict the users from doing this via permissions? It's not it's own table like posted sales invoice so, can this be done in security or would we need to modify the code?
Does seem like it -- of course neither one of those seems like a good idea!
Thanks!
Well, that does seem to be by design. Thanks!
I think that the change is by design... in the same way that you can delete a posted sales invoice :-)
You are right.
I don't know 100% whether it is a bug or bydesign.
Earlier code was:
IF Status IN [Status::Released,Status::Finished] THEN BEGIN
ItemLedgEntry.SETCURRENTKEY("Prod. Order No.");
ItemLedgEntry.SETRANGE("Prod. Order No.","No.");
IF ItemLedgEntry.FIND('-') THEN
ERROR(
Text000,
Status,TABLECAPTION,"No.",ItemLedgEntry.TABLECAPTION);
CapLedgEntry.SETCURRENTKEY("Prod. Order No.");
CapLedgEntry.SETRANGE("Prod. Order No.","No.");
IF CapLedgEntry.FIND('-') THEN
ERROR(
Text000,
Status,TABLECAPTION,"No.",CapLedgEntry.TABLECAPTION);
END;
IF Status = Status::Released THEN BEGIN
PurchLine.SETCURRENTKEY(
"Document Type",Type,"Prod. Order No.","Prod. Order Line No.","Routing No.","Operation No.");
PurchLine.SETRANGE("Document Type",PurchLine."Document Type"::Order);
PurchLine.SETRANGE(Type,PurchLine.Type::Item);
PurchLine.SETRANGE("Prod. Order No.","No.");
IF PurchLine.FIND('-') THEN
ERROR(
Text000,
Status,TABLECAPTION,"No.",PurchLine.TABLECAPTION);
END;
New Code is
IF Status = Status::Released THEN BEGIN
ItemLedgEntry.SETCURRENTKEY("Order Type","Order No.");
ItemLedgEntry.SETRANGE("Order Type",ItemLedgEntry."Order Type"::Production);
ItemLedgEntry.SETRANGE("Order No.","No.");
IF ItemLedgEntry.FINDFIRST THEN
ERROR(
Text000,
Status,TABLECAPTION,"No.",ItemLedgEntry.TABLECAPTION);
CapLedgEntry.SETCURRENTKEY("Order Type","Order No.");
CapLedgEntry.SETRANGE("Order Type",CapLedgEntry."Order Type"::Production);
CapLedgEntry.SETRANGE("Order No.","No.");
IF CapLedgEntry.FINDFIRST THEN
ERROR(
Text000,
Status,TABLECAPTION,"No.",CapLedgEntry.TABLECAPTION);
END;
IF Status IN [Status::Released,Status::Finished] THEN BEGIN
PurchLine.SETCURRENTKEY(
"Document Type",Type,"Prod. Order No.","Prod. Order Line No.","Routing No.","Operation No.");
PurchLine.SETRANGE("Document Type",PurchLine."Document Type"::Order);
PurchLine.SETRANGE(Type,PurchLine.Type::Item);
PurchLine.SETRANGE("Prod. Order No.","No.");
IF PurchLine.FINDFIRST THEN
ERROR(
Text000,
Status,TABLECAPTION,"No.",PurchLine.TABLECAPTION);
END;
Sohail Ahmed
2
mmv
2
Amol Salvi
2