IDEMPIERE-3046 Add Currency Field to Cost Adjustment Window
Resolve issue Costing-level=batch/lot in the cost adjustment line with error message No costing record.
This commit is contained in:
parent
f5ab7ac27e
commit
d0ef43655e
|
@ -75,12 +75,18 @@ public class CostAdjustmentCalloutFactory implements IColumnCalloutFactory {
|
||||||
} else {
|
} else {
|
||||||
MProduct product = MProduct.get(ctx, (Integer) value);
|
MProduct product = MProduct.get(ctx, (Integer) value);
|
||||||
MClient client = MClient.get(ctx);
|
MClient client = MClient.get(ctx);
|
||||||
|
MAcctSchema as = client.getAcctSchema();
|
||||||
|
|
||||||
|
String costingLevel = product.getCostingLevel(as);
|
||||||
|
if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(costingLevel)) {
|
||||||
|
mTab.setValue(I_M_InventoryLine.COLUMNNAME_CurrentCostPrice, BigDecimal.ZERO);
|
||||||
|
mTab.setValue(I_M_InventoryLine.COLUMNNAME_NewCostPrice, BigDecimal.ZERO);
|
||||||
|
}else {
|
||||||
Object asiValue = mTab.getValue(I_M_InventoryLine.COLUMNNAME_M_AttributeSetInstance_ID);
|
Object asiValue = mTab.getValue(I_M_InventoryLine.COLUMNNAME_M_AttributeSetInstance_ID);
|
||||||
int M_ASI_ID = asiValue != null ? (Integer)asiValue : 0;
|
int M_ASI_ID = asiValue != null ? (Integer)asiValue : 0;
|
||||||
int AD_Org_ID = inventory.getAD_Org_ID();
|
int AD_Org_ID = inventory.getAD_Org_ID();
|
||||||
int C_Currency_ID = inventory.getC_Currency_ID();
|
int C_Currency_ID = inventory.getC_Currency_ID();
|
||||||
|
|
||||||
MAcctSchema as = client.getAcctSchema();
|
|
||||||
if (as.getC_Currency_ID() != C_Currency_ID)
|
if (as.getC_Currency_ID() != C_Currency_ID)
|
||||||
{
|
{
|
||||||
MAcctSchema[] ass = MAcctSchema.getClientAcctSchema(ctx, client.get_ID());
|
MAcctSchema[] ass = MAcctSchema.getClientAcctSchema(ctx, client.get_ID());
|
||||||
|
@ -97,7 +103,8 @@ public class CostAdjustmentCalloutFactory implements IColumnCalloutFactory {
|
||||||
mTab.setValue(mField, null);
|
mTab.setValue(mField, null);
|
||||||
return Msg.getMsg(Env.getCtx(), "NoCostingRecord");
|
return Msg.getMsg(Env.getCtx(), "NoCostingRecord");
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
mTab.setValue(I_M_InventoryLine.COLUMNNAME_CurrentCostPrice, cost.getCurrentCostPrice());
|
mTab.setValue(I_M_InventoryLine.COLUMNNAME_CurrentCostPrice, cost.getCurrentCostPrice());
|
||||||
mTab.setValue(I_M_InventoryLine.COLUMNNAME_NewCostPrice, cost.getCurrentCostPrice());
|
mTab.setValue(I_M_InventoryLine.COLUMNNAME_NewCostPrice, cost.getCurrentCostPrice());
|
||||||
}
|
}
|
||||||
|
@ -139,6 +146,13 @@ public class CostAdjustmentCalloutFactory implements IColumnCalloutFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MCost cost = product.getCostingRecord(as, AD_Org_ID, M_ASI_ID, costingMethod);
|
MCost cost = product.getCostingRecord(as, AD_Org_ID, M_ASI_ID, costingMethod);
|
||||||
|
if (cost == null) {
|
||||||
|
if (!MCostElement.COSTINGMETHOD_StandardCosting.equals(costingMethod)) {
|
||||||
|
mTab.setValue(mField, null);
|
||||||
|
return Msg.getMsg(Env.getCtx(), "NoCostingRecord");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (cost != null) {
|
if (cost != null) {
|
||||||
BigDecimal currentCost = (BigDecimal) mTab.getValue(I_M_InventoryLine.COLUMNNAME_CurrentCostPrice);
|
BigDecimal currentCost = (BigDecimal) mTab.getValue(I_M_InventoryLine.COLUMNNAME_CurrentCostPrice);
|
||||||
if (currentCost == null || currentCost.compareTo(cost.getCurrentCostPrice())==0) return null;
|
if (currentCost == null || currentCost.compareTo(cost.getCurrentCostPrice())==0) return null;
|
||||||
|
@ -146,6 +160,7 @@ public class CostAdjustmentCalloutFactory implements IColumnCalloutFactory {
|
||||||
mTab.setValue(I_M_InventoryLine.COLUMNNAME_CurrentCostPrice, cost.getCurrentCostPrice());
|
mTab.setValue(I_M_InventoryLine.COLUMNNAME_CurrentCostPrice, cost.getCurrentCostPrice());
|
||||||
mTab.setValue(I_M_InventoryLine.COLUMNNAME_NewCostPrice, cost.getCurrentCostPrice());
|
mTab.setValue(I_M_InventoryLine.COLUMNNAME_NewCostPrice, cost.getCurrentCostPrice());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue