IDEMPIERE-98 Implement void for completed RMAs
http://jira.idempiere.com/browse/IDEMPIERE-98
This commit is contained in:
parent
45b0d10efe
commit
94ed271583
|
@ -0,0 +1,13 @@
|
|||
-- Nov 22, 2011 8:15:34 PM COT
|
||||
-- IDEMPIERE-98 Implement void for completed RMAs
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,Value,IsActive,Updated,AD_Client_ID,AD_Org_ID,CreatedBy,Created,UpdatedBy) VALUES ('E','This RMA cannot be voided because it has associated returns, please void the returns first',53161,'D','RMACannotBeVoided','Y',TO_DATE('2011-11-22 20:15:33','YYYY-MM-DD HH24:MI:SS'),0,0,100,TO_DATE('2011-11-22 20:15:33','YYYY-MM-DD HH24:MI:SS'),100)
|
||||
;
|
||||
|
||||
-- Nov 22, 2011 8:15:34 PM COT
|
||||
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53161 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
|
||||
;
|
||||
|
||||
-- Nov 22, 2011 8:16:43 PM COT
|
||||
UPDATE AD_Message_Trl SET IsTranslated='Y',MsgText='Esta autorización no puede anularse porque tiene devoluciones asociadas, por favor anular primero las devoluciones',Updated=TO_DATE('2011-11-22 20:16:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=53161 AND AD_Language='es_CO'
|
||||
;
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
SET CLIENT_ENCODING TO 'UTF8';
|
||||
|
||||
-- Nov 22, 2011 8:15:34 PM COT
|
||||
-- IDEMPIERE-98 Implement void for completed RMAs
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,Value,IsActive,Updated,AD_Client_ID,AD_Org_ID,CreatedBy,Created,UpdatedBy) VALUES ('E','This RMA cannot be voided because it has associated returns, please void the returns first',53161,'D','RMACannotBeVoided','Y',TO_TIMESTAMP('2011-11-22 20:15:33','YYYY-MM-DD HH24:MI:SS'),0,0,100,TO_TIMESTAMP('2011-11-22 20:15:33','YYYY-MM-DD HH24:MI:SS'),100)
|
||||
;
|
||||
|
||||
-- Nov 22, 2011 8:15:34 PM COT
|
||||
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53161 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
|
||||
;
|
||||
|
||||
-- Nov 22, 2011 8:16:43 PM COT
|
||||
UPDATE AD_Message_Trl SET IsTranslated='Y',MsgText='Esta autorización no puede anularse porque tiene devoluciones asociadas, por favor anular primero las devoluciones',Updated=TO_TIMESTAMP('2011-11-22 20:16:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=53161 AND AD_Language='es_CO'
|
||||
;
|
||||
|
|
@ -623,19 +623,33 @@ public class MRMA extends X_M_RMA implements DocAction
|
|||
if (m_processMsg != null)
|
||||
return false;
|
||||
|
||||
MRMALine lines[] = getLines(true);
|
||||
// Set Qty and Amt on all lines to be Zero
|
||||
for (MRMALine rmaLine : lines)
|
||||
// IDEMPIERE-98 - Implement void for completed RMAs - Diego Ruiz - globalqss
|
||||
String validation = "SELECT COUNT(1) "
|
||||
+"FROM M_InOut "
|
||||
+"WHERE M_RMA_ID=? AND (DocStatus NOT IN ('VO','RE'))";
|
||||
int count = DB.getSQLValueEx(get_TrxName(), validation, getM_RMA_ID()) ;
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
rmaLine.addDescription(Msg.getMsg(getCtx(), "Voided") + " (" + rmaLine.getQty() + ")");
|
||||
rmaLine.setQty(Env.ZERO);
|
||||
rmaLine.setAmt(Env.ZERO);
|
||||
rmaLine.saveEx();
|
||||
MRMALine lines[] = getLines(true);
|
||||
// Set Qty and Amt on all lines to be Zero
|
||||
for (MRMALine rmaLine : lines)
|
||||
{
|
||||
rmaLine.addDescription(Msg.getMsg(getCtx(), "Voided") + " (" + rmaLine.getQty() + ")");
|
||||
rmaLine.setQty(Env.ZERO);
|
||||
rmaLine.setAmt(Env.ZERO);
|
||||
rmaLine.saveEx();
|
||||
}
|
||||
|
||||
addDescription(Msg.getMsg(getCtx(), "Voided"));
|
||||
setAmt(Env.ZERO);
|
||||
}
|
||||
|
||||
addDescription(Msg.getMsg(getCtx(), "Voided"));
|
||||
setAmt(Env.ZERO);
|
||||
|
||||
else
|
||||
{
|
||||
m_processMsg = Msg.getMsg(getCtx(), "RMACannotBeVoided");
|
||||
return false;
|
||||
}
|
||||
|
||||
// After Void
|
||||
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID);
|
||||
if (m_processMsg != null)
|
||||
|
|
|
@ -41,6 +41,7 @@ import org.compiere.model.MJournalBatch;
|
|||
import org.compiere.model.MMovement;
|
||||
import org.compiere.model.MOrder;
|
||||
import org.compiere.model.MPayment;
|
||||
import org.compiere.model.MRMA;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.model.PO;
|
||||
|
@ -1138,6 +1139,17 @@ public class DocumentEngine implements DocAction
|
|||
options[index++] = DocumentEngine.ACTION_ReActivate;
|
||||
}
|
||||
}
|
||||
/********************
|
||||
* RMA Process
|
||||
*/
|
||||
else if (AD_Table_ID == MRMA.Table_ID)
|
||||
{
|
||||
if(docStatus.equals(DocumentEngine.STATUS_Completed))
|
||||
{
|
||||
// IDEMPIERE-98 - Implement void for completed RMAs - Diego Ruiz - globalqss
|
||||
options[index++] = DocumentEngine.ACTION_Void;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue