Search in sources :

Example 11 with FillMandatoryException

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

the class A_Depreciation_Exp_Modify method doIt.

protected String doIt() throws Exception {
    //
    if (p_A_Depreciation_Exp_ID <= 0) {
        throw new FillMandatoryException("A_Depreciation_Exp_ID");
    }
    //
    MDepreciationExp exp = new MDepreciationExp(getCtx(), p_A_Depreciation_Exp_ID, get_TrxName());
    if (exp.get_ID() != p_A_Depreciation_Exp_ID) {
        throw new AdempiereException("@NotFound@ @A_Depreciation_Exp_ID@ = " + p_A_Depreciation_Exp_ID);
    }
    //
    MDepreciationEntry.deleteFacts(exp);
    exp.setDR_Account_ID(p_DR_Account_ID);
    exp.setCR_Account_ID(p_CR_Account_ID);
    exp.saveEx();
    //
    if (p_IsTest) {
        rollback();
    }
    //
    return "Ok";
}
Also used : AdempiereException(org.adempiere.exceptions.AdempiereException) MDepreciationExp(org.compiere.model.MDepreciationExp) FillMandatoryException(org.adempiere.exceptions.FillMandatoryException)

Example 12 with FillMandatoryException

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

the class CompletePrintOrder method doIt.

// prepare
/**
	 * Perform process.
	 * 
	 * @return Message (clear text)
	 * @throws Exception
	 *             if not successful
	 */
protected String doIt() throws Exception {
    if (p_PP_Order_ID == 0) {
        throw new FillMandatoryException(MPPOrder.COLUMNNAME_PP_Order_ID);
    }
    if (p_IsComplete) {
        MPPOrder order = new MPPOrder(getCtx(), p_PP_Order_ID, get_TrxName());
        if (!order.isAvailable()) {
            throw new AdempiereException("@NoQtyAvailable@");
        }
        //
        // Process document
        boolean ok = order.processIt(MPPOrder.DOCACTION_Complete);
        order.saveEx();
        if (!ok) {
            throw new AdempiereException(order.getProcessMsg());
        }
        // Document Status should be completed
        if (!MPPOrder.DOCSTATUS_Completed.equals(order.getDocStatus())) {
            throw new AdempiereException(order.getProcessMsg());
        }
    }
    if (p_IsPrintPickList) {
        // Get Format & Data
        ReportEngine re = this.getReportEngine("Manufacturing_Order_BOM_Header ** TEMPLATE **", "PP_Order_BOM_Header_v");
        if (re == null) {
            return "";
        }
        ReportCtl.preview(re);
        // prints only original
        re.print();
    }
    if (p_IsPrintPackList) {
        // Get Format & Data
        ReportEngine re = this.getReportEngine("Manufacturing_Order_BOM_Header_Packing ** TEMPLATE **", "PP_Order_BOM_Header_v");
        if (re == null) {
            return "";
        }
        ReportCtl.preview(re);
        // prints only original
        re.print();
    }
    if (p_IsPrintWorkflow) {
        // Get Format & Data
        ReportEngine re = this.getReportEngine("Manufacturing_Order_Workflow_Header ** TEMPLATE **", "PP_Order_Workflow_Header_v");
        if (re == null) {
            return "";
        }
        ReportCtl.preview(re);
        // prints only original
        re.print();
    }
    return "@OK@";
}
Also used : ReportEngine(org.compiere.print.ReportEngine) AdempiereException(org.adempiere.exceptions.AdempiereException) FillMandatoryException(org.adempiere.exceptions.FillMandatoryException) MPPOrder(org.eevolution.model.MPPOrder)

Aggregations

FillMandatoryException (org.adempiere.exceptions.FillMandatoryException)12 AdempiereException (org.adempiere.exceptions.AdempiereException)6 MProduct (org.compiere.model.MProduct)4 Timestamp (java.sql.Timestamp)3 MInvoiceLine (org.compiere.model.MInvoiceLine)2 Query (org.compiere.model.Query)2 BigDecimal (java.math.BigDecimal)1 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1 InvoiceFullyMatchedException (org.adempiere.exceptions.InvoiceFullyMatchedException)1 AssetCheckDocumentException (org.compiere.FA.exceptions.AssetCheckDocumentException)1 AssetException (org.compiere.FA.exceptions.AssetException)1 AssetProductStockedException (org.compiere.FA.exceptions.AssetProductStockedException)1 MBPartner (org.compiere.model.MBPartner)1 MBPartnerLocation (org.compiere.model.MBPartnerLocation)1 MDepreciationExp (org.compiere.model.MDepreciationExp)1 MInvoice (org.compiere.model.MInvoice)1 MLocation (org.compiere.model.MLocation)1 MOpportunity (org.compiere.model.MOpportunity)1 MPOSKey (org.compiere.model.MPOSKey)1