Prevent purchase order deletion after all line invoiced


Is there a way to prevent purchase order automated deletion after all line invoiced ?

I already looking it in purchase&payable setup and didn’t find anything there.

In codeunit 90, search for phrase “IF HASLINKS”; right after there is command DELETE, which deletes the Purchase Header.
Right after that command PurchLine.DELETEALL deletes a the lines.
Theese two command may be de-activated.

But you must read the surrounding code, because around here related data is deleted as well - like Links, Reservations, Comments and other data. Perhepas you do not want to do that…

If you are unsure about what to do og how to read the code, then do not do anything.

Hi Lie Yan,

Alternatively, you can archive your purchase order to keep a copy.


  1. Open the Purchase Order

  2. Go to Actions tab, select Archive Document under Functions group.

  3. To view the archived purchase order, type “Purchase Order Archives” in the search box.

Hope that helps.


When an Invoice is posted from the PO screen itself then system deletes the PO.

In case an Invoice is created from Purchase Invoice screen and Get Receipt functionality is used to do invoicing then system will not delete the PO.

Thus, you may invoice from the Purchase Invoice screen rather than posting Invoice from the PO screen.


Rajat Kalia.