IDEMPIERE-2575 BOM functionality sales order - implement same in MInvoice
This commit is contained in:
parent
a40c7109c1
commit
d3aff28345
|
@ -45,8 +45,6 @@ import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
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 ();
|
int lineNo = line.getLine ();
|
||||||
|
|
||||||
//find default BOM with valid dates and to this product
|
//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)
|
if(bom != null)
|
||||||
{
|
{
|
||||||
MPPProductBOMLine[] bomlines = bom.getLines(getDateInvoiced());
|
MPPProductBOMLine[] bomlines = bom.getLines(getDateInvoiced());
|
||||||
|
@ -1557,25 +1555,20 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
newLine.setPrice ();
|
newLine.setPrice ();
|
||||||
newLine.saveEx (get_TrxName());
|
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
|
// Convert into Comment Line
|
||||||
line.setM_Product_ID (0);
|
line.setM_Product_ID (0);
|
||||||
line.setM_AttributeSetInstance_ID (0);
|
line.setM_AttributeSetInstance_ID (0);
|
||||||
|
|
|
@ -47,8 +47,6 @@ import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
import org.compiere.util.Util;
|
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());
|
newLine.save (get_TrxName());
|
||||||
}
|
}
|
||||||
} */
|
} */
|
||||||
|
|
||||||
MProductBOM[] boms = MProductBOM.getBOMLines (product);
|
for (MProductBOM bom : MProductBOM.getBOMLines(product))
|
||||||
for (int j = 0; j < boms.length; j++)
|
|
||||||
{
|
{
|
||||||
MProductBOM bom = boms[j];
|
MOrderLine newLine = new MOrderLine(this);
|
||||||
//MPPProductBOMLine bom = boms[j];
|
newLine.setLine(++lineNo);
|
||||||
MOrderLine newLine = new MOrderLine (this);
|
newLine.setM_Product_ID(bom.getM_ProductBOM_ID(), true);
|
||||||
newLine.setLine (++lineNo);
|
newLine.setQty(line.getQtyOrdered().multiply(bom.getBOMQty()));
|
||||||
//newLine.setM_Product_ID (bom.getProduct ()
|
if (bom.getDescription() != null)
|
||||||
// .getM_Product_ID ());
|
newLine.setDescription(bom.getDescription());
|
||||||
newLine.setM_Product_ID (bom.getM_Product_ID ());
|
newLine.setPrice();
|
||||||
newLine.setC_UOM_ID (bom.getProduct ().getC_UOM_ID ());
|
newLine.save(get_TrxName());
|
||||||
//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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert into Comment Line
|
// Convert into Comment Line
|
||||||
|
|
Loading…
Reference in New Issue