Search in sources :

Example 1 with DocTypeNotFoundException

use of org.adempiere.exceptions.DocTypeNotFoundException in project adempiere by adempiere.

the class GenerateInOutBound method createOutBoundOrder.

private MWMInOutBound createOutBoundOrder() {
    MLocator locator = MLocator.get(getCtx(), getLocatorId());
    MWMInOutBound outBoundOrder = new MWMInOutBound(getCtx(), 0, get_TrxName());
    outBoundOrder.setShipDate(getShipDate());
    outBoundOrder.setPickDate(getPickDate());
    if (getOrderReference() != null)
        outBoundOrder.setPOReference(getOrderReference());
    if (getDeliveryRule() != null)
        outBoundOrder.setDeliveryRule(getDeliveryRule());
    if (getDeliveryVia() != null)
        outBoundOrder.setDeliveryViaRule(getDeliveryVia());
    if (getDocumentTypeId() > 0)
        outBoundOrder.setC_DocType_ID(getDocumentTypeId());
    else {
        int docTypeId = MDocType.getDocType(MDocType.DOCBASETYPE_WarehouseManagementOrder);
        if (docTypeId <= 0)
            throw new DocTypeNotFoundException(MDocType.DOCBASETYPE_WarehouseManagementOrder, "");
        else
            outBoundOrder.setC_DocType_ID(docTypeId);
    }
    if (getDocumentAction() != null)
        outBoundOrder.setDocAction(getDocumentAction());
    else
        outBoundOrder.setDocAction(MWMInOutBound.ACTION_Prepare);
    outBoundOrder.setDocStatus(MWMInOutBound.DOCSTATUS_Drafted);
    outBoundOrder.setM_Warehouse_ID(locator.getM_Warehouse_ID());
    outBoundOrder.setIsSOTrx(true);
    outBoundOrder.saveEx();
    return outBoundOrder;
}
Also used : MWMInOutBound(org.eevolution.model.MWMInOutBound) MLocator(org.compiere.model.MLocator) DocTypeNotFoundException(org.adempiere.exceptions.DocTypeNotFoundException)

Aggregations

DocTypeNotFoundException (org.adempiere.exceptions.DocTypeNotFoundException)1 MLocator (org.compiere.model.MLocator)1 MWMInOutBound (org.eevolution.model.MWMInOutBound)1