IDEMPIERE-88 Delete children records must happen on beforeDelete (MDocType) (Thanks to Emiliano Pereyra)

http://jira.idempiere.com/browse/IDEMPIERE-88
This commit is contained in:
Carlos Ruiz 2011-10-23 09:50:44 -05:00
parent 694aa1242b
commit 737737aebe
1 changed files with 9 additions and 11 deletions

View File

@ -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 * Return the first Doc Type for this BaseType
@ -289,19 +289,17 @@ public class MDocType extends X_C_DocType
} // afterSave } // afterSave
/** /**
* Executed after Delete operation. * Executed before Delete operation.
* @param success true if record deleted *
* @return true if delete is a success * @return true if delete is a success
*/ */
protected boolean afterDelete (boolean success) protected boolean beforeDelete ()
{ {
if(success) { // delete access records
//delete access records int docactDel = DB.executeUpdate("DELETE FROM AD_Document_Action_Access WHERE C_DocType_ID=" + get_ID(), get_TrxName());
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_ID());
log.fine("Delete AD_Document_Action_Access=" + docactDel + " for C_DocType_ID: " + get_IDOld()); return docactDel >= 0;
} } // beforeDelete
return success;
} // afterDelete
/** /**
* Returns Document type for the shipment/receipt based * Returns Document type for the shipment/receipt based