IDEMPIERE-3037 Date Material Policy not respected in shipment / remove duplicated code (thanks to Hiep)

This commit is contained in:
Carlos Ruiz 2017-06-25 01:02:50 +02:00
parent 822453941d
commit 7c535366bd
1 changed files with 4 additions and 14 deletions

View File

@ -1428,20 +1428,10 @@ public class MInOut extends X_M_InOut implements DocAction
if (mtrx == null)
{
Timestamp dateMPolicy= null;
MStorageOnHand[] storages = null;
if (sLine.getMovementQty().compareTo(Env.ZERO) > 0) {
// Find Date Material Policy bases on ASI
storages = MStorageOnHand.getWarehouse(getCtx(), 0,
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(), 0,
sLine.getM_Product_ID(), sLine.getM_AttributeSetInstance_ID(), null,
MClient.MMPOLICY_FiFo.equals(product.getMMPolicy()), false,
sLine.getM_Locator_ID(), get_TrxName());
} else {
//Case of reversal
storages = MStorageOnHand.getWarehouse(getCtx(), 0,
sLine.getM_Product_ID(), sLine.getM_AttributeSetInstance_ID(), null,
MClient.MMPOLICY_FiFo.equals(product.getMMPolicy()), false,
sLine.getM_Locator_ID(), get_TrxName());
}
for (MStorageOnHand storage : storages) {
if (storage.getQtyOnHand().compareTo(sLine.getMovementQty()) >= 0) {
dateMPolicy = storage.getDateMaterialPolicy();