Question Status

Verified
DMV asked a question on 31 Jul 2014 11:59 AM

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

Reply
Suggested Answer
Mohana Yadav responded on 1 Aug 2014 12:09 AM

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;

Reply
Suggested Answer
Miguel Llorca responded on 1 Aug 2014 1:38 AM

I think that the change is by design... in the same way that you can delete a posted sales invoice :-)

Miguel LLorca Gómez

Reply
Suggested Answer
DMV responded on 1 Aug 2014 7:46 AM

Well, that does seem to be by design.  Thanks!

Reply
Suggested Answer
DMV responded on 1 Aug 2014 7:47 AM

Does seem like it -- of course neither one of those seems like a good idea!  

Thanks!

Reply
DMV responded on 1 Aug 2014 9:49 AM

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?  

Reply
Verified Answer
Mohana Yadav responded on 1 Aug 2014 10:43 AM

If you want to stop deleting if there are entries then you can use same old code.

Reply
Verified Answer
Mohana Yadav responded on 1 Aug 2014 10:43 AM

If you want to stop deleting if there are entries then you can use same old code.

Reply
Suggested Answer
Mohana Yadav responded on 1 Aug 2014 12:09 AM

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;

Reply
Suggested Answer
Miguel Llorca responded on 1 Aug 2014 1:38 AM

I think that the change is by design... in the same way that you can delete a posted sales invoice :-)

Miguel LLorca Gómez

Reply
Suggested Answer
DMV responded on 1 Aug 2014 7:46 AM

Well, that does seem to be by design.  Thanks!

Reply
Suggested Answer
DMV responded on 1 Aug 2014 7:47 AM

Does seem like it -- of course neither one of those seems like a good idea!  

Thanks!

Reply