diff --git a/org.adempiere.base/src/org/compiere/model/MInOut.java b/org.adempiere.base/src/org/compiere/model/MInOut.java index 35768187e1..530ce6012d 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOut.java +++ b/org.adempiere.base/src/org/compiere/model/MInOut.java @@ -1190,12 +1190,7 @@ public class MInOut extends X_M_InOut implements DocAction continue; if (product != null && product.isASIMandatory(isSOTrx())) { - if(product.getAttributeSet()==null){ - m_processMsg = "@NoAttributeSet@=" + product.getValue(); - return DocAction.STATUS_Invalid; - - } - if (! product.getAttributeSet().excludeTableEntry(MInOutLine.Table_ID, isSOTrx())) { + if (product.getAttributeSet() != null && !product.getAttributeSet().excludeTableEntry(MInOutLine.Table_ID, isSOTrx())) { m_processMsg = "@M_AttributeSet_ID@ @IsMandatory@ (@Line@ #" + lines[i].getLine() + ", @M_Product_ID@=" + product.getValue() + ")"; return DocAction.STATUS_Invalid; diff --git a/org.adempiere.base/src/org/compiere/model/MInventory.java b/org.adempiere.base/src/org/compiere/model/MInventory.java index 86d192bd33..a57288f670 100644 --- a/org.adempiere.base/src/org/compiere/model/MInventory.java +++ b/org.adempiere.base/src/org/compiere/model/MInventory.java @@ -343,7 +343,7 @@ public class MInventory extends X_M_Inventory implements DocAction MProduct product = MProduct.get(getCtx(), line.getM_Product_ID()); if (product != null && product.isASIMandatory(line.isSOTrx())) { - if (! product.getAttributeSet().excludeTableEntry(MInventoryLine.Table_ID, line.isSOTrx())) { + if (product.getAttributeSet() != null && !product.getAttributeSet().excludeTableEntry(MInventoryLine.Table_ID, line.isSOTrx())) { MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); String docSubTypeInv = dt.getDocSubTypeInv(); BigDecimal qtyDiff = line.getQtyInternalUse(); diff --git a/org.adempiere.base/src/org/compiere/model/MInventoryLine.java b/org.adempiere.base/src/org/compiere/model/MInventoryLine.java index fe3ec77e96..c56dd88947 100644 --- a/org.adempiere.base/src/org/compiere/model/MInventoryLine.java +++ b/org.adempiere.base/src/org/compiere/model/MInventoryLine.java @@ -261,27 +261,6 @@ public class MInventoryLine extends X_M_InventoryLine log.saveError("ParentComplete", Msg.translate(getCtx(), "M_InventoryLine")); return false; } - /* IDEMPIERE-1770 - ASI validation must be moved to MInventory.prepareIt, saving a line without ASI is ok on draft - if (m_isManualEntry) - { - // Product requires ASI - if (getM_AttributeSetInstance_ID() == 0) - { - MProduct product = MProduct.get(getCtx(), getM_Product_ID()); - if (product != null && product.isASIMandatory(isSOTrx())) - { - if(product.getAttributeSet()==null){ - log.saveError("NoAttributeSet", product.getValue()); - return false; - } - if (! product.getAttributeSet().excludeTableEntry(MInventoryLine.Table_ID, isSOTrx())) { - log.saveError("FillMandatory", Msg.getElement(getCtx(), COLUMNNAME_M_AttributeSetInstance_ID)); - return false; - } - } - } // No ASI - } // manual - */ // Set Line No if (getLine() == 0) diff --git a/org.adempiere.base/src/org/compiere/model/MMovement.java b/org.adempiere.base/src/org/compiere/model/MMovement.java index d84c0d717f..9b23f2d412 100644 --- a/org.adempiere.base/src/org/compiere/model/MMovement.java +++ b/org.adempiere.base/src/org/compiere/model/MMovement.java @@ -298,7 +298,7 @@ public class MMovement extends X_M_Movement implements DocAction MProduct product = line.getProduct(); if (line.getM_AttributeSetInstance_ID() == 0) { if (product != null && product.isASIMandatory(true)) { - if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, true)) { // outgoing + if (product.getAttributeSet() != null && !product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, true)) { // outgoing BigDecimal qtyDiff = line.getMovementQty(); // verify if the ASIs are captured on lineMA MMovementLineMA mas[] = MMovementLineMA.get(getCtx(), @@ -320,7 +320,7 @@ public class MMovement extends X_M_Movement implements DocAction { if (product != null && product.isASIMandatory(false) && line.getM_AttributeSetInstanceTo_ID() == 0) { - if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, false)) { // incoming + if (product.getAttributeSet() != null && !product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, false)) { // incoming m_processMsg = "@Line@ " + line.getLine() + ": @FillMandatory@ @M_AttributeSetInstanceTo_ID@"; return DocAction.STATUS_Invalid; } diff --git a/org.adempiere.base/src/org/compiere/model/MMovementLine.java b/org.adempiere.base/src/org/compiere/model/MMovementLine.java index 5c54a07052..ac2c73e162 100644 --- a/org.adempiere.base/src/org/compiere/model/MMovementLine.java +++ b/org.adempiere.base/src/org/compiere/model/MMovementLine.java @@ -208,22 +208,6 @@ public class MMovementLine extends X_M_MovementLine if (newRecord || is_ValueChanged(COLUMNNAME_MovementQty)) setMovementQty(getMovementQty()); - // Mandatory Instance - /* IDEMPIERE-1770 - ASI validation must be moved to MMovement.prepareIt, saving a line without ASI is ok on draft - MProduct product = getProduct(); - if (getM_AttributeSetInstance_ID() == 0) { - 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; - } - } - } - */ if (getM_AttributeSetInstanceTo_ID() == 0) { //instance id default to same for movement between locator @@ -233,19 +217,6 @@ public class MMovementLine extends X_M_MovementLine setM_AttributeSetInstanceTo_ID(getM_AttributeSetInstance_ID()); } - /* IDEMPIERE-1770 - ASI validation must be moved to MMovement.prepareIt, saving a line without ASI is ok on draft - 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; - } - } - */ } // ASI return true; diff --git a/org.adempiere.base/src/org/compiere/model/MOrder.java b/org.adempiere.base/src/org/compiere/model/MOrder.java index afb98078fa..83b3cbaa96 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrder.java +++ b/org.adempiere.base/src/org/compiere/model/MOrder.java @@ -1347,12 +1347,7 @@ public class MOrder extends X_C_Order implements DocAction if (line.getM_Product_ID() > 0 && line.getM_AttributeSetInstance_ID() == 0) { MProduct product = line.getProduct(); if (product.isASIMandatory(isSOTrx())) { - if(product.getAttributeSet()==null){ - m_processMsg = "@NoAttributeSet@=" + product.getValue(); - return DocAction.STATUS_Invalid; - - } - if (! product.getAttributeSet().excludeTableEntry(MOrderLine.Table_ID, isSOTrx())) { + if (product.getAttributeSet() != null && !product.getAttributeSet().excludeTableEntry(MOrderLine.Table_ID, isSOTrx())) { StringBuilder msg = new StringBuilder("@M_AttributeSet_ID@ @IsMandatory@ (@Line@ #") .append(line.getLine()) .append(", @M_Product_ID@=")