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:
parent
3384819c49
commit
dcd7d6a41e
|
@ -517,8 +517,26 @@ public class MInOutLine extends X_M_InOutLine
|
|||
if (getParent().pendingConfirmations()) {
|
||||
if ( newRecord ||
|
||||
(is_ValueChanged(COLUMNNAME_MovementQty) && !is_ValueChanged(COLUMNNAME_TargetQty))) {
|
||||
log.saveError("SaveError", Msg.parseTranslation(getCtx(), "@Open@: @M_InOutConfirm_ID@"));
|
||||
return false;
|
||||
|
||||
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 ]
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue