diff --git a/org.adempiere.base/src/org/compiere/model/MProduction.java b/org.adempiere.base/src/org/compiere/model/MProduction.java index 31df16dc80..a4abcb63e0 100644 --- a/org.adempiere.base/src/org/compiere/model/MProduction.java +++ b/org.adempiere.base/src/org/compiere/model/MProduction.java @@ -102,7 +102,13 @@ public class MProduction extends X_M_Production implements DocAction { StringBuilder errors = new StringBuilder(); int processed = 0; - + + //IDEMPIERE-3107 Check if End Product in Production Lines exist + if(!isHaveEndProduct(getLines())) { + m_processMsg = "Production does not contain End Product"; + return DocAction.STATUS_Invalid; + } + if (!isUseProductionPlan()) { MProductionLine[] lines = getLines(); errors.append(processLines(lines)); @@ -142,6 +148,15 @@ public class MProduction extends X_M_Production implements DocAction { return DocAction.STATUS_Completed; } + private boolean isHaveEndProduct(MProductionLine[] lines) { + + for(MProductionLine line : lines) { + if(line.isEndProduct()) + return true; + } + return false; + } + private Object processLines(MProductionLine[] lines) { StringBuilder errors = new StringBuilder(); for ( int i = 0; i