diff --git a/org.adempiere.base/src/org/compiere/model/MInOut.java b/org.adempiere.base/src/org/compiere/model/MInOut.java index be0113f9db..31fc959547 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOut.java +++ b/org.adempiere.base/src/org/compiere/model/MInOut.java @@ -1203,9 +1203,21 @@ public class MInOut extends X_M_InOut implements DocAction if (product != null && product.isASIMandatory(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; + BigDecimal qtyDiff = line.getMovementQty(); + // verify if the ASIs are captured on lineMA + MInOutLineMA mas[] = MInOutLineMA.get(getCtx(), + line.getM_InOut_ID(), get_TrxName()); + BigDecimal qtyma = Env.ZERO; + for (MInOutLineMA ma : mas) { + if (! ma.isAutoGenerated()) { + qtyma = qtyma.add(ma.getMovementQty()); + } + } + if (qtyma.subtract(qtyDiff).signum() != 0) { + m_processMsg = "@M_AttributeSet_ID@ @IsMandatory@ (@Line@ #" + lines[i].getLine() + + ", @M_Product_ID@=" + product.getValue() + ")"; + return DocAction.STATUS_Invalid; + } } } }