Skip to content

Commit

Permalink
#251 fix WEBUI_M_ReceiptSchedule_SelectHUsToReverse availability
Browse files Browse the repository at this point in the history
shall be available:
* when line is not close
* when line is not a packing material line
  • Loading branch information
teosarca committed Mar 14, 2017
1 parent 927329e commit 53a608d
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
import java.util.List;

import org.adempiere.exceptions.AdempiereException;
import org.adempiere.util.Services;
import org.adempiere.util.lang.impl.TableRecordReference;
import org.springframework.context.annotation.Profile;

import de.metas.handlingunits.inout.ReceiptCorrectHUsProcessor;
import de.metas.handlingunits.model.I_M_HU;
import de.metas.handlingunits.model.I_M_ReceiptSchedule;
import de.metas.inoutcandidate.api.IReceiptScheduleBL;
import de.metas.process.IProcessPrecondition;
import de.metas.process.IProcessPreconditionsContext;
import de.metas.process.JavaProcess;
Expand Down Expand Up @@ -47,6 +49,21 @@ public ProcessPreconditionsResolution checkPreconditionsApplicable(final IProces
{
return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection();
}

// Receipt schedule shall not be already closed
final IReceiptScheduleBL receiptScheduleBL = Services.get(IReceiptScheduleBL.class);
final I_M_ReceiptSchedule receiptSchedule = context.getSelectedModel(I_M_ReceiptSchedule.class);
if(receiptScheduleBL.isClosed(receiptSchedule))
{
return ProcessPreconditionsResolution.reject("already closed");
}


// Receipt schedule shall not be about packing materials
if (receiptSchedule.isPackagingMaterial())
{
return ProcessPreconditionsResolution.reject("not applying for packing materials");
}

return ProcessPreconditionsResolution.accept();
}
Expand Down

0 comments on commit 53a608d

Please sign in to comment.