IDEMPIERE-2575 BOM functionality sales order - implement same in MInvoice

This commit is contained in:
Carlos Ruiz 2015-04-12 14:57:07 -05:00
parent a40c7109c1
commit d3aff28345
2 changed files with 23 additions and 43 deletions

View File

@ -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);

View File

@ -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