IDEMPIERE-4723 - Clean up dead code on MInvoice*/MInventory* classes (#625)
* IDEMPIERE-4723 - Clean up dead code on MInvoice*/MInventory* classes * IDEMPIERE-4723 - Clean up useless if in MInvoiceLine
This commit is contained in:
parent
bef5e5ed3f
commit
61478ad594
|
@ -95,8 +95,6 @@ public class MInventory extends X_M_Inventory implements DocAction
|
||||||
super (ctx, M_Inventory_ID, trxName);
|
super (ctx, M_Inventory_ID, trxName);
|
||||||
if (M_Inventory_ID == 0)
|
if (M_Inventory_ID == 0)
|
||||||
{
|
{
|
||||||
// setName (null);
|
|
||||||
// setM_Warehouse_ID (0); // FK
|
|
||||||
setMovementDate (new Timestamp(System.currentTimeMillis()));
|
setMovementDate (new Timestamp(System.currentTimeMillis()));
|
||||||
setDocAction (DOCACTION_Complete); // CO
|
setDocAction (DOCACTION_Complete); // CO
|
||||||
setDocStatus (DOCSTATUS_Drafted); // DR
|
setDocStatus (DOCSTATUS_Drafted); // DR
|
||||||
|
@ -271,10 +269,7 @@ public class MInventory extends X_M_Inventory implements DocAction
|
||||||
*/
|
*/
|
||||||
public File createPDF (File file)
|
public File createPDF (File file)
|
||||||
{
|
{
|
||||||
// ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.INVOICE, getC_Invoice_ID());
|
|
||||||
// if (re == null)
|
|
||||||
return null;
|
return null;
|
||||||
// return re.getPDF(file);
|
|
||||||
} // createPDF
|
} // createPDF
|
||||||
|
|
||||||
|
|
||||||
|
@ -412,7 +407,6 @@ public class MInventory extends X_M_Inventory implements DocAction
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Add up Amounts
|
// TODO: Add up Amounts
|
||||||
// setApprovalAmt();
|
|
||||||
|
|
||||||
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE);
|
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE);
|
||||||
if (m_processMsg != null)
|
if (m_processMsg != null)
|
||||||
|
@ -611,7 +605,6 @@ public class MInventory extends X_M_Inventory implements DocAction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//sLine.getM_AttributeSetInstance_ID() != 0
|
|
||||||
// Fallback
|
// Fallback
|
||||||
if (mtrx == null)
|
if (mtrx == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,11 +72,7 @@ public class MInventoryLine extends X_M_InventoryLine
|
||||||
super (ctx, M_InventoryLine_ID, trxName);
|
super (ctx, M_InventoryLine_ID, trxName);
|
||||||
if (M_InventoryLine_ID == 0)
|
if (M_InventoryLine_ID == 0)
|
||||||
{
|
{
|
||||||
// setM_Inventory_ID (0); // Parent
|
|
||||||
// setM_InventoryLine_ID (0); // PK
|
|
||||||
// setM_Locator_ID (0); // FK
|
|
||||||
setLine(0);
|
setLine(0);
|
||||||
// setM_Product_ID (0); // FK
|
|
||||||
setM_AttributeSetInstance_ID(0); // FK
|
setM_AttributeSetInstance_ID(0); // FK
|
||||||
setInventoryType (INVENTORYTYPE_InventoryDifference);
|
setInventoryType (INVENTORYTYPE_InventoryDifference);
|
||||||
setQtyBook (Env.ZERO);
|
setQtyBook (Env.ZERO);
|
||||||
|
@ -127,7 +123,6 @@ public class MInventoryLine extends X_M_InventoryLine
|
||||||
setQtyCount (QtyCount);
|
setQtyCount (QtyCount);
|
||||||
if (QtyInternalUse != null && QtyInternalUse.signum() != 0)
|
if (QtyInternalUse != null && QtyInternalUse.signum() != 0)
|
||||||
setQtyInternalUse (QtyInternalUse);
|
setQtyInternalUse (QtyInternalUse);
|
||||||
// m_isManualEntry = false;
|
|
||||||
} // MInventoryLine
|
} // MInventoryLine
|
||||||
|
|
||||||
public MInventoryLine (MInventory inventory,
|
public MInventoryLine (MInventory inventory,
|
||||||
|
@ -170,8 +165,6 @@ public class MInventoryLine extends X_M_InventoryLine
|
||||||
this.m_product = copy.m_product != null ? new MProduct(ctx, copy.m_product, trxName) : null;
|
this.m_product = copy.m_product != null ? new MProduct(ctx, copy.m_product, trxName) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Manually created */
|
|
||||||
//protected boolean m_isManualEntry = true;
|
|
||||||
/** Parent */
|
/** Parent */
|
||||||
protected MInventory m_parent = null;
|
protected MInventory m_parent = null;
|
||||||
/** Product */
|
/** Product */
|
||||||
|
@ -306,15 +299,6 @@ public class MInventoryLine extends X_M_InventoryLine
|
||||||
setLine (ii);
|
setLine (ii);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enforce QtyCount >= 0 - teo_sarca BF [ 1722982 ]
|
|
||||||
// GlobalQSS -> reverting this change because of Bug 2904321 - Create Inventory Count List not taking negative qty products
|
|
||||||
/*
|
|
||||||
if ( (!newRecord) && is_ValueChanged("QtyCount") && getQtyCount().signum() < 0)
|
|
||||||
{
|
|
||||||
log.saveError("Warning", Msg.getElement(getCtx(), COLUMNNAME_QtyCount)+" < 0");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// Enforce Qty UOM
|
// Enforce Qty UOM
|
||||||
if (newRecord || is_ValueChanged("QtyCount"))
|
if (newRecord || is_ValueChanged("QtyCount"))
|
||||||
setQtyCount(getQtyCount());
|
setQtyCount(getQtyCount());
|
||||||
|
@ -403,67 +387,6 @@ public class MInventoryLine extends X_M_InventoryLine
|
||||||
return true;
|
return true;
|
||||||
} // beforeSave
|
} // beforeSave
|
||||||
|
|
||||||
/**
|
|
||||||
* After Save
|
|
||||||
* @param newRecord new
|
|
||||||
* @param success success
|
|
||||||
* @return true
|
|
||||||
*/
|
|
||||||
//protected boolean afterSave (boolean newRecord, boolean success)
|
|
||||||
//{
|
|
||||||
// if (!success)
|
|
||||||
// return false;
|
|
||||||
//
|
|
||||||
// // Create MA
|
|
||||||
// //if (newRecord && success
|
|
||||||
// // && m_isManualEntry && getM_AttributeSetInstance_ID() == 0)
|
|
||||||
// // createMA();
|
|
||||||
// return true;
|
|
||||||
//} // afterSave
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create Material Allocations for new Instances
|
|
||||||
*/
|
|
||||||
/*protected void createMA()
|
|
||||||
{
|
|
||||||
MStorageOnHand[] storages = MStorageOnHand.getAll(getCtx(), getM_Product_ID(),
|
|
||||||
getM_Locator_ID(), get_TrxName());
|
|
||||||
boolean allZeroASI = true;
|
|
||||||
for (int i = 0; i < storages.length; i++)
|
|
||||||
{
|
|
||||||
if (storages[i].getM_AttributeSetInstance_ID() != 0)
|
|
||||||
{
|
|
||||||
allZeroASI = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (allZeroASI)
|
|
||||||
return;
|
|
||||||
|
|
||||||
MInventoryLineMA ma = null;
|
|
||||||
BigDecimal sum = Env.ZERO;
|
|
||||||
for (int i = 0; i < storages.length; i++)
|
|
||||||
{
|
|
||||||
MStorageOnHand storage = storages[i];
|
|
||||||
if (storage.getQtyOnHand().signum() == 0)
|
|
||||||
continue;
|
|
||||||
if (ma != null
|
|
||||||
&& ma.getM_AttributeSetInstance_ID() == storage.getM_AttributeSetInstance_ID())
|
|
||||||
ma.setMovementQty(ma.getMovementQty().add(storage.getQtyOnHand()));
|
|
||||||
else
|
|
||||||
ma = new MInventoryLineMA (this,
|
|
||||||
storage.getM_AttributeSetInstance_ID(), storage.getQtyOnHand());
|
|
||||||
if (!ma.save())
|
|
||||||
;
|
|
||||||
sum = sum.add(storage.getQtyOnHand());
|
|
||||||
}
|
|
||||||
if (sum.compareTo(getQtyBook()) != 0)
|
|
||||||
{
|
|
||||||
log.warning("QtyBook=" + getQtyBook() + " corrected to Sum of MA=" + sum);
|
|
||||||
setQtyBook(sum);
|
|
||||||
}
|
|
||||||
} // createMA*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is Internal Use Inventory
|
* Is Internal Use Inventory
|
||||||
* @return true if is internal use inventory
|
* @return true if is internal use inventory
|
||||||
|
|
|
@ -388,15 +388,9 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
setC_Currency_ID(batch.getC_Currency_ID());
|
setC_Currency_ID(batch.getC_Currency_ID());
|
||||||
setC_ConversionType_ID(batch.getC_ConversionType_ID());
|
setC_ConversionType_ID(batch.getC_ConversionType_ID());
|
||||||
//
|
//
|
||||||
// setPaymentRule(order.getPaymentRule());
|
|
||||||
// setC_PaymentTerm_ID(order.getC_PaymentTerm_ID());
|
|
||||||
// setPOReference("");
|
|
||||||
setDescription(batch.getDescription());
|
setDescription(batch.getDescription());
|
||||||
// setDateOrdered(order.getDateOrdered());
|
|
||||||
//
|
|
||||||
setAD_OrgTrx_ID(line.getAD_OrgTrx_ID());
|
setAD_OrgTrx_ID(line.getAD_OrgTrx_ID());
|
||||||
setC_Project_ID(line.getC_Project_ID());
|
setC_Project_ID(line.getC_Project_ID());
|
||||||
// setC_Campaign_ID(line.getC_Campaign_ID());
|
|
||||||
setC_Activity_ID(line.getC_Activity_ID());
|
setC_Activity_ID(line.getC_Activity_ID());
|
||||||
setUser1_ID(line.getUser1_ID());
|
setUser1_ID(line.getUser1_ID());
|
||||||
setUser2_ID(line.getUser2_ID());
|
setUser2_ID(line.getUser2_ID());
|
||||||
|
@ -1267,8 +1261,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
DB.close(rs, pstmt);
|
DB.close(rs, pstmt);
|
||||||
rs = null; pstmt = null;
|
rs = null; pstmt = null;
|
||||||
}
|
}
|
||||||
// log.fine("getAllocatedAmt - " + retValue);
|
|
||||||
// ? ROUND(NVL(v_AllocatedAmt,0), 2);
|
|
||||||
return retValue;
|
return retValue;
|
||||||
} // getAllocatedAmt
|
} // getAllocatedAmt
|
||||||
|
|
||||||
|
@ -1549,13 +1542,6 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
m_processMsg = "@NoLines@";
|
m_processMsg = "@NoLines@";
|
||||||
return DocAction.STATUS_Invalid;
|
return DocAction.STATUS_Invalid;
|
||||||
}
|
}
|
||||||
// No Cash Book // deprecated with IDEMPIERE-170 Complete Cash as Payment functionality
|
|
||||||
// if (PAYMENTRULE_Cash.equals(getPaymentRule())
|
|
||||||
// && MCashBook.get(getCtx(), getAD_Org_ID(), getC_Currency_ID()) == null)
|
|
||||||
// {
|
|
||||||
// m_processMsg = "@NoCashBook@";
|
|
||||||
// return DocAction.STATUS_Invalid;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Convert/Check DocType
|
// Convert/Check DocType
|
||||||
if (getC_DocType_ID() != getC_DocTypeTarget_ID() )
|
if (getC_DocType_ID() != getC_DocTypeTarget_ID() )
|
||||||
|
@ -1661,28 +1647,6 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
// New Lines
|
// New Lines
|
||||||
int lineNo = line.getLine ();
|
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());
|
|
||||||
if(bom != null)
|
|
||||||
{
|
|
||||||
MPPProductBOMLine[] bomlines = bom.getLines(getDateInvoiced());
|
|
||||||
for (int j = 0; j < bomlines.length; j++)
|
|
||||||
{
|
|
||||||
MPPProductBOMLine bomline = bomlines[j];
|
|
||||||
MInvoiceLine newLine = new MInvoiceLine (this);
|
|
||||||
newLine.setLine (++lineNo);
|
|
||||||
newLine.setM_Product_ID (bomline.getM_Product_ID ());
|
|
||||||
newLine.setC_UOM_ID (bomline.getC_UOM_ID ());
|
|
||||||
newLine.setQty (line.getQtyInvoiced().multiply(
|
|
||||||
bomline.getQtyBOM ())); // Invoiced/Entered
|
|
||||||
if (bomline.getDescription () != null)
|
|
||||||
newLine.setDescription (bomline.getDescription ());
|
|
||||||
//
|
|
||||||
newLine.setPrice ();
|
|
||||||
newLine.saveEx (get_TrxName());
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
for (MProductBOM bom : MProductBOM.getBOMLines(product))
|
for (MProductBOM bom : MProductBOM.getBOMLines(product))
|
||||||
{
|
{
|
||||||
MInvoiceLine newLine = new MInvoiceLine(this);
|
MInvoiceLine newLine = new MInvoiceLine(this);
|
||||||
|
@ -2314,7 +2278,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
MBPartner counterBP = new MBPartner (getCtx(), counterC_BPartner_ID, null);
|
MBPartner counterBP = new MBPartner (getCtx(), counterC_BPartner_ID, null);
|
||||||
// MOrgInfo counterOrgInfo = MOrgInfo.get(getCtx(), counterAD_Org_ID);
|
|
||||||
if (log.isLoggable(Level.INFO)) log.info("Counter BP=" + counterBP.getName());
|
if (log.isLoggable(Level.INFO)) log.info("Counter BP=" + counterBP.getName());
|
||||||
|
|
||||||
// Document Type
|
// Document Type
|
||||||
|
@ -2340,9 +2304,6 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
C_DocTypeTarget_ID, !isSOTrx(), true, get_TrxName(), true);
|
C_DocTypeTarget_ID, !isSOTrx(), true, get_TrxName(), true);
|
||||||
//
|
//
|
||||||
counter.setAD_Org_ID(counterAD_Org_ID);
|
counter.setAD_Org_ID(counterAD_Org_ID);
|
||||||
// counter.setM_Warehouse_ID(counterOrgInfo.getM_Warehouse_ID());
|
|
||||||
//
|
|
||||||
// counter.setBPartner(counterBP);// was set on copyFrom
|
|
||||||
// References (Should not be required)
|
// References (Should not be required)
|
||||||
counter.setSalesRep_ID(getSalesRep_ID());
|
counter.setSalesRep_ID(getSalesRep_ID());
|
||||||
counter.saveEx(get_TrxName());
|
counter.saveEx(get_TrxName());
|
||||||
|
|
|
@ -53,14 +53,11 @@ public class MInvoiceBatch extends X_C_InvoiceBatch
|
||||||
super (ctx, C_InvoiceBatch_ID, trxName);
|
super (ctx, C_InvoiceBatch_ID, trxName);
|
||||||
if (C_InvoiceBatch_ID == 0)
|
if (C_InvoiceBatch_ID == 0)
|
||||||
{
|
{
|
||||||
// setDocumentNo (null);
|
|
||||||
// setC_Currency_ID (0); // @$C_Currency_ID@
|
|
||||||
setControlAmt (Env.ZERO); // 0
|
setControlAmt (Env.ZERO); // 0
|
||||||
setDateDoc (new Timestamp(System.currentTimeMillis())); // @#Date@
|
setDateDoc (new Timestamp(System.currentTimeMillis())); // @#Date@
|
||||||
setDocumentAmt (Env.ZERO);
|
setDocumentAmt (Env.ZERO);
|
||||||
setIsSOTrx (false); // N
|
setIsSOTrx (false); // N
|
||||||
setProcessed (false);
|
setProcessed (false);
|
||||||
// setSalesRep_ID (0);
|
|
||||||
}
|
}
|
||||||
} // MInvoiceBatch
|
} // MInvoiceBatch
|
||||||
|
|
||||||
|
|
|
@ -50,16 +50,6 @@ public class MInvoiceBatchLine extends X_C_InvoiceBatchLine
|
||||||
super (ctx, C_InvoiceBatchLine_ID, trxName);
|
super (ctx, C_InvoiceBatchLine_ID, trxName);
|
||||||
if (C_InvoiceBatchLine_ID == 0)
|
if (C_InvoiceBatchLine_ID == 0)
|
||||||
{
|
{
|
||||||
// setC_InvoiceBatch_ID (0);
|
|
||||||
/**
|
|
||||||
setC_BPartner_ID (0);
|
|
||||||
setC_BPartner_Location_ID (0);
|
|
||||||
setC_Charge_ID (0);
|
|
||||||
setC_DocType_ID (0); // @C_DocType_ID@
|
|
||||||
setC_Tax_ID (0);
|
|
||||||
setDocumentNo (null);
|
|
||||||
setLine (0); // @SQL=SELECT NVL(MAX(Line),0)+10 AS DefaultValue FROM C_InvoiceBatchLine WHERE C_InvoiceBatch_ID=@C_InvoiceBatch_ID@
|
|
||||||
**/
|
|
||||||
setDateAcct (new Timestamp(System.currentTimeMillis())); // @DateDoc@
|
setDateAcct (new Timestamp(System.currentTimeMillis())); // @DateDoc@
|
||||||
setDateInvoiced (new Timestamp(System.currentTimeMillis())); // @DateDoc@
|
setDateInvoiced (new Timestamp(System.currentTimeMillis())); // @DateDoc@
|
||||||
setIsTaxIncluded (false);
|
setIsTaxIncluded (false);
|
||||||
|
|
|
@ -318,7 +318,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
|
||||||
// use product UOM if the shipment hasn't the same uom than the order
|
// use product UOM if the shipment hasn't the same uom than the order
|
||||||
setC_UOM_ID(getProduct().getC_UOM_ID());
|
setC_UOM_ID(getProduct().getC_UOM_ID());
|
||||||
setM_AttributeSetInstance_ID(sLine.getM_AttributeSetInstance_ID());
|
setM_AttributeSetInstance_ID(sLine.getM_AttributeSetInstance_ID());
|
||||||
// setS_ResourceAssignment_ID(sLine.getS_ResourceAssignment_ID());
|
|
||||||
if(getM_Product_ID() == 0)
|
if(getM_Product_ID() == 0)
|
||||||
setC_Charge_ID(sLine.getC_Charge_ID());
|
setC_Charge_ID(sLine.getC_Charge_ID());
|
||||||
//
|
//
|
||||||
|
@ -388,9 +388,6 @@ public class MInvoiceLine extends X_C_InvoiceLine
|
||||||
*/
|
*/
|
||||||
public void setM_AttributeSetInstance_ID (int M_AttributeSetInstance_ID)
|
public void setM_AttributeSetInstance_ID (int M_AttributeSetInstance_ID)
|
||||||
{
|
{
|
||||||
if (M_AttributeSetInstance_ID == 0) // 0 is valid ID
|
|
||||||
set_Value("M_AttributeSetInstance_ID", Integer.valueOf(0));
|
|
||||||
else
|
|
||||||
super.setM_AttributeSetInstance_ID (M_AttributeSetInstance_ID);
|
super.setM_AttributeSetInstance_ID (M_AttributeSetInstance_ID);
|
||||||
} // setM_AttributeSetInstance_ID
|
} // setM_AttributeSetInstance_ID
|
||||||
|
|
||||||
|
|
|
@ -108,11 +108,6 @@ public class MInvoicePaySchedule extends X_C_InvoicePaySchedule
|
||||||
super(ctx, C_InvoicePaySchedule_ID, trxName);
|
super(ctx, C_InvoicePaySchedule_ID, trxName);
|
||||||
if (C_InvoicePaySchedule_ID == 0)
|
if (C_InvoicePaySchedule_ID == 0)
|
||||||
{
|
{
|
||||||
// setC_Invoice_ID (0);
|
|
||||||
// setDiscountAmt (Env.ZERO);
|
|
||||||
// setDiscountDate (new Timestamp(System.currentTimeMillis()));
|
|
||||||
// setDueAmt (Env.ZERO);
|
|
||||||
// setDueDate (new Timestamp(System.currentTimeMillis()));
|
|
||||||
setIsValid (false);
|
setIsValid (false);
|
||||||
}
|
}
|
||||||
} // MInvoicePaySchedule
|
} // MInvoicePaySchedule
|
||||||
|
|
Loading…
Reference in New Issue