IDEMPIERE-2672 Region field in Tax Rate window default OR when default country is not USA
This commit is contained in:
parent
a9fd85fa31
commit
d5262afc1b
|
@ -81,7 +81,7 @@ public class GridField
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -757531553169088955L;
|
||||
private static final long serialVersionUID = 7859929653710975421L;
|
||||
|
||||
/**
|
||||
* Field Constructor.
|
||||
|
@ -812,8 +812,56 @@ public class GridField
|
|||
} // createDefault
|
||||
|
||||
/**
|
||||
* Validate initial Field Value.
|
||||
* Called from MTab.dataNew and MTab.setCurrentRow when inserting
|
||||
* Validate initial Field Value. Do not push direct value if it doesn't exist
|
||||
* Called from GridTab.dataNew when inserting
|
||||
* @return true if valid
|
||||
*/
|
||||
public boolean validateValueNoDirect()
|
||||
{
|
||||
// null
|
||||
if (m_value == null || m_value.toString().length() == 0)
|
||||
{
|
||||
if (isMandatory(true))
|
||||
{
|
||||
m_error = true;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
// Search not cached
|
||||
if (getDisplayType() == DisplayType.Search && m_lookup != null)
|
||||
{
|
||||
// need to re-set invalid values - OK BPartner in PO Line - not OK SalesRep in Invoice
|
||||
if (m_lookup.getDirect(m_value, false, true) == null)
|
||||
{
|
||||
if (log.isLoggable(Level.FINEST)) log.finest(m_vo.ColumnName + " Serach not valid - set to null");
|
||||
setValue(null, m_inserting);
|
||||
m_error = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// cannot be validated
|
||||
if (!isLookup()
|
||||
|| m_lookup == null
|
||||
|| m_lookup.containsKeyNoDirect(m_value))
|
||||
return true;
|
||||
// it's not null, a lookup and does not have the key
|
||||
if (isKey() || isParentValue()) // parents/ket are not validated
|
||||
return true;
|
||||
|
||||
if (log.isLoggable(Level.FINEST)) log.finest(m_vo.ColumnName + " - set to null");
|
||||
setValue(null, m_inserting);
|
||||
m_error = true;
|
||||
return false;
|
||||
} // validateValue
|
||||
|
||||
/**
|
||||
* Validate initial Field Value. Push direct value if it doesn't exist
|
||||
* Called from GridTab.setCurrentRow when inserting
|
||||
* @return true if valid
|
||||
*/
|
||||
public boolean validateValue()
|
||||
|
@ -857,8 +905,7 @@ public class GridField
|
|||
setValue(null, m_inserting);
|
||||
m_error = true;
|
||||
return false;
|
||||
} // validateValue
|
||||
|
||||
} // validateValuePushDirect
|
||||
|
||||
/**************************************************************************
|
||||
* Is the Column Visible ?
|
||||
|
|
|
@ -113,7 +113,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1151723870943569774L;
|
||||
private static final long serialVersionUID = 5446672147679386907L;
|
||||
|
||||
public static final String DEFAULT_STATUS_MESSAGE = "NavigateOrUpdate";
|
||||
|
||||
|
@ -1185,15 +1185,15 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
return retValue;
|
||||
setCurrentRow(m_currentRow + 1, true);
|
||||
|
||||
// process all Callouts (no dependency check - assumed that settings are valid)
|
||||
for (int i = 0; i < getFieldCount(); i++)
|
||||
processCallout(getField(i));
|
||||
// check validity of defaults
|
||||
for (int i = 0; i < getFieldCount(); i++)
|
||||
{
|
||||
getField(i).refreshLookup();
|
||||
getField(i).validateValue();
|
||||
getField(i).validateValueNoDirect();
|
||||
}
|
||||
// process all Callouts (no dependency check - assumed that settings are valid)
|
||||
for (int i = 0; i < getFieldCount(); i++)
|
||||
processCallout(getField(i));
|
||||
m_mTable.setChanged(false);
|
||||
|
||||
fireStateChangeEvent(new StateChangeEvent(this, StateChangeEvent.DATA_NEW));
|
||||
|
|
|
@ -43,7 +43,7 @@ public abstract class Lookup extends AbstractListModel
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -2811763289904455349L;
|
||||
private static final long serialVersionUID = -28200392264647953L;
|
||||
|
||||
/**
|
||||
* Lookup
|
||||
|
@ -382,6 +382,12 @@ public abstract class Lookup extends AbstractListModel
|
|||
*/
|
||||
public abstract boolean containsKey (Object key);
|
||||
|
||||
/**
|
||||
* The Lookup contains the key, do not push direct
|
||||
* @param key key
|
||||
* @return true if contains key
|
||||
*/
|
||||
public abstract boolean containsKeyNoDirect (Object key);
|
||||
|
||||
/**************************************************************************
|
||||
* Refresh Values - default implementation
|
||||
|
|
|
@ -39,7 +39,7 @@ public final class MAccountLookup extends Lookup implements Serializable
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 5565166586045152280L;
|
||||
private static final long serialVersionUID = -6307559127917670193L;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -103,6 +103,11 @@ public final class MAccountLookup extends Lookup implements Serializable
|
|||
return load (intValue);
|
||||
} // containsKey
|
||||
|
||||
public boolean containsKeyNoDirect (Object key)
|
||||
{
|
||||
return containsKey(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Description
|
||||
* @return Description
|
||||
|
|
|
@ -37,7 +37,7 @@ public final class MLocationLookup extends Lookup
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -7335118019935048922L;
|
||||
private static final long serialVersionUID = 7238110708451510319L;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -95,6 +95,10 @@ public final class MLocationLookup extends Lookup
|
|||
return getLocation(key, null) != null;
|
||||
} // containsKey
|
||||
|
||||
public boolean containsKeyNoDirect (Object key)
|
||||
{
|
||||
return containsKey(key);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Get Location
|
||||
|
|
|
@ -48,7 +48,7 @@ public final class MLocatorLookup extends Lookup implements Serializable
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 8932848190660391496L;
|
||||
private static final long serialVersionUID = -6041455174391573888L;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -208,6 +208,11 @@ public final class MLocatorLookup extends Lookup implements Serializable
|
|||
return m_lookup.containsKey(key);
|
||||
} // containsKey
|
||||
|
||||
public boolean containsKeyNoDirect (Object key)
|
||||
{
|
||||
return containsKey(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Data Direct from Table
|
||||
* @param keyValue integer key value
|
||||
|
|
|
@ -56,7 +56,7 @@ public final class MLookup extends Lookup implements Serializable
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 5784044288965615466L;
|
||||
private static final long serialVersionUID = 2228200000988048623L;
|
||||
|
||||
/**
|
||||
* MLookup Constructor
|
||||
|
@ -179,7 +179,7 @@ public final class MLookup extends Lookup implements Serializable
|
|||
* @param key key (Integer for Keys or String for Lists)
|
||||
* @return value
|
||||
*/
|
||||
public NamePair get (Object key)
|
||||
public NamePair get (Object key, boolean includeDirect)
|
||||
{
|
||||
if (key == null || MINUS_ONE.equals(key)) // indicator for null
|
||||
return null;
|
||||
|
@ -212,11 +212,23 @@ public final class MLookup extends Lookup implements Serializable
|
|||
return retValue;
|
||||
}
|
||||
|
||||
// Try to get it directly
|
||||
boolean cacheLocal = m_info.IsValidated ;
|
||||
return getDirect(key, false, cacheLocal); // do NOT cache
|
||||
if (includeDirect) {
|
||||
// Try to get it directly
|
||||
boolean cacheLocal = m_info.IsValidated ;
|
||||
return getDirect(key, false, cacheLocal); // do NOT cache
|
||||
}
|
||||
|
||||
return null;
|
||||
} // get
|
||||
|
||||
public NamePair get(Object key) {
|
||||
return get(key, true);
|
||||
}
|
||||
|
||||
public NamePair getNoDirect(Object key) {
|
||||
return get(key, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Display value (name).
|
||||
* If not found return key embedded in inactive signs.
|
||||
|
@ -254,6 +266,24 @@ public final class MLookup extends Lookup implements Serializable
|
|||
}
|
||||
} // containsKey
|
||||
|
||||
/**
|
||||
* The Lookup contains the key, do not get direct
|
||||
* @param key key
|
||||
* @return true if key is known
|
||||
*/
|
||||
public boolean containsKeyNoDirect (Object key)
|
||||
{
|
||||
//should check direct too
|
||||
if (m_lookup.containsKey(key))
|
||||
return true;
|
||||
else {
|
||||
if (m_lookup.size() > 0)
|
||||
return false;
|
||||
else
|
||||
return ( getNoDirect(key) != null );
|
||||
}
|
||||
} // containsKeyNoDirect
|
||||
|
||||
/**
|
||||
* @return a string representation of the object.
|
||||
*/
|
||||
|
|
|
@ -607,7 +607,7 @@ public class MLookupFactory
|
|||
msginf.toString(), ZoomWindow, ZoomWindowPO, zoomQuery);
|
||||
retValue.DisplayColumn = lookupDisplayColumn;
|
||||
retValue.InfoWindowId = infoWindowId;
|
||||
retValue.QueryDirect = directQuery;
|
||||
retValue.QueryDirect = MRole.getDefault().addAccessSQL(directQuery, TableName, true, false);
|
||||
s_cacheRefTable.put(key.toString(), retValue.cloneIt());
|
||||
return retValue;
|
||||
} // getLookup_Table
|
||||
|
@ -814,7 +814,7 @@ public class MLookupFactory
|
|||
MLookupInfo lInfo = new MLookupInfo(realSQL.toString(), TableName,
|
||||
msginf.toString(), ZoomWindow, ZoomWindowPO, zoomQuery);
|
||||
lInfo.DisplayColumn = displayColumn.toString();
|
||||
lInfo.QueryDirect = directQuery;
|
||||
lInfo.QueryDirect = MRole.getDefault().addAccessSQL(directQuery, TableName, true, false);
|
||||
s_cacheRefTable.put(cacheKey.toString(), lInfo.cloneIt());
|
||||
return lInfo;
|
||||
} // getLookup_TableDir
|
||||
|
|
|
@ -41,11 +41,10 @@ import org.compiere.util.NamePair;
|
|||
public class MPAttributeLookup extends Lookup
|
||||
implements Serializable
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 70273805106666111L;
|
||||
private static final long serialVersionUID = 1877125428249819248L;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -88,6 +87,11 @@ public class MPAttributeLookup extends Lookup
|
|||
return get(key) != null;
|
||||
} // containsKey
|
||||
|
||||
public boolean containsKeyNoDirect (Object key)
|
||||
{
|
||||
return containsKey(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Object of Key Value
|
||||
* @param value value
|
||||
|
|
|
@ -39,7 +39,7 @@ public class MPaymentLookup extends Lookup implements Serializable {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 6505672741140583659L;
|
||||
private static final long serialVersionUID = 2876345457828980720L;
|
||||
|
||||
/** Context */
|
||||
private Properties m_ctx;
|
||||
|
@ -97,6 +97,11 @@ public class MPaymentLookup extends Lookup implements Serializable {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean containsKeyNoDirect (Object key)
|
||||
{
|
||||
return containsKey(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName() {
|
||||
return "PaymentRule";
|
||||
|
|
|
@ -36,7 +36,7 @@ public class XLookup extends Lookup
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1388987648081532657L;
|
||||
private static final long serialVersionUID = -1960941688071305272L;
|
||||
|
||||
/**
|
||||
* Manual Lookup
|
||||
|
@ -94,6 +94,11 @@ public class XLookup extends Lookup
|
|||
return false;
|
||||
} // containsKey
|
||||
|
||||
public boolean containsKeyNoDirect (Object key)
|
||||
{
|
||||
return containsKey(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Object of Key Value
|
||||
* @param key key
|
||||
|
|
|
@ -47,11 +47,11 @@ import org.w3c.dom.Document;
|
|||
*
|
||||
*/
|
||||
public class GetListLookup extends Lookup {
|
||||
|
||||
/**
|
||||
* generated serial id
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -137206840260406730L;
|
||||
private static final long serialVersionUID = 2582520499473909390L;
|
||||
|
||||
private String filter;
|
||||
private String serviceType;
|
||||
private String endPoint;
|
||||
|
@ -203,6 +203,11 @@ public class GetListLookup extends Lookup {
|
|||
return dataMap.containsKey(key);
|
||||
}
|
||||
|
||||
public boolean containsKeyNoDirect (Object key)
|
||||
{
|
||||
return containsKey(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh & return number of items read.
|
||||
* Get get data of parent lookups
|
||||
|
|
|
@ -51,11 +51,11 @@ import org.w3c.dom.Node;
|
|||
*
|
||||
*/
|
||||
public class QueryDataLookup extends Lookup {
|
||||
|
||||
/**
|
||||
* generated serial id
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -137206840260406730L;
|
||||
private static final long serialVersionUID = -1322365740845617635L;
|
||||
|
||||
private String filter;
|
||||
private String serviceType;
|
||||
private String endPoint;
|
||||
|
@ -219,6 +219,11 @@ public class QueryDataLookup extends Lookup {
|
|||
return dataMap.containsKey(key);
|
||||
}
|
||||
|
||||
public boolean containsKeyNoDirect (Object key)
|
||||
{
|
||||
return containsKey(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh & return number of items read.
|
||||
* Get get data of parent lookups
|
||||
|
|
Loading…
Reference in New Issue