IDEMPIERE-5066 Order Line Create Production not visible in the process toolbar dropdown (#1021)

This commit is contained in:
hengsin 2021-12-02 09:23:36 +08:00 committed by GitHub
parent f0404dad68
commit 7b1c9322f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 2 deletions

View File

@ -135,7 +135,15 @@ public class DefaultEvaluatee implements Evaluatee {
{
po = s_ReferenceCache.get(key);
if (po != null && po.get_ID() == id)
refValue = po.get_ValueAsString(foreignColumn);
{
Object value = po.get_Value(foreignColumn);
if (value == null)
refValue = "";
else if (value instanceof Boolean)
refValue = (Boolean)value ? "Y" : "N";
else
refValue = value.toString();
}
else
po = null;
}
@ -145,7 +153,13 @@ public class DefaultEvaluatee implements Evaluatee {
if (po != null && po.get_ID() == id)
{
s_ReferenceCache.put(key, po);
refValue = po.get_ValueAsString(foreignColumn);
Object value = po.get_Value(foreignColumn);
if (value == null)
refValue = "";
else if (value instanceof Boolean)
refValue = (Boolean)value ? "Y" : "N";
else
refValue = value.toString();
}
}
return refValue;

View File

@ -42,6 +42,7 @@ import org.compiere.model.MTable;
import org.compiere.model.PO;
import org.compiere.model.Query;
import org.compiere.util.DB;
import org.compiere.util.DefaultEvaluatee;
import org.compiere.util.Env;
import org.compiere.util.Evaluatee;
import org.compiere.util.LegacyLogicEvaluator;
@ -574,6 +575,25 @@ public class LogicExpressionTest extends AbstractTestCase {
assertTrue(LegacyLogicEvaluator.evaluateLogic(evaluatee, expr));
}
@Test
public void testNestedProperty() {
String expr = "@Processed@=Y & @M_Product_ID.IsBOM@=Y";
Env.setContext(Env.getCtx(), 1, "Processed", (String)null);
assertFalse(LegacyLogicEvaluator.evaluateLogic(new DefaultEvaluatee(null, 1, 0), expr));
int pchair = 133;
Env.setContext(Env.getCtx(), 1, "Processed", "Y");
Env.setContext(Env.getCtx(), 1, "M_Product_ID", pchair);
assertTrue(LegacyLogicEvaluator.evaluateLogic(new DefaultEvaluatee(null, 1, 0), expr));
Env.setContext(Env.getCtx(), 1, "Processed", (String)null);
assertFalse(LogicEvaluator.evaluateLogic(new DefaultEvaluatee(null, 1, 0), expr));
Env.setContext(Env.getCtx(), 1, "Processed", "Y");
Env.setContext(Env.getCtx(), 1, "M_Product_ID", pchair);
assertTrue(LogicEvaluator.evaluateLogic(new DefaultEvaluatee(null, 1, 0), expr));
}
private static class ContextEvaluatee implements Evaluatee {
@Override