From 737737aebe832161847737ca8425790a40e39dba Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 23 Oct 2011 09:50:44 -0500 Subject: [PATCH] IDEMPIERE-88 Delete children records must happen on beforeDelete (MDocType) (Thanks to Emiliano Pereyra) http://jira.idempiere.com/browse/IDEMPIERE-88 --- .../src/org/compiere/model/MDocType.java | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MDocType.java b/org.adempiere.base/src/org/compiere/model/MDocType.java index 16dd8a0cad..b6ce65abbb 100644 --- a/org.adempiere.base/src/org/compiere/model/MDocType.java +++ b/org.adempiere.base/src/org/compiere/model/MDocType.java @@ -40,7 +40,7 @@ public class MDocType extends X_C_DocType /** * */ - private static final long serialVersionUID = -1406832071359080959L; + private static final long serialVersionUID = 2641885482012907072L; /** * Return the first Doc Type for this BaseType @@ -289,19 +289,17 @@ public class MDocType extends X_C_DocType } // afterSave /** - * Executed after Delete operation. - * @param success true if record deleted + * Executed before Delete operation. + * * @return true if delete is a success */ - protected boolean afterDelete (boolean success) + protected boolean beforeDelete () { - if(success) { - //delete access records - int docactDel = DB.executeUpdate("DELETE FROM AD_Document_Action_Access WHERE C_DocType_ID=" + get_IDOld(), get_TrxName()); - log.fine("Delete AD_Document_Action_Access=" + docactDel + " for C_DocType_ID: " + get_IDOld()); - } - return success; - } // afterDelete + // delete access records + int docactDel = DB.executeUpdate("DELETE FROM AD_Document_Action_Access WHERE C_DocType_ID=" + get_ID(), get_TrxName()); + log.fine("Delete AD_Document_Action_Access=" + docactDel + " for C_DocType_ID: " + get_ID()); + return docactDel >= 0; + } // beforeDelete /** * Returns Document type for the shipment/receipt based