IDEMPIERE-3107:Production (Light) system enable to complete production without end product

fix for IDEMPIERE-1750
This commit is contained in:
hieplq 2016-07-18 20:20:35 +07:00
parent 3a0e748f1e
commit 153a3ea5e4
1 changed files with 12 additions and 6 deletions

View File

@ -104,14 +104,13 @@ public class MProduction extends X_M_Production implements DocAction {
StringBuilder errors = new StringBuilder(); StringBuilder errors = new StringBuilder();
int processed = 0; 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()) { if (!isUseProductionPlan()) {
MProductionLine[] lines = getLines(); MProductionLine[] lines = getLines();
//IDEMPIERE-3107 Check if End Product in Production Lines exist
if(!isHaveEndProduct(lines)) {
m_processMsg = "Production does not contain End Product";
return DocAction.STATUS_Invalid;
}
errors.append(processLines(lines)); errors.append(processLines(lines));
if (errors.length() > 0) { if (errors.length() > 0) {
m_processMsg = errors.toString(); m_processMsg = errors.toString();
@ -123,6 +122,13 @@ public class MProduction extends X_M_Production implements DocAction {
List<MProductionPlan> plans = planQuery.setParameters(getM_Production_ID()).list(); List<MProductionPlan> plans = planQuery.setParameters(getM_Production_ID()).list();
for(MProductionPlan plan : plans) { for(MProductionPlan plan : plans) {
MProductionLine[] lines = plan.getLines(); MProductionLine[] lines = plan.getLines();
//IDEMPIERE-3107 Check if End Product in Production Lines exist
if(!isHaveEndProduct(lines)) {
m_processMsg = String.format("Production plan (line %1$d id %2$d) does not contain End Product", plan.getLine(), plan.get_ID());
return DocAction.STATUS_Invalid;
}
if (lines.length > 0) { if (lines.length > 0) {
errors.append(processLines(lines)); errors.append(processLines(lines));
if (errors.length() > 0) { if (errors.length() > 0) {