IDEMPIERE-1233 Problem with using the Create Lines From process on the Material Receipt window.

This commit is contained in:
Heng Sin Low 2013-08-12 18:59:11 +08:00
parent 70db8e18af
commit d09e29e342
3 changed files with 18 additions and 1 deletions

View File

@ -193,6 +193,20 @@ public class MWarehouse extends X_M_Warehouse
log.warning("No default locator for " + getName());
return locators[0];
}
else
{
String whereClause = "M_Warehouse_ID=?";
List<MLocator> list = new Query(getCtx(), I_M_Locator.Table_Name, whereClause, null)
.setParameters(getM_Warehouse_ID())
.setOnlyActiveRecords(false).list();
if (!list.isEmpty())
{
if (log.isLoggable(Level.INFO))
log.info("All locator is inactive for " + getName());
//Do not auto create if there are inactive locator since that could trigger unique key exception
return null;
}
}
// No Locator - create one
MLocator loc = new MLocator (this, "Standard");
loc.setIsDefault(true);

View File

@ -20,6 +20,7 @@ import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Checkbox;
import org.adempiere.webui.component.Grid;
@ -80,6 +81,7 @@ public class WCreateFromShipmentUI extends CreateFromShipment implements EventLi
{
log.log(Level.SEVERE, "", e);
setInitOK(false);
throw new AdempiereException(e.getMessage());
}
AEnv.showWindow(window);
}

View File

@ -312,7 +312,8 @@ public class WLocatorDialog extends Window implements EventListener<Event>
//lstLocator.setModel(m_mLocator);
//lstLocator.setValue(m_M_Locator_ID);
lstLocator.setSelectedIndex(0);
if (lstLocator.getItemCount() > 0)
lstLocator.setSelectedIndex(0);
lstLocator.addEventListener(Events.ON_SELECT, this);
displayLocator();