IDEMPIERE-3062 Unable to complete MR with qty >1 with Attribute Set of Always Mandatory (#144)

This commit is contained in:
Carlos Ruiz 2020-07-15 05:05:49 +02:00 committed by GitHub
parent 9da97ab06d
commit 4afaed6140
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 3 deletions

View File

@ -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;
}
}
}
}