diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java index 9163f41b3b..3f67ebf446 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoice.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoice.java @@ -45,8 +45,6 @@ import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; -import org.eevolution.model.MPPProductBOM; -import org.eevolution.model.MPPProductBOMLine; /** @@ -1538,7 +1536,7 @@ public class MInvoice extends X_C_Invoice implements DocAction int lineNo = line.getLine (); //find default BOM with valid dates and to this product - MPPProductBOM bom = MPPProductBOM.get(product, getAD_Org_ID(),getDateInvoiced(), get_TrxName()); + /*MPPProductBOM bom = MPPProductBOM.get(product, getAD_Org_ID(),getDateInvoiced(), get_TrxName()); if(bom != null) { MPPProductBOMLine[] bomlines = bom.getLines(getDateInvoiced()); @@ -1557,25 +1555,20 @@ public class MInvoice extends X_C_Invoice implements DocAction newLine.setPrice (); newLine.saveEx (get_TrxName()); } - } - - /*MProductBOM[] boms = MProductBOM.getBOMLines (product); - for (int j = 0; j < boms.length; j++) - { - MProductBOM bom = boms[j]; - MInvoiceLine newLine = new MInvoiceLine (this); - newLine.setLine (++lineNo); - newLine.setM_Product_ID (bom.getProduct().getM_Product_ID(), - bom.getProduct().getC_UOM_ID()); - newLine.setQty (line.getQtyInvoiced().multiply( - bom.getBOMQty ())); // Invoiced/Entered - if (bom.getDescription () != null) - newLine.setDescription (bom.getDescription ()); - // - newLine.setPrice (); - newLine.save (get_TrxName()); }*/ + for (MProductBOM bom : MProductBOM.getBOMLines(product)) + { + MInvoiceLine newLine = new MInvoiceLine(this); + newLine.setLine(++lineNo); + newLine.setM_Product_ID(bom.getM_ProductBOM_ID(), true); + newLine.setQty(line.getQtyInvoiced().multiply(bom.getBOMQty())); + if (bom.getDescription() != null) + newLine.setDescription(bom.getDescription()); + newLine.setPrice(); + newLine.save(get_TrxName()); + } + // Convert into Comment Line line.setM_Product_ID (0); line.setM_AttributeSetInstance_ID (0); diff --git a/org.adempiere.base/src/org/compiere/model/MOrder.java b/org.adempiere.base/src/org/compiere/model/MOrder.java index c94dcd62c2..e7e986aa9c 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrder.java +++ b/org.adempiere.base/src/org/compiere/model/MOrder.java @@ -47,8 +47,6 @@ import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.Util; -import org.eevolution.model.MPPProductBOM; -import org.eevolution.model.MPPProductBOMLine; /** @@ -1625,28 +1623,17 @@ public class MOrder extends X_C_Order implements DocAction newLine.save (get_TrxName()); } } */ - - MProductBOM[] boms = MProductBOM.getBOMLines (product); - for (int j = 0; j < boms.length; j++) + + for (MProductBOM bom : MProductBOM.getBOMLines(product)) { - MProductBOM bom = boms[j]; - //MPPProductBOMLine bom = boms[j]; - MOrderLine newLine = new MOrderLine (this); - newLine.setLine (++lineNo); - //newLine.setM_Product_ID (bom.getProduct () - // .getM_Product_ID ()); - newLine.setM_Product_ID (bom.getM_Product_ID ()); - newLine.setC_UOM_ID (bom.getProduct ().getC_UOM_ID ()); - //newLine.setC_UOM_ID (bom.getC_UOM_ID ()); - newLine.setQty (line.getQtyOrdered ().multiply ( - bom.getBOMQty ())); - //newLine.setQty (line.getQtyOrdered ().multiply ( - // bom.getQtyBOM())); - if (bom.getDescription () != null) - newLine.setDescription (bom.getDescription ()); - // - newLine.setPrice (); - newLine.save (get_TrxName()); + MOrderLine newLine = new MOrderLine(this); + newLine.setLine(++lineNo); + newLine.setM_Product_ID(bom.getM_ProductBOM_ID(), true); + newLine.setQty(line.getQtyOrdered().multiply(bom.getBOMQty())); + if (bom.getDescription() != null) + newLine.setDescription(bom.getDescription()); + newLine.setPrice(); + newLine.save(get_TrxName()); } // Convert into Comment Line