From a0ff348a7622cb8c8da4ce5a66f1988aa62712b9 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 28 Feb 2007 15:53:21 +0000 Subject: [PATCH] patched again 1637757 - provided by Heng Sin --- base/src/org/compiere/model/GridField.java | 37 ++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/base/src/org/compiere/model/GridField.java b/base/src/org/compiere/model/GridField.java index f47d3484df..348b1df9c0 100644 --- a/base/src/org/compiere/model/GridField.java +++ b/base/src/org/compiere/model/GridField.java @@ -1048,7 +1048,9 @@ public class GridField log.config(m_parentValue + " - Link(" + LinkColumnName + ", W=" + m_vo.WindowNo + ",T=" + m_vo.TabNo + ") = " + m_vo.ColumnName); - } + else + m_parentValue = new Boolean(isIndirectParentValue()); + } return m_parentValue.booleanValue(); } // isParentValue @@ -1472,5 +1474,36 @@ public class GridField return retValue; } // createFields - + /** + * bug[1637757] + * Check whether is indirect parent. + * @return boolean + */ + private boolean isIndirectParentValue() + { + boolean result = false; + int tabNo = m_vo.TabNo; + int currentLevel = Env.getContextAsInt(m_vo.ctx, m_vo.WindowNo, tabNo, "TabLevel"); + if (tabNo > 1 && currentLevel > 1) + { + while ( tabNo >= 1 && !result) + { + tabNo--; + int level = Env.getContextAsInt(m_vo.ctx, m_vo.WindowNo, tabNo, "TabLevel"); + if (level > 0 && level < currentLevel) + { + String linkColumn = Env.getContext(m_vo.ctx, m_vo.WindowNo, tabNo, "LinkColumnName"); + if (m_vo.ColumnName.equals(linkColumn)) + { + result = true; + log.config(result + + " - Link(" + linkColumn + ", W=" + m_vo.WindowNo + ",T=" + m_vo.TabNo + + ") = " + m_vo.ColumnName); + } + currentLevel = level; + } + } + } + return result; + } } // MField