BF [ 2993853 ] Voiding/Reversing Receipt should void confirmations
Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2993853
This commit is contained in:
parent
762097c1f2
commit
7efd8b5c40
|
@ -25,6 +25,7 @@ import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
import org.compiere.print.ReportEngine;
|
import org.compiere.print.ReportEngine;
|
||||||
import org.compiere.process.DocAction;
|
import org.compiere.process.DocAction;
|
||||||
import org.compiere.process.DocumentEngine;
|
import org.compiere.process.DocumentEngine;
|
||||||
|
@ -49,6 +50,9 @@ import org.compiere.util.Msg;
|
||||||
* @author Armen Rizal, Goodwill Consulting
|
* @author Armen Rizal, Goodwill Consulting
|
||||||
* <li>BF [ 1745154 ] Cost in Reversing Material Related Docs
|
* <li>BF [ 1745154 ] Cost in Reversing Material Related Docs
|
||||||
* @see http://sourceforge.net/tracker/?func=detail&atid=879335&aid=1948157&group_id=176962
|
* @see http://sourceforge.net/tracker/?func=detail&atid=879335&aid=1948157&group_id=176962
|
||||||
|
* @author Teo Sarca, teo.sarca@gmail.com
|
||||||
|
* <li>BF [ 2993853 ] Voiding/Reversing Receipt should void confirmations
|
||||||
|
* https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2993853&group_id=176962
|
||||||
*/
|
*/
|
||||||
public class MInOut extends X_M_InOut implements DocAction
|
public class MInOut extends X_M_InOut implements DocAction
|
||||||
{
|
{
|
||||||
|
@ -919,6 +923,19 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
else if (ship)
|
else if (ship)
|
||||||
MInOutConfirm.create (this, MInOutConfirm.CONFIRMTYPE_ShipReceiptConfirm, true);
|
MInOutConfirm.create (this, MInOutConfirm.CONFIRMTYPE_ShipReceiptConfirm, true);
|
||||||
} // createConfirmation
|
} // createConfirmation
|
||||||
|
|
||||||
|
private void voidConfirmations()
|
||||||
|
{
|
||||||
|
for(MInOutConfirm confirm : getConfirmations(true))
|
||||||
|
{
|
||||||
|
if (!confirm.isProcessed())
|
||||||
|
{
|
||||||
|
if (!confirm.processIt(MInOutConfirm.DOCACTION_Void))
|
||||||
|
throw new AdempiereException(confirm.getProcessMsg());
|
||||||
|
confirm.saveEx();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1922,6 +1939,11 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
line.save(get_TrxName());
|
line.save(get_TrxName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// Void Confirmations
|
||||||
|
setDocStatus(DOCSTATUS_Voided); // need to set & save docstatus to be able to check it in MInOutConfirm.voidIt()
|
||||||
|
saveEx();
|
||||||
|
voidConfirmations();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2068,6 +2090,12 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
reversal.saveEx(get_TrxName());
|
reversal.saveEx(get_TrxName());
|
||||||
//
|
//
|
||||||
addDescription("(" + reversal.getDocumentNo() + "<-)");
|
addDescription("(" + reversal.getDocumentNo() + "<-)");
|
||||||
|
|
||||||
|
//
|
||||||
|
// Void Confirmations
|
||||||
|
setDocStatus(DOCSTATUS_Reversed); // need to set & save docstatus to be able to check it in MInOutConfirm.voidIt()
|
||||||
|
saveEx();
|
||||||
|
voidConfirmations();
|
||||||
|
|
||||||
// After reverseCorrect
|
// After reverseCorrect
|
||||||
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT);
|
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT);
|
||||||
|
|
|
@ -40,6 +40,9 @@ import org.compiere.util.Msg;
|
||||||
* @author Teo Sarca, www.arhipac.ro
|
* @author Teo Sarca, www.arhipac.ro
|
||||||
* <li>BF [ 2800460 ] System generate Material Receipt with no lines
|
* <li>BF [ 2800460 ] System generate Material Receipt with no lines
|
||||||
* https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2800460&group_id=176962
|
* https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2800460&group_id=176962
|
||||||
|
* @author Teo Sarca, teo.sarca@gmail.com
|
||||||
|
* <li>BF [ 2993853 ] Voiding/Reversing Receipt should void confirmations
|
||||||
|
* https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2993853&group_id=176962
|
||||||
*/
|
*/
|
||||||
public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
|
public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
|
||||||
{
|
{
|
||||||
|
@ -525,7 +528,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
|
||||||
|
|
||||||
m_processMsg = "Split @M_InOut_ID@=" + split.getDocumentNo()
|
m_processMsg = "Split @M_InOut_ID@=" + split.getDocumentNo()
|
||||||
+ " - @M_InOutConfirm_ID@=";
|
+ " - @M_InOutConfirm_ID@=";
|
||||||
|
|
||||||
// Create Dispute Confirmation
|
// Create Dispute Confirmation
|
||||||
if (!split.processIt(DocAction.ACTION_Prepare))
|
if (!split.processIt(DocAction.ACTION_Prepare))
|
||||||
throw new AdempiereException(split.getProcessMsg());
|
throw new AdempiereException(split.getProcessMsg());
|
||||||
|
@ -645,12 +648,53 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
|
||||||
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID);
|
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID);
|
||||||
if (m_processMsg != null)
|
if (m_processMsg != null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (DOCSTATUS_Closed.equals(getDocStatus())
|
||||||
|
|| DOCSTATUS_Reversed.equals(getDocStatus())
|
||||||
|
|| DOCSTATUS_Voided.equals(getDocStatus()))
|
||||||
|
{
|
||||||
|
m_processMsg = "Document Closed: " + getDocStatus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not Processed
|
||||||
|
if (DOCSTATUS_Drafted.equals(getDocStatus())
|
||||||
|
|| DOCSTATUS_Invalid.equals(getDocStatus())
|
||||||
|
|| DOCSTATUS_InProgress.equals(getDocStatus())
|
||||||
|
|| DOCSTATUS_Approved.equals(getDocStatus())
|
||||||
|
|| DOCSTATUS_NotApproved.equals(getDocStatus()) )
|
||||||
|
{
|
||||||
|
MInOut inout = (MInOut)getM_InOut();
|
||||||
|
if (!MInOut.DOCSTATUS_Voided.equals(inout.getDocStatus())
|
||||||
|
&& !MInOut.DOCSTATUS_Reversed.equals(inout.getDocStatus()) )
|
||||||
|
{
|
||||||
|
throw new AdempiereException("@M_InOut_ID@ @DocStatus@<>VO");
|
||||||
|
}
|
||||||
|
for (MInOutLineConfirm confirmLine : getLines(true))
|
||||||
|
{
|
||||||
|
confirmLine.setTargetQty(Env.ZERO);
|
||||||
|
confirmLine.setConfirmedQty(Env.ZERO);
|
||||||
|
confirmLine.setScrappedQty(Env.ZERO);
|
||||||
|
confirmLine.setDifferenceQty(Env.ZERO);
|
||||||
|
confirmLine.setProcessed(true);
|
||||||
|
confirmLine.saveEx();
|
||||||
|
}
|
||||||
|
setIsCancelled(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return reverseCorrectIt();
|
||||||
|
}
|
||||||
|
|
||||||
// After Void
|
// After Void
|
||||||
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID);
|
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID);
|
||||||
if (m_processMsg != null)
|
if (m_processMsg != null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return false;
|
setProcessed(true);
|
||||||
|
setDocAction(DOCACTION_None);
|
||||||
|
|
||||||
|
return true;
|
||||||
} // voidIt
|
} // voidIt
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue