[ 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:
teo_sarca 2009-07-08 15:33:46 +00:00
parent 7eca8d37c1
commit 916a21dfde
3 changed files with 42 additions and 6 deletions

View File

@ -361,4 +361,16 @@ public class InOutGen extends GenForm
return info;
} // 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);
}
}

View File

@ -183,7 +183,14 @@ public class VGenPanel extends CPanel implements ActionListener, ChangeListener,
return;
}
genForm.validate();
try
{
genForm.validate();
}
catch (Exception ex)
{
ADialog.error(m_WindowNo, this, "Error", ex.getLocalizedMessage());
}
} // actionPerformed
/**

View File

@ -20,6 +20,8 @@ import java.beans.VetoableChangeListener;
import java.util.ArrayList;
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.VLookup;
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);
lWarehouse.setText(Msg.translate(Env.getCtx(), "M_Warehouse_ID"));
fWarehouse.addVetoableChangeListener(this);
m_M_Warehouse_ID = fWarehouse.getValue();
setM_Warehouse_ID(fWarehouse.getValue());
// Document Action Prepared/ Completed
MLookup docActionL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 4324 /* M_InOut.DocStatus */,
DisplayType.List, Env.getLanguage(Env.getCtx()), "DocAction", 135 /* _Document Action */,
@ -176,21 +178,36 @@ public class VInOutGen extends InOutGen implements FormPanel, ActionListener, Ve
return;
}
validate();
try
{
validate();
}
catch(Exception ex)
{
ADialog.error(m_WindowNo, this.panel, "Error", ex.getLocalizedMessage());
}
} // actionPerformed
public void validate()
{
panel.saveSelection();
if (getM_Warehouse_ID() <= 0)
{
throw new FillMandatoryException("M_Warehouse_ID");
}
ArrayList<Integer> selection = getSelection();
if (selection != null
&& selection.size() > 0
&& isSelectionActive() // on selection tab
&& m_M_Warehouse_ID != null)
&& isSelectionActive()) // on selection tab
{
panel.generate();
}
else
{
panel.dispose();
}
}
/**
@ -201,7 +218,7 @@ public class VInOutGen extends InOutGen implements FormPanel, ActionListener, Ve
{
log.info(e.getPropertyName() + "=" + e.getNewValue());
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"))
{
m_C_BPartner_ID = e.getNewValue();