DataModel Create - Lookup bug using DataField.column='M_PriceList_ID' & DataField.lval = '{Some Price List}' for M_Order

Description

Attempting to set the Price List via lookup for *M_Order *creation using DataModel Create service:

{{DataField.column='M_PriceList_ID'
DataField.lval = '{some price list}'}}

will fail to construct the SQL lookup query if the env.context variable @IsISOTrx@ is not set first. However, if that *IsISOTrx *is set first:

{{DataField.column='IsSOTrx'
DataField.value = 'N'}}

The lookup still fails because @IsISOTrx@ gets inserted into the env.context as 'false' instead of 'N' ('N' converted to boolean converted back to string). This is done at the line line of:

org.idempiere.adinterface.ModelADServiceImpl.setValueAccordingToClass() :

Env.setContext(Env.getCtx(), 0, field.getColumn(), value==null ? null : value.toString());

Consider inserting the original string value into the context instead:

Env.setContext(Env.getCtx(), 0, field.getColumn(), strValue==null ? null : strValue);

This would cause the SQL lookup query to be correct in this case but I do not understand enough of the ramifications to know if this approach wouldn't cause problems elsewhere.

Environment

None

Activity

Show:

Details

Assignee

Reporter

Components

Affects versions

Priority

Created June 27, 2016 at 9:39 PM
Updated June 27, 2016 at 9:39 PM