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());
|
||||
MAcctSchema primarySchema = client.getAcctSchema();
|
||||
MInventory inventoryDoc = null;
|
||||
pstmt = DB.prepareStatement (sql, null);
|
||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||
pstmt.setInt (1, m_ce.getM_CostElement_ID());
|
||||
if (p_M_Product_Category_ID != 0)
|
||||
pstmt.setInt (2, p_M_Product_Category_ID);
|
||||
|
@ -381,9 +381,11 @@ public class CostUpdate extends SvrProcess
|
|||
{
|
||||
cost.setFutureCostPrice(costs);
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if (lines != null)
|
||||
{
|
||||
BigDecimal currentCost = cost.getCurrentCostPrice();
|
||||
if (currentCost == null || currentCost.compareTo(costs) != 0) {
|
||||
MInventoryLine line = new MInventoryLine(getCtx(), 0, get_TrxName());
|
||||
line.setM_Product_ID(cost.getM_Product_ID());
|
||||
line.setCurrentCostPrice(cost.getCurrentCostPrice());
|
||||
|
@ -392,6 +394,8 @@ public class CostUpdate extends SvrProcess
|
|||
lines.add(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p_SetStandardCostTo.length() > 0)
|
||||
|
@ -401,6 +405,8 @@ public class CostUpdate extends SvrProcess
|
|||
BigDecimal costs = getCosts(cost, p_SetStandardCostTo);
|
||||
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());
|
||||
line.setM_Product_ID(cost.getM_Product_ID());
|
||||
line.setCurrentCostPrice(cost.getCurrentCostPrice());
|
||||
|
@ -411,6 +417,7 @@ public class CostUpdate extends SvrProcess
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (p_SetFutureCostTo.length() > 0)
|
||||
{
|
||||
BigDecimal costs = getCosts(cost, p_SetFutureCostTo);
|
||||
|
|
Loading…
Reference in New Issue