IDEMPIERE-2142 Update Standard Cost Process: Cost adjustment document should include only products that have changes to the product's current cost.
This commit is contained in:
parent
ce672a5221
commit
ec2ad9af8b
|
@ -279,7 +279,7 @@ public class CostUpdate extends SvrProcess
|
||||||
MClient client = MClient.get(getCtx());
|
MClient client = MClient.get(getCtx());
|
||||||
MAcctSchema primarySchema = client.getAcctSchema();
|
MAcctSchema primarySchema = client.getAcctSchema();
|
||||||
MInventory inventoryDoc = null;
|
MInventory inventoryDoc = null;
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||||
pstmt.setInt (1, m_ce.getM_CostElement_ID());
|
pstmt.setInt (1, m_ce.getM_CostElement_ID());
|
||||||
if (p_M_Product_Category_ID != 0)
|
if (p_M_Product_Category_ID != 0)
|
||||||
pstmt.setInt (2, p_M_Product_Category_ID);
|
pstmt.setInt (2, p_M_Product_Category_ID);
|
||||||
|
@ -381,9 +381,11 @@ public class CostUpdate extends SvrProcess
|
||||||
{
|
{
|
||||||
cost.setFutureCostPrice(costs);
|
cost.setFutureCostPrice(costs);
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
|
||||||
if (lines != null)
|
if (lines != null)
|
||||||
{
|
{
|
||||||
|
BigDecimal currentCost = cost.getCurrentCostPrice();
|
||||||
|
if (currentCost == null || currentCost.compareTo(costs) != 0) {
|
||||||
MInventoryLine line = new MInventoryLine(getCtx(), 0, get_TrxName());
|
MInventoryLine line = new MInventoryLine(getCtx(), 0, get_TrxName());
|
||||||
line.setM_Product_ID(cost.getM_Product_ID());
|
line.setM_Product_ID(cost.getM_Product_ID());
|
||||||
line.setCurrentCostPrice(cost.getCurrentCostPrice());
|
line.setCurrentCostPrice(cost.getCurrentCostPrice());
|
||||||
|
@ -392,6 +394,8 @@ public class CostUpdate extends SvrProcess
|
||||||
lines.add(line);
|
lines.add(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (p_SetStandardCostTo.length() > 0)
|
if (p_SetStandardCostTo.length() > 0)
|
||||||
|
@ -401,6 +405,8 @@ public class CostUpdate extends SvrProcess
|
||||||
BigDecimal costs = getCosts(cost, p_SetStandardCostTo);
|
BigDecimal costs = getCosts(cost, p_SetStandardCostTo);
|
||||||
if (costs != null && costs.signum() != 0)
|
if (costs != null && costs.signum() != 0)
|
||||||
{
|
{
|
||||||
|
BigDecimal currentCost = cost.getCurrentCostPrice();
|
||||||
|
if (currentCost == null || currentCost.compareTo(costs) != 0) {
|
||||||
MInventoryLine line = new MInventoryLine(getCtx(), 0, get_TrxName());
|
MInventoryLine line = new MInventoryLine(getCtx(), 0, get_TrxName());
|
||||||
line.setM_Product_ID(cost.getM_Product_ID());
|
line.setM_Product_ID(cost.getM_Product_ID());
|
||||||
line.setCurrentCostPrice(cost.getCurrentCostPrice());
|
line.setCurrentCostPrice(cost.getCurrentCostPrice());
|
||||||
|
@ -411,6 +417,7 @@ public class CostUpdate extends SvrProcess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (p_SetFutureCostTo.length() > 0)
|
if (p_SetFutureCostTo.length() > 0)
|
||||||
{
|
{
|
||||||
BigDecimal costs = getCosts(cost, p_SetFutureCostTo);
|
BigDecimal costs = getCosts(cost, p_SetFutureCostTo);
|
||||||
|
|
Loading…
Reference in New Issue