IDEMPIERE-2318 Null pointer exception when Product has not Attribute set configured and costing level is batch / fix MovementLine cannot be saved

This commit is contained in:
Carlos Ruiz 2014-11-25 11:19:18 -05:00
parent ffee60df18
commit ff3366bea9
1 changed files with 8 additions and 8 deletions

View File

@ -211,11 +211,11 @@ public class MMovementLine extends X_M_MovementLine
// Mandatory Instance
MProduct product = getProduct();
if (getM_AttributeSetInstance_ID() == 0) {
if (product != null && product.getAttributeSet()==null) {
log.saveError("NoAttributeSet", product.getValue());
return false;
}
if (product != null && product.isASIMandatory(true)) {
if (product.getAttributeSet()==null) {
log.saveError("NoAttributeSet", product.getValue());
return false;
}
if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, true /*outgoing*/)) {
log.saveError("FillMandatory", Msg.getElement(getCtx(), COLUMNNAME_M_AttributeSetInstance_ID));
return false;
@ -231,12 +231,12 @@ public class MMovementLine extends X_M_MovementLine
setM_AttributeSetInstanceTo_ID(getM_AttributeSetInstance_ID());
}
if (product != null && product.getAttributeSet()==null) {
log.saveError("NoAttributeSet", product.getValue());
return false;
}
if (product != null && product.isASIMandatory(false) && getM_AttributeSetInstanceTo_ID() == 0)
{
if (product.getAttributeSet()==null) {
log.saveError("NoAttributeSet", product.getValue());
return false;
}
if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, false /*incoming*/)) {
log.saveError("FillMandatory", Msg.getElement(getCtx(), COLUMNNAME_M_AttributeSetInstanceTo_ID));
return false;