Search in sources :

Example 1 with InvoiceFullyMatchedException

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

the class InvoiceCreateInOut method doIt.

//	prepare
/**
	 * 	Create Shipment
	 *	@return info
	 *	@throws Exception
	 */
protected String doIt() throws Exception {
    log.info("C_Invoice_ID=" + p_C_Invoice_ID + ", M_Warehouse_ID=" + p_M_Warehouse_ID);
    if (p_C_Invoice_ID <= 0)
        throw new FillMandatoryException("C_Invoice_ID");
    if (p_M_Warehouse_ID == 0)
        throw new FillMandatoryException(PARAM_M_Warehouse_ID);
    //
    MInvoice invoice = new MInvoice(getCtx(), p_C_Invoice_ID, null);
    if (invoice.get_ID() <= 0)
        throw new AdempiereException("@NotFound@ @C_Invoice_ID@");
    if (!MInvoice.DOCSTATUS_Completed.equals(invoice.getDocStatus()))
        throw new AdempiereException("@InvoiceCreateDocNotCompleted@");
    //
    for (MInvoiceLine invoiceLine : invoice.getLines(false)) {
        createLine(invoice, invoiceLine);
    }
    if (m_inout == null)
        throw new InvoiceFullyMatchedException();
    //
    return m_inout.getDocumentNo();
}
Also used : InvoiceFullyMatchedException(org.adempiere.exceptions.InvoiceFullyMatchedException) AdempiereException(org.adempiere.exceptions.AdempiereException) MInvoiceLine(org.compiere.model.MInvoiceLine) MInvoice(org.compiere.model.MInvoice) FillMandatoryException(org.adempiere.exceptions.FillMandatoryException)

Aggregations

AdempiereException (org.adempiere.exceptions.AdempiereException)1 FillMandatoryException (org.adempiere.exceptions.FillMandatoryException)1 InvoiceFullyMatchedException (org.adempiere.exceptions.InvoiceFullyMatchedException)1 MInvoice (org.compiere.model.MInvoice)1 MInvoiceLine (org.compiere.model.MInvoiceLine)1