Requisition Reactivate add Rule

--HG--
branch : EDII
This commit is contained in:
hodianto 2018-11-30 16:20:28 +07:00
parent b12aecbf3a
commit 29b7b7de3b
2 changed files with 27 additions and 2 deletions

View File

@ -36,6 +36,7 @@ public class MID_MRequisition extends MRequisition implements DocOptions{
@Override
public boolean reActivateIt() {
set_ValueNoCheck("IsReactivate", "Y");
setDocStatus(DocAction.STATUS_InProgress);
setDocAction(DocAction.ACTION_Complete);
setProcessed(false);

View File

@ -3,9 +3,11 @@ package andromedia.midsuit.model;
import java.sql.ResultSet;
import java.util.Properties;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.MRequisition;
import org.compiere.model.MRequisitionLine;
import org.compiere.util.DB;
import org.compiere.util.Msg;
public class MID_MRequisitionLine extends MRequisitionLine{
@ -25,10 +27,32 @@ public class MID_MRequisitionLine extends MRequisitionLine{
super(ctx, rs, trxName);
// TODO Auto-generated constructor stub
}
@Override
protected boolean beforeSave(boolean newRecord) {
if(!newRecord){
MID_MRequisition requisition = new MID_MRequisition(getCtx(), getM_Requisition_ID(), get_TrxName());
Boolean isReactivate = requisition.get_ValueAsBoolean("IsReactivate");
if(isReactivate){
if(is_ValueChanged("M_Product_ID")){
throw new AdempiereException("Product cannot be changed !!!");
}
}
}
return super.beforeSave(newRecord);
}
@Override
protected boolean beforeDelete() {
MID_MRequisition requisition = new MID_MRequisition(getCtx(), getM_Requisition_ID(), get_TrxName());
Boolean isReactivate = requisition.get_ValueAsBoolean("IsReactivate");
if(isReactivate){
log.saveError("DeleteError", "Line Reactivate !!! Cannot be deleted !!!");
return false;
}
return super.beforeDelete();
}
@Override
protected boolean afterSave(boolean newRecord, boolean success) {
MID_MRequisition requisition = new MID_MRequisition(getCtx(), getM_Requisition_ID(), get_TrxName());
super.afterSave(newRecord, success);
// requisition.recalculateTax(get_TrxName());
String sql = "UPDATE M_Requisition SET TaxAmt = "