IDEMPIERE-1709 / IDEMPIERE-2624 Cant confirm 0 qty on Movement Confir… (#227)

* IDEMPIERE-1709 / IDEMPIERE-2624 Cant confirm 0 qty on Movement Confirmation

Implement void for movement confirm

* IDEMPIERE-1709 / IDEMPIERE-2624 Cant confirm 0 qty on Movement Confirmation

Voiding the confirmation voids the inventory move too

* IDEMPIERE-1709 / IDEMPIERE-2624 Cant confirm 0 qty on Movement Confirmation

Similar case found in MInOut - cannot void because of catch-22
Allow to void MInOut -> it automatically voids all pending confirmations

* IDEMPIERE-1709 / IDEMPIERE-2624 Cant confirm 0 qty on Movement Confirmation

Set quantities in zero when voiding movement confirmation
This commit is contained in:
Carlos Ruiz 2020-08-31 08:23:33 +02:00 committed by GitHub
parent 3384819c49
commit dcd7d6a41e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 49 additions and 4 deletions

View File

@ -517,10 +517,28 @@ public class MInOutLine extends X_M_InOutLine
if (getParent().pendingConfirmations()) {
if ( newRecord ||
(is_ValueChanged(COLUMNNAME_MovementQty) && !is_ValueChanged(COLUMNNAME_TargetQty))) {
if (getMovementQty().signum() == 0)
{
String docAction = getParent().getDocAction();
String docStatus = getParent().getDocStatus();
if ( MInOut.DOCACTION_Void.equals(docAction)
&& ( MInOut.DOCSTATUS_Drafted.equals(docStatus)
|| MInOut.DOCSTATUS_Invalid.equals(docStatus)
|| MInOut.DOCSTATUS_InProgress.equals(docStatus)
|| MInOut.DOCSTATUS_Approved.equals(docStatus)
|| MInOut.DOCSTATUS_NotApproved.equals(docStatus)
)
)
{
// OK to save qty=0 when voiding
} else {
log.saveError("SaveError", Msg.parseTranslation(getCtx(), "@Open@: @M_InOutConfirm_ID@"));
return false;
}
}
}
}
// Locator is mandatory if no charge is defined - teo_sarca BF [ 2757978 ]
if(getProduct() != null && MProduct.PRODUCTTYPE_Item.equals(getProduct().getProductType()))
{

View File

@ -604,12 +604,39 @@ public class MMovementConfirm extends X_M_MovementConfirm implements DocAction
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID);
if (m_processMsg != null)
return false;
MMovement move = new MMovement (getCtx(), getM_Movement_ID(), get_TrxName());
for (MMovementLineConfirm confirmLine : getLines(true))
{
confirmLine.setTargetQty(Env.ZERO);
confirmLine.setConfirmedQty(Env.ZERO);
confirmLine.setScrappedQty(Env.ZERO);
confirmLine.setDifferenceQty(Env.ZERO);
confirmLine.setProcessed(true);
confirmLine.saveEx();
}
// set confirmation as processed to allow voiding the inventory move
setProcessed(true);
saveEx();
// voiding the confirmation voids also the inventory move
ProcessInfo processInfo = MWorkflow.runDocumentActionWorkflow(move, DocAction.ACTION_Void);
if (processInfo.isError())
{
m_processMsg = processInfo.getSummary();
setProcessed(false);
return false;
}
// After Void
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID);
if (m_processMsg != null)
return false;
return false;
setDocAction(DOCACTION_None);
return true;
} // voidIt
/**