Working with Windows and Tabs
Overview
- What you’ll learn: The window and tab structure that forms iDempiere’s user interface, including the header/line pattern, parent-child tab relationships, tab levels, display logic, field groups, and navigation strategies for complex windows.
- Prerequisites: Lesson 5 – Understanding the Application Dictionary
- Estimated reading time: 22 minutes
Introduction
In the previous lesson, you learned that iDempiere’s Application Dictionary defines every aspect of the user interface through metadata. Now it is time to explore how that metadata comes together in practice. Windows and tabs are the primary mechanisms through which users interact with data in iDempiere. A well-designed window organizes related data into a logical hierarchy of tabs, making it possible to view and edit complex business entities without navigating away to separate screens.
This lesson covers the structural patterns, configuration options, and navigation techniques that every iDempiere user and administrator should master. By the end, you will be able to read and understand any window’s tab structure, recognize the header/line pattern used throughout the system, and configure field-level display behavior.
The Header/Line Pattern
The most pervasive structural pattern in iDempiere is the header/line pattern (also called the master/detail pattern). This pattern separates a business document into two parts:
- The header contains information that applies to the entire document: the business partner, the date, the warehouse, the document number, and overall status.
- The lines contain the individual items or entries that make up the document: each product, quantity, price, and line-level detail.
This pattern maps directly to the relational database model. The header is stored in one table, and the lines are stored in a related table with a foreign key back to the header.
Examples Throughout the System
| Document | Header Table | Line Table | Link Column |
|---|---|---|---|
| Sales Order | C_Order | C_OrderLine | C_Order_ID |
| Invoice | C_Invoice | C_InvoiceLine | C_Invoice_ID |
| Shipment / Receipt | M_InOut | M_InOutLine | M_InOut_ID |
| Payment | C_Payment | C_PaymentAllocate | C_Payment_ID |
| GL Journal | GL_Journal | GL_JournalLine | GL_Journal_ID |
| Physical Inventory | M_Inventory | M_InventoryLine | M_Inventory_ID |
Understanding this pattern is essential because virtually every transactional window in iDempiere follows it. When you open the Sales Order window, the first tab displays the order header, and the second tab displays the order lines. Selecting a specific order on the header tab automatically filters the line tab to show only lines belonging to that order.
Parent-Child Tab Relationships
The header/line pattern is a specific case of a more general concept: parent-child tab relationships. In the Application Dictionary, these relationships are established through three mechanisms working together.
Tab Levels
Every tab has a TabLevel that defines its position in the hierarchy:
- Level 0: The header or main record. There is typically one level-0 tab per window, and it appears first.
- Level 1: Detail records that belong to a level-0 record. These are the most common child tabs.
- Level 2: Sub-detail records that belong to a level-1 record. Used when the detail itself has children.
- Level 3 and beyond: Deeper hierarchies, though these are rare in practice.
When a user selects a record on a level-0 tab, all level-1 tabs automatically filter their content to show only records related to the selected parent. The same cascading behavior applies at every level: selecting a level-1 record filters level-2 tabs, and so on.
Link Columns
The filtering between parent and child tabs relies on link columns. A link column is the foreign key that connects the child table to the parent table. In many cases, iDempiere can determine the link column automatically by matching the parent table’s primary key column name. For example, if the parent tab uses the C_Order table, iDempiere looks for a column named C_Order_ID in the child tab’s table.
When the automatic detection does not apply (for example, when a child table has multiple foreign keys to different parent tables), you must explicitly set the AD_Column_ID (Parent Link Column) on the child tab’s AD_Tab record.
Sequence Numbers
The SeqNo field on each tab determines the order in which tabs appear within the window. Tabs are rendered left to right (or top to bottom in the tab list) in ascending sequence order. It is conventional to use increments of 10 (10, 20, 30, …) to allow room for inserting new tabs later.
The combination of tab level and sequence number produces the visual hierarchy. Consider this example layout:
SeqNo 10, Level 0: Order Header
SeqNo 20, Level 1: Order Line
SeqNo 30, Level 2: Line Tax
SeqNo 40, Level 1: Order Tax (Summary)
SeqNo 50, Level 1: Payment Schedule
In this arrangement, the “Line Tax” tab (level 2) is a child of “Order Line” (level 1), while “Order Tax” and “Payment Schedule” are siblings of “Order Line,” all children of “Order Header.”
Single-Record vs Multi-Row Display
Each tab can be configured to display data in two modes:
- Single-record (form view): Displays one record at a time with labeled fields arranged in a form layout. This is the default for header tabs and is best suited for records with many fields.
- Multi-row (grid view): Displays multiple records in a tabular grid. This is common for line-level tabs where users need to see many records simultaneously.
The IsSingleRow attribute on the AD_Tab record sets the default display mode, but users can always toggle between form and grid view using the toolbar buttons. In the ZK web client, the toggle icon switches between these views instantly.
Tip: Line-level tabs are typically configured with
IsSingleRow = Nso they default to grid view, allowing users to quickly scan all line items. Header tabs useIsSingleRow = Yfor the form layout that better accommodates their numerous fields.
Sort Order and Filtering
Tabs control data presentation through several ordering and filtering mechanisms:
OrderByClause
The OrderByClause on AD_Tab defines the default SQL ORDER BY for records displayed in the tab. For example, an order line tab might use Line to sort by line number. If no OrderByClause is specified, records are sorted by the primary key.
WhereClause
The WhereClause on AD_Tab adds a permanent SQL WHERE filter. This is used when the same database table is displayed by multiple tabs but each tab should show a different subset. For instance, a window might have separate tabs for active and inactive records, both pointing to the same table but with different WHERE clauses (IsActive='Y' and IsActive='N').
Field-Level Sort
Individual fields can specify a SortNo in AD_Field. Fields with non-zero SortNo values contribute to the grid view’s default column sorting.
Display Logic and Read-Only Logic
One of the most powerful features of the Application Dictionary is the ability to control visibility and editability dynamically using logic expressions. These expressions reference context variables and evaluate to true or false at runtime.
Display Logic on Fields
The DisplayLogic attribute on AD_Field controls whether a field is visible. The expression uses context variables (prefixed with @) and simple comparison operators. Examples:
@IsSOTrx@='Y'
-- Show this field only for sales transactions
@DocStatus@='DR' | @DocStatus@='IP'
-- Show only when document is Draft or In Progress
@PaymentRule@='S' | @PaymentRule@='B'
-- Show only for Check or Direct Deposit payments
The syntax supports:
=(equals)!(not equals, as@Field@!'Y')&(logical AND)|(logical OR)^(comparison with context variables:@Value@^@OtherValue@)
Display Logic on Tabs
Tabs themselves can also have DisplayLogic expressions. When a tab’s display logic evaluates to false, the entire tab is hidden. This is useful for showing customer-specific tabs only when the business partner is flagged as a customer, for example.
Read-Only Logic
The ReadOnlyLogic attribute on both AD_Tab and AD_Field controls editability. When the expression evaluates to true, the tab or field becomes read-only. A common use case is making a document tab read-only once it has been completed:
@Processed@='Y' | @DocStatus@='CO'
-- Read-only when processed or completed
Mandatory Logic
While the IsMandatory flag on AD_Column is static, the MandatoryLogic attribute on AD_Column can make a field conditionally required. For example:
@PaymentRule@='T'
-- Mandatory only when payment rule is Direct Debit
Default Values
Default values streamline data entry by pre-populating fields when a new record is created. The DefaultValue attribute on AD_Column supports several expression types:
- Literal values:
Y,N,0, or any fixed string. - Context variables:
@#Date@(login date),@#AD_Client_ID@(current client),@#AD_Org_ID@(current organization). - Parent context:
@C_BPartner_ID@to inherit the business partner from the parent tab. - SQL expressions:
@SQL=SELECT MAX(Line)+10 FROM C_OrderLine WHERE C_Order_ID=@C_Order_ID@to auto-calculate the next line number.
Default values are evaluated at the moment a new record is initiated. They can reference any context variable that is available at that point, including values from parent tabs.
Field Groups and Collapsing
When a tab contains many fields, the form view can become long and difficult to navigate. Field groups (defined in AD_FieldGroup and referenced by AD_Field) organize related fields under collapsible headers. For example, the Business Partner window groups fields into sections like “Address,” “Contact,” “Credit,” and “Accounting.”
Field groups can be configured with a FieldGroupType:
- Label: A simple text separator that visually divides the form.
- Collapsible: A section that can be expanded or collapsed by the user. This is the most common type.
- Tab: Renders the group as a sub-tab within the form view (used in some UI implementations).
Navigating Complex Multi-Tab Windows
Some windows in iDempiere have many tabs organized in deep hierarchies. The Business Partner window, for example, can have over ten tabs across multiple levels. Efficient navigation requires understanding a few key techniques.
The Tab Hierarchy Indicator
In the ZK web client, tabs at level 1 and deeper are indented or visually distinguished from the level-0 tab. This indentation provides a quick visual cue about the parent-child structure.
Record Navigation and Context
When you select a record on a parent tab and then switch to a child tab, the child tab automatically shows only the related records. The status bar at the bottom of the window typically shows the current record count (e.g., “Record 1/5”), confirming how many child records exist for the selected parent.
Breadcrumb Context
The window title and breadcrumb area often display identifying information from the parent record, helping you stay oriented. For example, when viewing order lines, the header information (document number, business partner) remains visible.
Example: Exploring the Business Partner Window
The Business Partner window is one of the most complex and frequently used windows in iDempiere. Let us examine its tab structure as a practical example.
Header Tab (Level 0): Business Partner
The main tab contains the core business partner information:
- Search Key (Value): A unique identifier for the BP, often auto-generated.
- Name / Name 2: The business partner’s display name.
- BP Group: A classification category (e.g., Standard, VIP, Government).
- Customer / Vendor / Employee flags: Check boxes that determine which roles this BP plays.
- Tax ID, DUNS, NAICS: Identification numbers.
- Credit fields: Credit limit, open balance, credit status.
Customer Tab (Level 1)
Visible only when the Customer flag is checked (via display logic @IsCustomer@='Y'), this tab contains customer-specific settings: payment rule, payment term, price list, discount schema, and sales representative assignment.
Vendor Tab (Level 1)
Similarly gated by @IsVendor@='Y', this tab holds vendor-specific settings: purchase payment term, PO price list, and vendor category.
Location Tab (Level 1)
Manages the BP’s physical addresses through the C_BPartner_Location table. Each BP can have multiple locations (bill-to, ship-to, remit-to, pay-from). The location data itself is stored in C_Location, which the C_BPartner_Location record references.
Contact Tab (Level 1)
Stores contact persons via the AD_User table linked to the BP by C_BPartner_ID. Each contact has a name, email, phone, and optional login credentials. Multiple contacts can exist per business partner.
Bank Account Tab (Level 1)
Manages the BP’s bank accounts for payment processing. Links to the C_BP_BankAccount table and stores bank name, routing number, account number, and other banking details.
This window perfectly illustrates how the Application Dictionary’s tab system organizes complex, multi-faceted business data into a navigable hierarchy. Each tab serves a distinct purpose, and the parent-child relationships ensure that users always see contextually relevant data.
Key Takeaways
- The header/line pattern is the fundamental structural pattern in iDempiere, separating document-wide information from individual line items.
- Tab levels (0, 1, 2, …) create parent-child hierarchies where selecting a parent record automatically filters child tabs.
- Link columns connect child tabs to their parent, either automatically (by matching the parent’s primary key column name) or explicitly (via the AD_Tab parent link column setting).
- Display logic, read-only logic, and mandatory logic use context variable expressions to dynamically control field and tab behavior.
- Default values support literals, context variables, parent context, and SQL expressions to streamline data entry.
- Field groups organize large forms into collapsible sections for easier navigation.
- Complex windows like Business Partner demonstrate how multiple levels of tabs manage rich, interconnected data.
What’s Next
In the next lesson, Data Model Fundamentals, you will explore the core database tables and naming conventions that underpin every iDempiere system. You will learn about the standard column patterns, table prefixes, the client-organization data isolation model, and the key entities that drive all business processes.
繁體中文
概覽
- 您將學到:構成 iDempiere 使用者介面的視窗和分頁結構,包括標頭/明細行模式、父子分頁關係、分頁層級、顯示邏輯、欄位群組,以及複雜視窗的導覽策略。
- 先備知識:第 5 課 — 理解應用程式字典
- 預估閱讀時間:22 分鐘
簡介
在上一課中,您了解到 iDempiere 的 Application Dictionary 透過中繼資料定義使用者介面的每個方面。現在是時候探索這些中繼資料在實務中如何組合運作了。視窗和分頁是使用者在 iDempiere 中與資料互動的主要機制。一個設計良好的視窗將相關資料組織成邏輯的分頁層級,使得無需導覽到不同畫面就能檢視和編輯複雜的商業實體。
本課涵蓋每位 iDempiere 使用者和管理員都應掌握的結構模式、設定選項和導覽技巧。到課程結束時,您將能夠閱讀和理解任何視窗的分頁結構、辨識整個系統中使用的標頭/明細行模式,以及設定欄位層級的顯示行為。
標頭/明細行模式
iDempiere 中最普遍的結構模式是標頭/明細行模式(也稱為主檔/明細模式)。此模式將商業文件分為兩個部分:
- 標頭包含適用於整個文件的資訊:業務夥伴、日期、倉庫、文件編號和整體狀態。
- 明細行包含構成文件的個別項目或分錄:每個產品、數量、價格和行級別的詳細資訊。
此模式直接對映到關聯式資料庫模型。標頭儲存在一個表中,明細行儲存在具有外鍵連回標頭的相關表中。
整個系統中的範例
| 文件 | 標頭表 | 明細行表 | 連結欄位 |
|---|---|---|---|
| 銷售訂單 | C_Order | C_OrderLine | C_Order_ID |
| 發票 | C_Invoice | C_InvoiceLine | C_Invoice_ID |
| 出貨/收貨 | M_InOut | M_InOutLine | M_InOut_ID |
| 付款 | C_Payment | C_PaymentAllocate | C_Payment_ID |
| 總帳分錄 | GL_Journal | GL_JournalLine | GL_Journal_ID |
| 實地盤點 | M_Inventory | M_InventoryLine | M_Inventory_ID |
理解此模式至關重要,因為 iDempiere 中幾乎每個交易視窗都遵循它。當您開啟銷售訂單視窗時,第一個分頁顯示訂單標頭,第二個分頁顯示訂單明細行。在標頭分頁中選擇特定訂單會自動過濾明細行分頁,僅顯示屬於該訂單的明細行。
父子分頁關係
標頭/明細行模式是更一般概念的特定案例:父子分頁關係。在 Application Dictionary 中,這些關係透過三種機制協同建立。
分頁層級
每個分頁都有一個 TabLevel 定義其在層級中的位置:
- 第 0 層:標頭或主記錄。每個視窗通常有一個第 0 層分頁,它首先出現。
- 第 1 層:屬於第 0 層記錄的明細記錄。這些是最常見的子分頁。
- 第 2 層:屬於第 1 層記錄的子明細記錄。當明細本身有子記錄時使用。
- 第 3 層及以上:更深的層級,但在實務中很少見。
當使用者在第 0 層分頁上選擇一筆記錄時,所有第 1 層分頁會自動過濾其內容,僅顯示與所選父記錄相關的記錄。同樣的級聯行為適用於每個層級:選擇第 1 層記錄會過濾第 2 層分頁,依此類推。
連結欄位
父子分頁之間的過濾依賴於連結欄位。連結欄位是將子表連接到父表的外鍵。在許多情況下,iDempiere 可以透過匹配父表的主鍵欄位名稱來自動確定連結欄位。例如,如果父分頁使用 C_Order 表,iDempiere 會在子分頁的表中尋找名為 C_Order_ID 的欄位。
當自動偵測不適用時(例如,子表有多個指向不同父表的外鍵),您必須在子分頁的 AD_Tab 記錄上明確設定 AD_Column_ID(父連結欄位)。
順序編號
每個分頁上的 SeqNo 欄位決定分頁在視窗中出現的順序。分頁按序號遞增順序從左到右(或在分頁列表中從上到下)渲染。慣例上使用 10 的增量(10、20、30、…),以便後續插入新分頁。
分頁層級和順序編號的組合產生視覺層級。考慮以下範例配置:
SeqNo 10, Level 0: Order Header
SeqNo 20, Level 1: Order Line
SeqNo 30, Level 2: Line Tax
SeqNo 40, Level 1: Order Tax (Summary)
SeqNo 50, Level 1: Payment Schedule
在此配置中,「Line Tax」分頁(第 2 層)是「Order Line」(第 1 層)的子分頁,而「Order Tax」和「Payment Schedule」是「Order Line」的同層分頁,都是「Order Header」的子分頁。
單筆記錄 vs. 多列顯示
每個分頁可以設定為兩種模式顯示資料:
- 單筆記錄(表單檢視):一次顯示一筆記錄,標記的欄位排列在表單版面中。這是標頭分頁的預設值,最適合具有許多欄位的記錄。
- 多列(網格檢視):以表格式網格顯示多筆記錄。這對於需要同時查看多筆記錄的明細行分頁很常見。
AD_Tab 記錄上的 IsSingleRow 屬性設定預設顯示模式,但使用者始終可以使用工具列按鈕在表單和網格檢視之間切換。
提示:明細行分頁通常設定為
IsSingleRow = N,使其預設為網格檢視,讓使用者可以快速瀏覽所有明細項目。標頭分頁使用IsSingleRow = Y以表單版面更好地容納其眾多欄位。
排序和過濾
分頁透過幾種排序和過濾機制控制資料呈現:
OrderByClause
AD_Tab 上的 OrderByClause 定義分頁中記錄顯示的預設 SQL ORDER BY。例如,訂單明細行分頁可能使用 Line 按行號排序。如果未指定 OrderByClause,記錄按主鍵排序。
WhereClause
AD_Tab 上的 WhereClause 添加永久性的 SQL WHERE 過濾器。當同一個資料庫表被多個分頁顯示但每個分頁應顯示不同的子集時使用。
欄位級排序
個別欄位可以在 AD_Field 中指定 SortNo。具有非零 SortNo 值的欄位會對網格檢視的預設欄位排序做出貢獻。
顯示邏輯和唯讀邏輯
Application Dictionary 最強大的功能之一是使用邏輯表達式動態控制可見性和可編輯性。這些表達式參照上下文變數並在執行時評估為真或假。
欄位的顯示邏輯
AD_Field 上的 DisplayLogic 屬性控制欄位是否可見。表達式使用上下文變數(以 @ 為前綴)和簡單的比較運算子。範例:
@IsSOTrx@='Y'
-- 僅在銷售交易時顯示此欄位
@DocStatus@='DR' | @DocStatus@='IP'
-- 僅在文件為草稿或處理中時顯示
@PaymentRule@='S' | @PaymentRule@='B'
-- 僅在支票或直接存款付款時顯示
分頁的顯示邏輯
分頁本身也可以有 DisplayLogic 表達式。當分頁的顯示邏輯評估為假時,整個分頁會被隱藏。
唯讀邏輯
AD_Tab 和 AD_Field 上的 ReadOnlyLogic 屬性控制可編輯性。當表達式評估為真時,分頁或欄位變為唯讀。常見的使用場景是在文件完成後使文件分頁唯讀:
@Processed@='Y' | @DocStatus@='CO'
-- 處理完成或已完成時唯讀
必填邏輯
雖然 AD_Column 上的 IsMandatory 標記是靜態的,但 AD_Column 上的 MandatoryLogic 屬性可以使欄位有條件地成為必填。
預設值
預設值透過在建立新記錄時預先填充欄位來簡化資料輸入。AD_Column 上的 DefaultValue 屬性支援幾種表達式類型:
- 字面值:
Y、N、0或任何固定字串。 - 上下文變數:
@#Date@(登入日期)、@#AD_Client_ID@(當前客戶端)、@#AD_Org_ID@(當前組織)。 - 父上下文:
@C_BPartner_ID@從父分頁繼承業務夥伴。 - SQL 表達式:
@SQL=SELECT MAX(Line)+10 FROM C_OrderLine WHERE C_Order_ID=@C_Order_ID@自動計算下一個行號。
欄位群組和折疊
當分頁包含許多欄位時,表單檢視可能變得很長且難以導覽。欄位群組(在 AD_FieldGroup 中定義並由 AD_Field 參照)將相關欄位組織在可折疊的標題下。
導覽複雜的多分頁視窗
iDempiere 中的某些視窗有許多分頁,組織在深層級結構中。例如,業務夥伴視窗可以有超過十個分頁,跨越多個層級。高效的導覽需要了解幾個關鍵技巧。
範例:探索業務夥伴視窗
業務夥伴視窗是 iDempiere 中最複雜且最常用的視窗之一。讓我們檢視其分頁結構作為實際範例。
標頭分頁(第 0 層):業務夥伴
主分頁包含核心業務夥伴資訊:搜尋鍵、名稱、BP 群組、客戶/供應商/員工標記、稅務 ID、信用欄位等。
客戶分頁(第 1 層)
僅在客戶標記被勾選時可見(透過顯示邏輯 @IsCustomer@='Y'),此分頁包含客戶專用設定:付款規則、付款條件、價格表、折扣方案和銷售代表指派。
供應商分頁(第 1 層)
同樣由 @IsVendor@='Y' 控制,此分頁持有供應商專用設定:採購付款條件、採購價格表和供應商類別。
位置分頁(第 1 層)
透過 C_BPartner_Location 表管理 BP 的實際地址。每個 BP 可以有多個位置(帳單地址、送貨地址、匯款地址、付款地址)。
聯絡人分頁(第 1 層)
透過以 C_BPartner_ID 連結到 BP 的 AD_User 表儲存聯絡人。
銀行帳戶分頁(第 1 層)
管理 BP 的銀行帳戶以進行付款處理。連結到 C_BP_BankAccount 表。
此視窗完美展示了 Application Dictionary 的分頁系統如何將複雜、多面向的商業資料組織成可導覽的層級結構。
重點摘要
- 標頭/明細行模式是 iDempiere 中的基本結構模式,將文件範圍的資訊與個別明細項目分開。
- 分頁層級(0、1、2、…)建立父子層級結構,選擇父記錄會自動過濾子分頁。
- 連結欄位將子分頁連接到其父分頁,可以自動或明確進行。
- 顯示邏輯、唯讀邏輯和必填邏輯使用上下文變數表達式動態控制欄位和分頁的行為。
- 預設值支援字面值、上下文變數、父上下文和 SQL 表達式,以簡化資料輸入。
- 欄位群組將大型表單組織成可折疊的區段,便於導覽。
- 業務夥伴等複雜視窗展示了多層級分頁如何管理豐富、互相關聯的資料。
下一步
在下一課資料模型基礎中,您將探索支撐每個 iDempiere 系統的核心資料庫表和命名慣例。您將學習標準欄位模式、表前綴、客戶端-組織資料隔離模型,以及驅動所有業務流程的關鍵實體。
日本語
概要
- 学習内容:iDempiere のユーザーインターフェースを構成するウィンドウとタブの構造。ヘッダー/明細行パターン、親子タブ関係、タブレベル、表示ロジック、フィールドグループ、複雑なウィンドウのナビゲーション戦略を含みます。
- 前提条件:第5課 — アプリケーション辞書の理解
- 推定読了時間:22分
はじめに
前のレッスンで、iDempiere の Application Dictionary がメタデータを通じてユーザーインターフェースのあらゆる面を定義することを学びました。今度は、そのメタデータが実際にどのように組み合わさるかを探る番です。ウィンドウとタブは、ユーザーが iDempiere でデータとやり取りする主要なメカニズムです。適切に設計されたウィンドウは、関連データを論理的なタブ階層に整理し、別の画面にナビゲートすることなく複雑なビジネスエンティティを表示・編集できるようにします。
このレッスンでは、すべての iDempiere ユーザーと管理者がマスターすべき構造パターン、設定オプション、ナビゲーション技術を扱います。レッスンの終わりには、任意のウィンドウのタブ構造を読み取って理解し、システム全体で使用されるヘッダー/明細行パターンを認識し、フィールドレベルの表示動作を設定できるようになります。
ヘッダー/明細行パターン
iDempiere で最も普及している構造パターンはヘッダー/明細行パターン(マスター/詳細パターンとも呼ばれます)です。このパターンはビジネスドキュメントを2つの部分に分けます:
- ヘッダーはドキュメント全体に適用される情報を含みます:取引先、日付、倉庫、ドキュメント番号、全体のステータス。
- 明細行はドキュメントを構成する個々の項目や仕訳を含みます:各商品、数量、価格、行レベルの詳細。
このパターンはリレーショナルデータベースモデルに直接マッピングされます。ヘッダーは1つのテーブルに格納され、明細行はヘッダーへの外部キーを持つ関連テーブルに格納されます。
システム全体の例
| ドキュメント | ヘッダーテーブル | 明細行テーブル | リンクカラム |
|---|---|---|---|
| 受注 | C_Order | C_OrderLine | C_Order_ID |
| 請求書 | C_Invoice | C_InvoiceLine | C_Invoice_ID |
| 出荷/入庫 | M_InOut | M_InOutLine | M_InOut_ID |
| 支払い | C_Payment | C_PaymentAllocate | C_Payment_ID |
| GL仕訳 | GL_Journal | GL_JournalLine | GL_Journal_ID |
| 実地棚卸 | M_Inventory | M_InventoryLine | M_Inventory_ID |
このパターンの理解は不可欠です。iDempiere の事実上すべてのトランザクションウィンドウがこれに従っているためです。
親子タブ関係
ヘッダー/明細行パターンは、より一般的な概念の特定のケースです:親子タブ関係。Application Dictionary では、これらの関係は3つのメカニズムが協調して確立されます。
タブレベル
すべてのタブには、階層内の位置を定義する TabLevel があります:
- レベル0:ヘッダーまたはメインレコード。
- レベル1:レベル0レコードに属する詳細レコード。
- レベル2:レベル1レコードに属するサブ詳細レコード。
- レベル3以上:より深い階層ですが、実際にはまれです。
ユーザーがレベル0タブでレコードを選択すると、すべてのレベル1タブが自動的にコンテンツをフィルタリングし、選択された親に関連するレコードのみを表示します。
リンクカラム
親子タブ間のフィルタリングはリンクカラムに依存します。リンクカラムは子テーブルを親テーブルに接続する外部キーです。多くの場合、iDempiere は親テーブルの主キーカラム名を照合することで自動的に決定できます。
シーケンス番号
各タブの SeqNo フィールドは、ウィンドウ内でタブが表示される順序を決定します。
SeqNo 10, Level 0: Order Header
SeqNo 20, Level 1: Order Line
SeqNo 30, Level 2: Line Tax
SeqNo 40, Level 1: Order Tax (Summary)
SeqNo 50, Level 1: Payment Schedule
単一レコード vs. 複数行表示
各タブは2つのモードでデータを表示するように設定できます:
- 単一レコード(フォームビュー):一度に1つのレコードを表示します。ヘッダータブのデフォルトです。
- 複数行(グリッドビュー):表形式のグリッドで複数のレコードを表示します。明細行タブに一般的です。
ヒント:明細行タブは通常
IsSingleRow = Nに設定され、デフォルトでグリッドビューになります。ヘッダータブはIsSingleRow = Yを使用します。
ソート順とフィルタリング
OrderByClause
AD_Tab の OrderByClause は、タブに表示されるレコードのデフォルト SQL ORDER BY を定義します。
WhereClause
AD_Tab の WhereClause は永続的な SQL WHERE フィルターを追加します。
フィールドレベルのソート
個々のフィールドは AD_Field で SortNo を指定できます。
表示ロジックと読み取り専用ロジック
Application Dictionary の最も強力な機能の一つは、ロジック式を使用して表示/非表示と編集可能性を動的に制御する機能です。
フィールドの表示ロジック
AD_Field の DisplayLogic 属性はフィールドの表示を制御します。例:
@IsSOTrx@='Y'
-- 販売取引の場合にのみ表示
@DocStatus@='DR' | @DocStatus@='IP'
-- 下書きまたは処理中の場合にのみ表示
@PaymentRule@='S' | @PaymentRule@='B'
-- 小切手またはダイレクトデポジットの場合にのみ表示
タブの表示ロジック
タブ自体にも DisplayLogic 式を設定できます。偽に評価されるとタブ全体が非表示になります。
読み取り専用ロジック
ReadOnlyLogic 属性は編集可能性を制御します:
@Processed@='Y' | @DocStatus@='CO'
-- 処理済みまたは完了時に読み取り専用
必須ロジック
MandatoryLogic 属性はフィールドを条件付きで必須にできます。
デフォルト値
デフォルト値は新しいレコード作成時にフィールドを事前入力して、データ入力を効率化します。
- リテラル値:
Y、N、0 - コンテキスト変数:
@#Date@、@#AD_Client_ID@ - 親コンテキスト:
@C_BPartner_ID@ - SQL 式:
@SQL=SELECT MAX(Line)+10 FROM C_OrderLine WHERE C_Order_ID=@C_Order_ID@
フィールドグループと折りたたみ
フィールドグループは関連するフィールドを折りたたみ可能なヘッダーの下に整理します。タイプには Label、Collapsible、Tab があります。
複雑なマルチタブウィンドウのナビゲーション
取引先ウィンドウなどの複雑なウィンドウでは、タブ階層インジケーター、レコードナビゲーションとコンテキスト、パンくずコンテキストを使用して効率的にナビゲートします。
例:取引先ウィンドウの探索
取引先ウィンドウは iDempiere で最も複雑で頻繁に使用されるウィンドウの一つです。
ヘッダータブ(レベル0):取引先
コアとなる取引先情報:検索キー、名前、BP グループ、顧客/仕入先/従業員フラグ、税務 ID、与信フィールドなど。
顧客タブ(レベル1)
表示ロジック @IsCustomer@='Y' により、顧客固有の設定を含みます。
仕入先タブ(レベル1)
@IsVendor@='Y' により制御され、仕入先固有の設定を含みます。
住所タブ(レベル1)
C_BPartner_Location テーブルを通じて BP の物理的な住所を管理します。
連絡先タブ(レベル1)
AD_User テーブルを通じて連絡担当者を格納します。
銀行口座タブ(レベル1)
C_BP_BankAccount テーブルにリンクし、支払処理のための銀行口座を管理します。
このウィンドウは、Application Dictionary のタブシステムが複雑なビジネスデータをナビゲート可能な階層に整理する方法を完璧に示しています。
まとめ
- ヘッダー/明細行パターンは iDempiere の基本的な構造パターンで、ドキュメント全体の情報を個々の明細項目から分離します。
- タブレベル(0、1、2、…)は親子階層を作成し、親レコードを選択すると自動的に子タブがフィルタリングされます。
- リンクカラムは子タブを親に接続し、自動的または明示的に行われます。
- 表示ロジック、読み取り専用ロジック、必須ロジックはコンテキスト変数式を使用して動的に制御します。
- デフォルト値はリテラル、コンテキスト変数、親コンテキスト、SQL 式をサポートします。
- フィールドグループは大きなフォームを折りたたみ可能なセクションに整理します。
- 取引先のような複雑なウィンドウは、複数レベルのタブがリッチで相互接続されたデータを管理する方法を示しています。
次のステップ
次のレッスンデータモデルの基礎では、すべての iDempiere システムを支えるコアデータベーステーブルと命名規則を探ります。標準カラムパターン、テーブルプレフィックス、クライアント-組織のデータ分離モデル、そしてすべてのビジネスプロセスを駆動する主要なエンティティについて学びます。