[ 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:34:33 +00:00
parent 916a21dfde
commit eb033e30d4
1 changed files with 11 additions and 8 deletions

View File

@ -129,7 +129,7 @@ public class WInOutGen extends InOutGen implements ICustomForm, EventListener, V
lWarehouse.setText(Msg.translate(Env.getCtx(), "M_Warehouse_ID")); lWarehouse.setText(Msg.translate(Env.getCtx(), "M_Warehouse_ID"));
fWarehouse.addValueChangeListener(this); fWarehouse.addValueChangeListener(this);
fWarehouse.setValue(Env.getContextAsInt(Env.getCtx(), "#M_Warehouse_ID")); fWarehouse.setValue(Env.getContextAsInt(Env.getCtx(), "#M_Warehouse_ID"));
m_M_Warehouse_ID = fWarehouse.getValue(); setM_Warehouse_ID(fWarehouse.getValue());
// Document Action Prepared/ Completed // Document Action Prepared/ Completed
lDocAction.setText(Msg.translate(Env.getCtx(), "DocAction")); lDocAction.setText(Msg.translate(Env.getCtx(), "DocAction"));
MLookup docActionL = MLookupFactory.get(Env.getCtx(), form.getWindowNo(), 4324 /* M_InOut.DocAction */, MLookup docActionL = MLookupFactory.get(Env.getCtx(), form.getWindowNo(), 4324 /* M_InOut.DocAction */,
@ -184,21 +184,24 @@ public class WInOutGen extends InOutGen implements ICustomForm, EventListener, V
public void validate() public void validate()
{ {
if (isSelectionActive() && if (isSelectionActive() && getM_Warehouse_ID() <= 0)
(m_M_Warehouse_ID == null || (Integer)m_M_Warehouse_ID <= 0)) { {
throw new WrongValueException(fWarehouse.getComponent(), Msg.translate(Env.getCtx(), "FillMandatory")); throw new WrongValueException(fWarehouse.getComponent(), Msg.translate(Env.getCtx(), "FillMandatory"));
} }
form.saveSelection(); form.saveSelection();
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) {
form.generate(); form.generate();
}
else else
{
form.dispose(); form.dispose();
}
} }
/** /**
@ -209,7 +212,7 @@ public class WInOutGen extends InOutGen implements ICustomForm, EventListener, V
{ {
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();