IDEMPIERE-3391 Not possible to delete a line in the Material Receipt window

This commit is contained in:
Carlos Ruiz 2019-09-17 14:33:08 +02:00
parent 72ab1de774
commit 9508dfe8fe
1 changed files with 14 additions and 4 deletions

View File

@ -642,10 +642,20 @@ public class MInOutLine extends X_M_InOutLine
*/ */
protected boolean beforeDelete () protected boolean beforeDelete ()
{ {
if (getParent().getDocStatus().equals(MInOut.DOCSTATUS_Drafted)) if (! getParent().getDocStatus().equals(MInOut.DOCSTATUS_Drafted)) {
return true; log.saveError("Error", Msg.getMsg(getCtx(), "CannotDelete"));
log.saveError("Error", Msg.getMsg(getCtx(), "CannotDelete")); return false;
return false; }
// IDEMPIERE-3391 Not possible to delete a line in the Material Receipt window
List<MInvoiceLine> ils = new Query(getCtx(), MInvoiceLine.Table_Name, "M_InOutLine_ID=?", get_TrxName())
.setParameters(getM_InOutLine_ID())
.list();
ils.forEach(il -> {
il.setM_InOutLine_ID(-1);
il.saveEx();
});
//
return true;
} // beforeDelete } // beforeDelete
/** /**