Move some Delete Cascade Constraints to Model classes
Description
with this query
we see there are 250 on delete cascade constraints not related to translation/accounting/access/temp tables.
That's not desirable in some cases as a user can inadvertently delete a master record and all children will be deleted without any trace on audit files (and because of that no ways to recover the information).
For example deleting a bpartner deletes all its contacts, locations, products and bank account info. It would be better to do those deletes of valuable information via model classes (like MOrder.beforeDelete deals with order lines).
But this needs to be analyzed per constraint - as for example we don't need to preserve C_InvoiceTax information (as is calculated) but is desirable to keep log of C_InvoiceLine.
Regards,
Carlos Ruiz
Environment
None
Attachments
2
Activity
Jan Thielemann
August 22, 2014 at 12:14 PM
Patches from Adnan Touati. Delete is now done via PO class. Delete is done before DB constraint kicks in.
with this query
we see there are 250 on delete cascade constraints not related to translation/accounting/access/temp tables.
That's not desirable in some cases as a user can inadvertently delete a master record and all children will be deleted without any trace on audit files (and because of that no ways to recover the information).
For example deleting a bpartner deletes all its contacts, locations, products and bank account info.
It would be better to do those deletes of valuable information via model classes (like MOrder.beforeDelete deals with order lines).
But this needs to be analyzed per constraint - as for example we don't need to preserve C_InvoiceTax information (as is calculated) but is desirable to keep log of C_InvoiceLine.
Regards,
Carlos Ruiz