From e405daf52e3521f74ecae411a37e31bc7de86cc6 Mon Sep 17 00:00:00 2001 From: Andreas Sumerauer Date: Fri, 12 Nov 2021 23:34:51 +0100 Subject: [PATCH] IDEMPIERE-4854 Bugfixes in InOutGenerate (#753) InOutGenerate.createLine(): The Process would sometimes generate multiple inout lines from a single product lot/asi. InOutGenerate.prepare(): moved date setting code out of the loop. Co-authored-by: Andreas --- .../org/compiere/process/InOutGenerate.java | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java b/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java index 0b5fb94454..69cc01f6a8 100644 --- a/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java +++ b/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java @@ -120,15 +120,14 @@ public class InOutGenerate extends SvrProcess p_DateShipped = (Timestamp)para[i].getParameter(); else log.log(Level.SEVERE, "Unknown Parameter: " + name); - - // juddm - added ability to specify a shipment date from Generate Shipments - if (p_DateShipped == null) { - m_movementDate = Env.getContextAsDate(getCtx(), Env.DATE); - if (m_movementDate == null) - m_movementDate = new Timestamp(System.currentTimeMillis()); - } else - m_movementDate = p_DateShipped; } + // juddm - added ability to specify a shipment date from Generate Shipments + if (p_DateShipped == null) { + m_movementDate = Env.getContextAsDate(getCtx(), Env.DATE); + if (m_movementDate == null) + m_movementDate = new Timestamp(System.currentTimeMillis()); + } else + m_movementDate = p_DateShipped; } // prepare /** @@ -495,16 +494,14 @@ public class InOutGenerate extends SvrProcess int M_Locator_ID = storage.getM_Locator_ID(); // MInOutLine line = null; - if (orderLine.getM_AttributeSetInstance_ID() == 0) // find line with Locator + int olAsiID = orderLine.getM_AttributeSetInstance_ID(); + for (int ll = 0; ll < list.size(); ll++) { - for (int ll = 0; ll < list.size(); ll++) + MInOutLine test = (MInOutLine)list.get(ll); + if (test.getM_Locator_ID() == M_Locator_ID && test.getM_AttributeSetInstance_ID() == olAsiID) { - MInOutLine test = (MInOutLine)list.get(ll); - if (test.getM_Locator_ID() == M_Locator_ID && test.getM_AttributeSetInstance_ID() == 0) - { - line = test; - break; - } + line = test; + break; } } if (line == null) // new line