[ 2236639 ] Creation of Location allowed without BP Location associated
This commit is contained in:
parent
9e0dcaaaa3
commit
30086c2278
zkwebui/WEB-INF/src/org/adempiere/webui/editor
|
@ -24,6 +24,7 @@ import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.component.Locationbox;
|
import org.adempiere.webui.component.Locationbox;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
import org.adempiere.webui.window.WLocationDialog;
|
import org.adempiere.webui.window.WLocationDialog;
|
||||||
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.MLocation;
|
import org.compiere.model.MLocation;
|
||||||
import org.compiere.model.MLocationLookup;
|
import org.compiere.model.MLocationLookup;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
|
@ -45,7 +46,6 @@ public class WLocationEditor extends WEditor implements EventListener, PropertyC
|
||||||
|
|
||||||
private static CLogger log = CLogger.getCLogger(WLocationEditor.class);
|
private static CLogger log = CLogger.getCLogger(WLocationEditor.class);
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private String m_columnName;
|
|
||||||
private MLocationLookup m_Location;
|
private MLocationLookup m_Location;
|
||||||
private MLocation m_value;
|
private MLocation m_value;
|
||||||
|
|
||||||
|
@ -62,11 +62,21 @@ public class WLocationEditor extends WEditor implements EventListener, PropertyC
|
||||||
{
|
{
|
||||||
super(new Locationbox(), "Address","",mandatory,isReadOnly,isUpdateable);
|
super(new Locationbox(), "Address","",mandatory,isReadOnly,isUpdateable);
|
||||||
|
|
||||||
m_columnName = columnName;
|
setColumnName(columnName);
|
||||||
m_Location = mLocation;
|
m_Location = mLocation;
|
||||||
getComponent().setButtonImage("/images/Location10.png");
|
getComponent().setButtonImage("/images/Location10.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param gridField
|
||||||
|
*/
|
||||||
|
public WLocationEditor(GridField gridField) {
|
||||||
|
super(new Locationbox(), gridField);
|
||||||
|
m_Location = (MLocationLookup)gridField.getLookup();
|
||||||
|
getComponent().setButtonImage("/images/Location10.png");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDisplay()
|
public String getDisplay()
|
||||||
{
|
{
|
||||||
|
@ -155,11 +165,11 @@ public class WLocationEditor extends WEditor implements EventListener, PropertyC
|
||||||
C_Location_ID = m_value.getC_Location_ID();
|
C_Location_ID = m_value.getC_Location_ID();
|
||||||
Integer ii = new Integer(C_Location_ID);
|
Integer ii = new Integer(C_Location_ID);
|
||||||
// force Change - user does not realize that embedded object is already saved.
|
// force Change - user does not realize that embedded object is already saved.
|
||||||
ValueChangeEvent valuechange = new ValueChangeEvent(this,m_columnName,null,null);
|
ValueChangeEvent valuechange = new ValueChangeEvent(this,getColumnName(),null,null);
|
||||||
fireValueChange(valuechange); // resets m_mLocation
|
fireValueChange(valuechange); // resets m_mLocation
|
||||||
if (C_Location_ID != 0)
|
if (C_Location_ID != 0)
|
||||||
{
|
{
|
||||||
ValueChangeEvent vc = new ValueChangeEvent(this,m_columnName,null,ii);
|
ValueChangeEvent vc = new ValueChangeEvent(this,getColumnName(),null,ii);
|
||||||
fireValueChange(vc);
|
fireValueChange(vc);
|
||||||
}
|
}
|
||||||
setValue(ii);
|
setValue(ii);
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.component.EditorBox;
|
import org.adempiere.webui.component.EditorBox;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
import org.adempiere.webui.window.WLocatorDialog;
|
import org.adempiere.webui.window.WLocatorDialog;
|
||||||
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.MLocator;
|
import org.compiere.model.MLocator;
|
||||||
import org.compiere.model.MLocatorLookup;
|
import org.compiere.model.MLocatorLookup;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
|
@ -51,7 +52,6 @@ public class WLocatorEditor extends WEditor implements EventListener, PropertyCh
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK};
|
||||||
|
|
||||||
private String m_columnName;
|
|
||||||
private MLocatorLookup m_mLocator;
|
private MLocatorLookup m_mLocator;
|
||||||
private Object m_value;
|
private Object m_value;
|
||||||
private int m_WindowNo;
|
private int m_WindowNo;
|
||||||
|
@ -82,7 +82,7 @@ public class WLocatorEditor extends WEditor implements EventListener, PropertyCh
|
||||||
{
|
{
|
||||||
super(new EditorBox(), "Locator", "", mandatory, isReadOnly, isUpdateable);
|
super(new EditorBox(), "Locator", "", mandatory, isReadOnly, isUpdateable);
|
||||||
|
|
||||||
m_columnName = columnName;
|
setColumnName(columnName);
|
||||||
m_mLocator = mLocator;
|
m_mLocator = mLocator;
|
||||||
getComponent().setButtonImage("/images/Locator10.png");
|
getComponent().setButtonImage("/images/Locator10.png");
|
||||||
|
|
||||||
|
@ -91,6 +91,20 @@ public class WLocatorEditor extends WEditor implements EventListener, PropertyCh
|
||||||
m_WindowNo = windowNo;
|
m_WindowNo = windowNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param gridField
|
||||||
|
*/
|
||||||
|
public WLocatorEditor(GridField gridField) {
|
||||||
|
super(new EditorBox(), gridField);
|
||||||
|
m_mLocator = (MLocatorLookup)gridField.getLookup();
|
||||||
|
|
||||||
|
getComponent().setButtonImage("/images/Locator10.png");
|
||||||
|
|
||||||
|
setDefault_Locator_ID(); // set default locator, teo_sarca [ 1661546 ]
|
||||||
|
|
||||||
|
m_WindowNo = gridField.getWindowNo();
|
||||||
|
}
|
||||||
|
|
||||||
public void setValue(Object value)
|
public void setValue(Object value)
|
||||||
{
|
{
|
||||||
setValue (value, false);
|
setValue (value, false);
|
||||||
|
@ -118,7 +132,7 @@ public class WLocatorEditor extends WEditor implements EventListener, PropertyCh
|
||||||
|
|
||||||
// Data Binding
|
// Data Binding
|
||||||
if (fire) {
|
if (fire) {
|
||||||
ValueChangeEvent val = new ValueChangeEvent(this, m_columnName, null, value);
|
ValueChangeEvent val = new ValueChangeEvent(this, getColumnName(), null, value);
|
||||||
fireValueChange(val);
|
fireValueChange(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +215,7 @@ public class WLocatorEditor extends WEditor implements EventListener, PropertyCh
|
||||||
m_mLocator.setOnly_Warehouse_ID(only_Warehouse_ID);
|
m_mLocator.setOnly_Warehouse_ID(only_Warehouse_ID);
|
||||||
m_mLocator.setOnly_Product_ID(getOnly_Product_ID());
|
m_mLocator.setOnly_Product_ID(getOnly_Product_ID());
|
||||||
|
|
||||||
WLocatorDialog ld = new WLocatorDialog(Msg.translate(Env.getCtx(), m_columnName),
|
WLocatorDialog ld = new WLocatorDialog(Msg.translate(Env.getCtx(), getColumnName()),
|
||||||
m_mLocator, M_Locator_ID, isMandatory(), only_Warehouse_ID, this.m_WindowNo);
|
m_mLocator, M_Locator_ID, isMandatory(), only_Warehouse_ID, this.m_WindowNo);
|
||||||
|
|
||||||
// display
|
// display
|
||||||
|
|
|
@ -142,14 +142,11 @@ public class WebEditorFactory
|
||||||
|
|
||||||
else if (displayType == DisplayType.Location)
|
else if (displayType == DisplayType.Location)
|
||||||
{
|
{
|
||||||
editor = new WLocationEditor(gridField.getColumnName(),gridField.isMandatory(false),gridField.isReadOnly(),gridField.isUpdateable(),
|
editor = new WLocationEditor(gridField);
|
||||||
(MLocationLookup)gridField.getLookup());
|
|
||||||
}
|
}
|
||||||
else if (displayType == DisplayType.Locator)
|
else if (displayType == DisplayType.Locator)
|
||||||
{
|
{
|
||||||
editor = new WLocatorEditor(gridField.getColumnName(), gridField.isMandatory(false),
|
editor = new WLocatorEditor(gridField);
|
||||||
gridField.isReadOnly(), gridField.isUpdateable(),
|
|
||||||
(MLocatorLookup)gridField.getLookup(), gridField.getWindowNo());
|
|
||||||
}
|
}
|
||||||
else if (displayType == DisplayType.Account)
|
else if (displayType == DisplayType.Account)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue