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

This commit is contained in:
igorpojzl 2016-05-18 11:20:22 +02:00
parent 367f50673b
commit d8278975ed
1 changed files with 16 additions and 1 deletions

View File

@ -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<lines.length; i++) {