From 9508dfe8fe80ac4a60faa5a76f02a1dc9af1ce15 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 17 Sep 2019 14:33:08 +0200 Subject: [PATCH] IDEMPIERE-3391 Not possible to delete a line in the Material Receipt window --- .../src/org/compiere/model/MInOutLine.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MInOutLine.java b/org.adempiere.base/src/org/compiere/model/MInOutLine.java index e4dc303c82..2245831c49 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOutLine.java +++ b/org.adempiere.base/src/org/compiere/model/MInOutLine.java @@ -642,10 +642,20 @@ public class MInOutLine extends X_M_InOutLine */ protected boolean beforeDelete () { - if (getParent().getDocStatus().equals(MInOut.DOCSTATUS_Drafted)) - return true; - log.saveError("Error", Msg.getMsg(getCtx(), "CannotDelete")); - return false; + if (! getParent().getDocStatus().equals(MInOut.DOCSTATUS_Drafted)) { + log.saveError("Error", Msg.getMsg(getCtx(), "CannotDelete")); + return false; + } + // IDEMPIERE-3391 Not possible to delete a line in the Material Receipt window + List 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 /**