[ 2818420 ] Throw exception when Warehouse is not completed
https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2818420&group_id=176962
This commit is contained in:
parent
7eca8d37c1
commit
916a21dfde
|
@ -361,4 +361,16 @@ public class InOutGen extends GenForm
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
} // generateShipments
|
} // generateShipments
|
||||||
|
|
||||||
|
public void setM_Warehouse_ID(Object value)
|
||||||
|
{
|
||||||
|
this.m_M_Warehouse_ID = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getM_Warehouse_ID()
|
||||||
|
{
|
||||||
|
if (m_M_Warehouse_ID == null)
|
||||||
|
return -1;
|
||||||
|
return ((Integer)m_M_Warehouse_ID);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -183,7 +183,14 @@ public class VGenPanel extends CPanel implements ActionListener, ChangeListener,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
genForm.validate();
|
genForm.validate();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ADialog.error(m_WindowNo, this, "Error", ex.getLocalizedMessage());
|
||||||
|
}
|
||||||
} // actionPerformed
|
} // actionPerformed
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,6 +20,8 @@ import java.beans.VetoableChangeListener;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.exceptions.FillMandatoryException;
|
||||||
|
import org.compiere.apps.ADialog;
|
||||||
import org.compiere.grid.ed.VComboBox;
|
import org.compiere.grid.ed.VComboBox;
|
||||||
import org.compiere.grid.ed.VLookup;
|
import org.compiere.grid.ed.VLookup;
|
||||||
import org.compiere.model.MLookup;
|
import org.compiere.model.MLookup;
|
||||||
|
@ -137,7 +139,7 @@ public class VInOutGen extends InOutGen implements FormPanel, ActionListener, Ve
|
||||||
fWarehouse = new VLookup ("M_Warehouse_ID", true, false, true, orgL);
|
fWarehouse = new VLookup ("M_Warehouse_ID", true, false, true, orgL);
|
||||||
lWarehouse.setText(Msg.translate(Env.getCtx(), "M_Warehouse_ID"));
|
lWarehouse.setText(Msg.translate(Env.getCtx(), "M_Warehouse_ID"));
|
||||||
fWarehouse.addVetoableChangeListener(this);
|
fWarehouse.addVetoableChangeListener(this);
|
||||||
m_M_Warehouse_ID = fWarehouse.getValue();
|
setM_Warehouse_ID(fWarehouse.getValue());
|
||||||
// Document Action Prepared/ Completed
|
// Document Action Prepared/ Completed
|
||||||
MLookup docActionL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 4324 /* M_InOut.DocStatus */,
|
MLookup docActionL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 4324 /* M_InOut.DocStatus */,
|
||||||
DisplayType.List, Env.getLanguage(Env.getCtx()), "DocAction", 135 /* _Document Action */,
|
DisplayType.List, Env.getLanguage(Env.getCtx()), "DocAction", 135 /* _Document Action */,
|
||||||
|
@ -176,22 +178,37 @@ public class VInOutGen extends InOutGen implements FormPanel, ActionListener, Ve
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
validate();
|
validate();
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
ADialog.error(m_WindowNo, this.panel, "Error", ex.getLocalizedMessage());
|
||||||
|
}
|
||||||
} // actionPerformed
|
} // actionPerformed
|
||||||
|
|
||||||
public void validate()
|
public void validate()
|
||||||
{
|
{
|
||||||
panel.saveSelection();
|
panel.saveSelection();
|
||||||
|
|
||||||
|
if (getM_Warehouse_ID() <= 0)
|
||||||
|
{
|
||||||
|
throw new FillMandatoryException("M_Warehouse_ID");
|
||||||
|
}
|
||||||
|
|
||||||
ArrayList<Integer> selection = getSelection();
|
ArrayList<Integer> selection = getSelection();
|
||||||
if (selection != null
|
if (selection != null
|
||||||
&& selection.size() > 0
|
&& selection.size() > 0
|
||||||
&& isSelectionActive() // on selection tab
|
&& isSelectionActive()) // on selection tab
|
||||||
&& m_M_Warehouse_ID != null)
|
{
|
||||||
panel.generate();
|
panel.generate();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
panel.dispose();
|
panel.dispose();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vetoable Change Listener - requery
|
* Vetoable Change Listener - requery
|
||||||
|
@ -201,7 +218,7 @@ public class VInOutGen extends InOutGen implements FormPanel, ActionListener, Ve
|
||||||
{
|
{
|
||||||
log.info(e.getPropertyName() + "=" + e.getNewValue());
|
log.info(e.getPropertyName() + "=" + e.getNewValue());
|
||||||
if (e.getPropertyName().equals("M_Warehouse_ID"))
|
if (e.getPropertyName().equals("M_Warehouse_ID"))
|
||||||
m_M_Warehouse_ID = e.getNewValue();
|
setM_Warehouse_ID(e.getNewValue());
|
||||||
if (e.getPropertyName().equals("C_BPartner_ID"))
|
if (e.getPropertyName().equals("C_BPartner_ID"))
|
||||||
{
|
{
|
||||||
m_C_BPartner_ID = e.getNewValue();
|
m_C_BPartner_ID = e.getNewValue();
|
||||||
|
|
Loading…
Reference in New Issue