Unposted sales documents (quotes, invoices) are stored in table 37 - Sales Line (correct me if im wrong on the ID)
When the Invoice/Shipment is posted the concerning SalesLine's get deleted and SalesInvoiceLine's/SalesShipmentLine's are generated by the posting routines.
So if you dont want Posted Documents to be deleted you want to insert the Error in the onDelete of:
* Sales Invoice Line
* Sales Shipment Line
Answers
Put an ERROR() in the OnDelete trigger og the tables.
This is the same thing done by MS on some posted documents tables on IT localization
just put an Error('not allowed') or whatever you like on the beginning of the OnDelete Trigger of the table.
When the Invoice/Shipment is posted the concerning SalesLine's get deleted and SalesInvoiceLine's/SalesShipmentLine's are generated by the posting routines.
So if you dont want Posted Documents to be deleted you want to insert the Error in the onDelete of:
* Sales Invoice Line
* Sales Shipment Line
at least on the sales side of things.
110, 112 and 114 for sales
120, 122 and 124 for purchase