BF [ 2584839 ] Null locator when create Receipt from Invoice

https://sourceforge.net/tracker/index.php?func=detail&aid=2584839&group_id=176962&atid=879332
This commit is contained in:
teo_sarca 2009-02-10 21:11:23 +00:00
parent 2e60e57aa4
commit 0033aa028c
1 changed files with 23 additions and 8 deletions

View File

@ -1018,8 +1018,7 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
KeyNamePair pp = null ; KeyNamePair pp = null ;
if(M_Locator_ID == 0) if(M_Locator_ID == 0)
{ {
MLocator locator = getM_Locator();
MLocator locator = getM_Warehouse().getDefaultLocator();
if (locator != null) if (locator != null)
{ {
pp = new KeyNamePair(locator.get_ID(), locator.getValue()); pp = new KeyNamePair(locator.get_ID(), locator.getValue());
@ -1033,12 +1032,28 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
} }
/** /**
* get the Warehouse from Order * Get Locator from Order or locatorField
* @return MWarehouse * @return MLocator
*/ */
protected MWarehouse getM_Warehouse() protected MLocator getM_Locator()
{ {
return MWarehouse.get(p_order.getCtx(),p_order.getM_Warehouse_ID()); MLocator locator = null;
if (p_order != null)
{
MWarehouse wh = MWarehouse.get(Env.getCtx(), p_order.getM_Warehouse_ID());
if (wh != null)
{
locator = wh.getDefaultLocator();
}
}
if (locator == null)
{
Integer M_Locator_ID = (Integer) locatorField.getValue();
if (M_Locator_ID != null && M_Locator_ID > 0)
{
locator = MLocator.get(Env.getCtx(), M_Locator_ID);
}
}
return locator;
} }
} // VCreateFromShipment } // VCreateFromShipment