IDEMPIERE-3703 Performance: Retrieve product from cache in MStorageReservation / following suggestion from Pritesh Shah

This commit is contained in:
Carlos Ruiz 2018-05-02 22:19:20 +02:00
parent 35afe8b009
commit b693e00195
4 changed files with 4 additions and 4 deletions

View File

@ -578,7 +578,7 @@ public class MInOutLine extends X_M_InOutLine
} }
} }
I_M_AttributeSet attributeset = getM_Product().getM_AttributeSet(); I_M_AttributeSet attributeset = MProduct.get(getCtx(), getM_Product_ID()).getM_AttributeSet();
boolean isAutoGenerateLot = false; boolean isAutoGenerateLot = false;
if (attributeset != null) if (attributeset != null)
isAutoGenerateLot = attributeset.isAutoGenerateLot(); isAutoGenerateLot = attributeset.isAutoGenerateLot();

View File

@ -173,7 +173,7 @@ public class MStorageOnHand extends X_M_StorageOnHand
String sqlWhere = "M_Product_ID=? AND M_Locator_ID=? AND QtyOnHand <> 0"; String sqlWhere = "M_Product_ID=? AND M_Locator_ID=? AND QtyOnHand <> 0";
Query query = new Query(ctx, MStorageOnHand.Table_Name, sqlWhere, trxName) Query query = new Query(ctx, MStorageOnHand.Table_Name, sqlWhere, trxName)
.setParameters(M_Product_ID, M_Locator_ID); .setParameters(M_Product_ID, M_Locator_ID);
MProduct product = new MProduct(ctx, M_Product_ID, trxName); MProduct product = MProduct.get(ctx, M_Product_ID);
if (product.isUseGuaranteeDateForMPolicy()) if (product.isUseGuaranteeDateForMPolicy())
{ {
query.addJoinClause(" LEFT OUTER JOIN M_AttributeSetInstance asi ON (M_StorageOnHand.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) ") query.addJoinClause(" LEFT OUTER JOIN M_AttributeSetInstance asi ON (M_StorageOnHand.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) ")

View File

@ -228,7 +228,7 @@ public class MStorageReservation extends X_M_StorageReservation {
return true; return true;
/* Do NOT use FIFO ASI for reservation */ /* Do NOT use FIFO ASI for reservation */
MProduct prd = new MProduct(ctx, M_Product_ID, trxName); MProduct prd = MProduct.get(ctx, M_Product_ID);
if (prd.getM_AttributeSet_ID() == 0 || ! prd.getM_AttributeSet().isInstanceAttribute()) { if (prd.getM_AttributeSet_ID() == 0 || ! prd.getM_AttributeSet().isInstanceAttribute()) {
// Product doesn't manage attribute set, always reserved with 0 // Product doesn't manage attribute set, always reserved with 0
M_AttributeSetInstance_ID = 0; M_AttributeSetInstance_ID = 0;

View File

@ -48,7 +48,7 @@ public class ProductCost
{ {
m_M_Product_ID = M_Product_ID; m_M_Product_ID = M_Product_ID;
if (m_M_Product_ID != 0) if (m_M_Product_ID != 0)
m_product = new MProduct(ctx, M_Product_ID, trxName); m_product = MProduct.get(ctx, M_Product_ID);
m_M_AttributeSetInstance_ID = M_AttributeSetInstance_ID; m_M_AttributeSetInstance_ID = M_AttributeSetInstance_ID;
m_trxName = trxName; m_trxName = trxName;
} // ProductCost } // ProductCost