/** * Get Product Cost Info * * @return product cost */ public ProductCost getProductCost() { if (m_productCost == null) m_productCost = new ProductCost( Env.getCtx(), getM_Product_ID(), getM_AttributeSetInstance_ID(), p_po.get_TrxName()); return m_productCost; } // getProductCost
// Note: this code used to be located in // /sw01_swat_it/src/java/org/adempiere/order/subscription/modelvalidator/OrderValidator.java @Override public String docValidate(final PO po, final int timing) { if (timing != TIMING_AFTER_COMPLETE && timing != TIMING_AFTER_REACTIVATE) { return null; } final String trxName = po.get_TrxName(); final I_C_Order order = InterfaceWrapperHelper.create(po, I_C_Order.class); final IOrderPA orderPA = Services.get(IOrderPA.class); for (final I_C_OrderLine ol : orderPA.retrieveOrderLines(order, I_C_OrderLine.class)) { if (ol.getC_Flatrate_Conditions_ID() <= 0) { logger.debug("Order line " + ol + " has no subscription"); continue; } if (timing == TIMING_AFTER_COMPLETE) { handleOrderLineComplete(order, ol, trxName); } else if (timing == TIMING_AFTER_REACTIVATE) { handleOrderLineReactivate(ol, trxName); } } return null; }
/** * Get Total Product Costs from Cost Detail or from Current Cost * * @param as accounting schema * @param AD_Org_ID trx org * @param zeroCostsOK zero/no costs are OK * @param whereClause null are OK * @return costs */ public BigDecimal getProductCosts( MAcctSchema as, int AD_Org_ID, boolean zeroCostsOK, String whereClause) { if (whereClause != null && !as.getCostingMethod().equals(MAcctSchema.COSTINGMETHOD_StandardCosting)) { MCostDetail cd = MCostDetail.get( Env.getCtx(), whereClause, get_ID(), getM_AttributeSetInstance_ID(), as.getC_AcctSchema_ID(), p_po.get_TrxName()); if (cd != null) return cd.getAmt(); } return getProductCosts(as, AD_Org_ID, zeroCostsOK); } // getProductCosts