[ 1689521 ] Issue when you need buy with um minor that stoked

This commit is contained in:
Heng Sin Low 2007-07-16 04:38:44 +00:00
parent 190ff03523
commit 64d99c7354
1 changed files with 17 additions and 10 deletions

View File

@ -696,24 +696,31 @@ public class MUOMConversion extends X_C_UOM_Conversion
return false; return false;
} }
// Enforce Product UOM // Enforce Product UOM
if (getM_Product_ID() != 0 if (MSysConfig.getBooleanValue("ProductUOMConversionUOMValidate", true))
&& (newRecord || is_ValueChanged("M_Product_ID")))
{ {
MProduct product = MProduct.get(getCtx(), getM_Product_ID()); if (getM_Product_ID() != 0
if (product.getC_UOM_ID() != getC_UOM_ID()) && (newRecord || is_ValueChanged("M_Product_ID")))
{ {
MUOM uom = MUOM.get(getCtx(), product.getC_UOM_ID()); MProduct product = MProduct.get(getCtx(), getM_Product_ID());
log.saveError("ProductUOMConversionUOMError", uom.getName()); if (product.getC_UOM_ID() != getC_UOM_ID())
return false; {
MUOM uom = MUOM.get(getCtx(), product.getC_UOM_ID());
log.saveError("ProductUOMConversionUOMError", uom.getName());
return false;
}
} }
} }
// The Product UoM needs to be the smallest UoM - Multiplier must be > 0 // The Product UoM needs to be the smallest UoM - Multiplier must be > 0
if (getM_Product_ID() != 0 && getDivideRate().compareTo(Env.ONE) < 0) if (MSysConfig.getBooleanValue("ProductUOMConversionRateValidate", true))
{ {
log.saveError("ProductUOMConversionRateError", ""); if (getM_Product_ID() != 0 && getDivideRate().compareTo(Env.ONE) < 0)
return false; {
log.saveError("ProductUOMConversionRateError", "");
return false;
}
} }
return true; return true;
} // beforeSave } // beforeSave