Document Processing Basics
Overview
- What you’ll learn: How documents flow through their lifecycle in iDempiere — from creation as drafts to completion, voiding, and reversal — and how document types, sequences, and period controls govern this process.
- Prerequisites: Lesson 1 (Introduction to iDempiere), Lesson 3 (Navigating the Interface), Lesson 7 (Chart of Accounts Setup)
- Estimated reading time: 22 minutes
Introduction
In iDempiere, nearly every business transaction — placing a sales order, receiving goods, issuing an invoice, recording a payment — is represented as a document. Documents are not static records; they move through a carefully defined lifecycle controlled by document statuses and actions. This lifecycle enforces business rules, ensures data integrity, triggers accounting postings, and maintains a complete audit trail.
Understanding document processing is one of the most fundamental skills for any iDempiere user or administrator. This lesson explains the document lifecycle in detail, covering every status and action, and clarifies concepts that frequently cause confusion — such as the difference between voiding and reversing, or when to use Prepare versus Complete.
What Is a Document in iDempiere?
A document in iDempiere is a transactional record that passes through a defined processing workflow. Not every record in the system is a document — master data records like Business Partners, Products, and Chart of Accounts entries are not documents. Documents are specifically the records that represent business events and have a DocStatus and DocAction field.
The primary documents in iDempiere include:
- Sales Order (C_Order): A customer’s commitment to purchase goods or services.
- Purchase Order (C_Order): Your commitment to buy from a supplier. Sales and purchase orders share the same table but are distinguished by their document type.
- Material Receipt (M_InOut): Records the physical receipt of goods into your warehouse from a vendor.
- Shipment (M_InOut): Records the physical delivery of goods from your warehouse to a customer. Like orders, receipts and shipments share the
M_InOuttable. - Accounts Payable Invoice (C_Invoice): A vendor’s bill for goods or services received.
- Accounts Receivable Invoice (C_Invoice): Your bill to a customer for goods or services delivered.
- Payment (C_Payment): Records a monetary transaction — receiving money from a customer or paying money to a vendor.
- Bank Statement (C_BankStatement): Records transactions from your bank for reconciliation purposes.
- GL Journal (GL_Journal): Manual accounting entries posted directly to the general ledger.
- Inventory Move (M_Movement): Records the transfer of goods between warehouses or locators.
- Physical Inventory (M_Inventory): Records inventory count adjustments.
Document Status (DocStatus)
The DocStatus field tracks where a document currently stands in its lifecycle. iDempiere defines the following statuses:
Primary Statuses
- Drafted (DR): The document has been created but not yet processed. It is fully editable. This is the initial state of every new document. Drafted documents have no impact on inventory, accounting, or commitments — they are essentially work-in-progress records that can be freely modified or deleted.
- In Progress (IP): The document has been prepared (validated) but not yet completed. In this state, iDempiere has performed validation checks — verifying that required fields are populated, quantities are valid, prices exist, and business rules are satisfied. The document reserves resources (e.g., inventory is reserved for a sales order) but has not yet been finalized. The document can still be modified, though some fields may become restricted.
- Completed (CO): The document has been fully processed. It is now a permanent, immutable record of a business event. Completed documents trigger their full effects: inventory quantities update, accounting entries post to the general ledger, commitments are recorded, and the document receives its definitive document number. A completed document cannot be edited. To change it, you must void it or create a reversal.
- Voided (VO): The document has been nullified. Voiding a document cancels its effects. For documents that have not yet been completed, voiding simply sets all quantities and amounts to zero. For completed documents, the behavior depends on the document type (see the section on Void vs. Reverse below).
- Reversed (RE): The document has been reversed by creating a new, offsetting document. The original document and the reversal document reference each other, creating a clear audit trail. The combined effect of the original and reversal is zero.
- Closed (CL): The document has been administratively closed. Closing is used for documents that are completed but have remaining open quantities or amounts that should be written off. For example, a purchase order for 100 units where only 80 were received can be closed to indicate that the remaining 20 units will never be received. The 80 received units remain valid; only the outstanding balance is cancelled.
Additional Statuses
- Unknown (??): An undefined or error state that should not occur during normal operations. If you encounter this status, it typically indicates a processing error that needs investigation.
- Waiting Payment (WP): Used in specific workflows where a document is held pending payment confirmation before further processing.
- Approved (AP): Indicates the document has been approved through an approval workflow. This is an intermediate state between In Progress and Completed, used when organizational policies require managerial approval before document completion.
Document Action (DocAction)
While DocStatus tells you where a document is, DocAction defines what can be done next. The available actions change depending on the current status. Here are the document actions:
Core Actions
- Prepare (PR): Validates the document and transitions it from Drafted to In Progress. Preparation runs a series of checks: Are all mandatory fields filled? Do the referenced products exist in the price list? Are quantities positive? Is the business partner valid? If all checks pass, the document moves to In Progress status. Preparation also reserves inventory for sales orders and calculates tax amounts. Think of Prepare as a “dry run” that catches errors before final commitment.
- Complete (CO): Finalizes the document and transitions it to Completed status. If the document is still in Draft, Complete will first Prepare it (running all validation checks) and then complete it in a single step. Completion triggers the document’s real-world effects — inventory movements, accounting postings, and commitment updates. This is the most significant action in the document lifecycle because it makes the document’s impact permanent and the document itself immutable.
- Void (VO): Cancels the document. The behavior depends on the current status:
- If the document is Drafted or In Progress: quantities and amounts are set to zero, and the status changes to Voided. No reversal document is created because no permanent effects existed.
- If the document is Completed: the behavior varies by document type. Some completed documents can be directly voided (setting amounts to zero), while others require a reversal.
- Close (CL): Administratively closes the document, writing off any remaining open quantities or amounts. Available only for completed documents. Closing does not reverse any processed quantities — it only eliminates unfulfilled portions.
- Reverse – Correct (RC): Creates a new document that exactly offsets the original, effectively undoing the transaction. The reversal document has the same date as the original and posts to the same accounting period. Both documents are cross-referenced. Use Reverse-Correct when you discover an error in the current period and want to undo the transaction as if it never happened.
- Reverse – Accrual (RA): Similar to Reverse-Correct, but the reversal document is dated today (the current date) rather than the original document’s date. This means the reversal posts to the current accounting period. Use Reverse-Accrual when you need to undo a transaction from a prior period that has already been closed — the original entry remains in its period, and the offsetting entry appears in the current period.
- None (–): No action. This is the default when no further actions are available or appropriate.
Approval-Related Actions
- Approve (—): Approves the document in an approval workflow, allowing it to proceed to completion.
- Reject (—): Rejects the document in an approval workflow, sending it back for revision.
The Document Lifecycle in Practice
Let us trace a typical document through its lifecycle using a Sales Order as an example:
- Creation (Draft): A sales representative opens the Sales Order window and creates a new record. They select the customer, enter order lines with products, quantities, and prices. The order is saved with
DocStatus = DR. At this point, the order is just a plan — nothing has been committed. - Preparation (In Progress): The user clicks the document action button and selects “Prepare.” iDempiere validates all order lines, checks product availability, calculates taxes, and verifies the price list. If everything is valid, the status changes to
DocStatus = IP. Inventory is now reserved (soft allocation) but not yet physically committed. The user can still modify the order if needed. - Completion (Completed): The user selects “Complete.” The order is finalized with
DocStatus = CO. The document number sequence is consumed (the order gets its official number), and the order becomes immutable. For a standard sales order, completion does not move inventory or create accounting entries — those happen when the shipment and invoice are completed. However, the sales order now represents a firm commitment. - Downstream Documents: From the completed sales order, the user generates a Shipment (to deliver the goods) and an Invoice (to bill the customer). Each of these is a separate document with its own lifecycle. The shipment completion will decrease inventory; the invoice completion will create accounting entries (debit Accounts Receivable, credit Revenue).
- Closing or Reversal (if needed): If the customer cancels part of the order after partial shipment, the user can Close the sales order to write off the remaining undelivered quantity. If the entire order was an error, the user can Void or Reverse it (and must also deal with any downstream shipments and invoices).
Document Types and Sequences
Document Types (C_DocType)
Every document in iDempiere is associated with a Document Type stored in the C_DocType table. The document type controls several critical behaviors:
- Document Base Type: Identifies the fundamental category (e.g., Sales Order, AP Invoice, AR Invoice, Payment). This determines which processing logic iDempiere applies.
- Document Sub-Type: Further refines behavior within a base type. For sales orders, sub-types include Standard Order, Warehouse Order, Credit Order, POS Order, and Prepay Order — each with different effects on inventory reservation, invoicing, and payment handling.
- Document Sequence: Specifies which number sequence to use for generating document numbers.
- GL Category: Determines the General Ledger category for accounting postings.
- Document Copies: How many copies to print by default.
You can create custom document types to support specific business processes. For instance, you might create a “Consignment Sales Order” document type with particular processing rules, or a “Debit Note” document type for invoice corrections.
Document Numbering (Document Sequences)
Document sequences (AD_Sequence) control automatic numbering. Each document type references a sequence that generates unique document numbers. Key sequence settings include:
- Prefix and Suffix: Text added before or after the number (e.g., prefix “SO-” produces numbers like SO-10001, SO-10002).
- Increment: The step between consecutive numbers (usually 1).
- Current Next: The next number to be assigned.
- Auto Numbering: When enabled, numbers are assigned automatically. When disabled, users must enter the document number manually (useful for vendor invoice numbers).
iDempiere supports both definitive numbering (assigned at completion) and provisional numbering (assigned at creation). For most document types, the definitive number is assigned when the document is completed, ensuring no gaps in the sequence — gaps could cause compliance issues in jurisdictions with strict sequential numbering requirements.
Period Control
Accounting Periods (C_Period)
iDempiere divides the fiscal year into periods (typically months) stored in the C_Period table. Each period has a start date, end date, and a status that controls whether documents can be posted to that period.
Period statuses include:
- Open: Documents can be completed and posted to this period. Normal day-to-day operations require the current period to be open.
- Closed: No new documents can be posted to this period. Closing a period is a standard month-end procedure that prevents accidental backdating of transactions.
- Permanently Closed: Like Closed, but cannot be reopened. Used after final audit to ensure no changes.
Period control can be configured at a granular level — you can close a period for AP Invoices while keeping it open for GL Journals, allowing the accounting team to post adjusting entries while preventing new vendor invoices from being backdated.
If a user attempts to complete a document with a date in a closed period, iDempiere will reject the action with an error. The administrator must either reopen the period or the user must change the document date to fall within an open period.
How Accounting Posting Works
The Fact_Acct Table
When a document is completed, iDempiere generates accounting entries in the Fact_Acct table. This table is the actual general ledger — every debit and credit resulting from every completed document lands here. The posting process:
- The document completion triggers the posting engine.
- The engine reads the document type’s accounting rules, the product category’s account mappings, the business partner’s accounting defaults, and the organization’s accounting schema.
- It generates the appropriate journal entries. For example, completing an AR Invoice creates: Debit Accounts Receivable, Credit Revenue (and Tax Payable if applicable).
- The entries are written to
Fact_Acctwith references back to the source document, enabling drill-down from any accounting entry to the originating transaction.
If posting fails (due to missing account mappings, for example), the document is still completed, but it is flagged with a posting error. The Post Immediately system setting controls whether posting happens synchronously (during completion) or asynchronously (via a background process). Administrators can view and resolve posting errors through the “Not Posted” process.
Void vs. Reverse: When to Use Which
One of the most common sources of confusion in iDempiere is the distinction between Void, Reverse-Correct, and Reverse-Accrual. Here is a clear guide:
- Void: Use for documents that have not yet been completed or for completed documents in the current period where you want to cancel without creating a visible reversal trail. Voiding zeroes out the document’s quantities and amounts. For completed documents, the accounting entries are reversed within the same document.
- Reverse – Correct: Use for completed documents when you need a clear, auditable reversal. This creates a new document with opposite signs, cross-referenced to the original. Both documents remain in the system with their original dates. This is the preferred method in most cases because it maintains a complete audit trail.
- Reverse – Accrual: Use when reversing a transaction from a prior, closed period. The reversal posts to the current date and current period, leaving the original period’s books undisturbed. This is essential for period-end integrity — you should never reopen a closed period just to reverse a document.
Common Document Processing Errors and Solutions
As you work with documents, you will inevitably encounter processing errors. Here are the most common ones and how to resolve them:
- “No Price found”: The product does not have a price in the price list associated with the business partner or the order. Solution: Add the product to the appropriate price list version, ensuring the version’s Valid From date is on or before the document date.
- “Period Closed”: The document date falls in a closed accounting period. Solution: Change the document date to a date in an open period, or ask the administrator to reopen the period.
- “Insufficient Inventory”: Attempting to ship more than the available on-hand quantity (when negative inventory is not allowed). Solution: Receive the goods first, adjust inventory, or reduce the shipment quantity.
- “Document Posting Error”: The document completed but failed to post to the general ledger, usually due to a missing account mapping. Solution: Check the product category accounting, business partner accounting, or bank account accounting for the missing account. Fix the mapping and repost.
- “Approval required”: The document requires approval from a supervisor before it can be completed. Solution: Route the document through the approval workflow or have an authorized user approve it.
- “Cannot Void/Reverse – dependent documents exist”: You are trying to void an order that already has completed shipments or invoices. Solution: Void or reverse the dependent documents first (invoices, then shipments), then void the order.
Key Takeaways
- Documents in iDempiere are transactional records (orders, invoices, payments, shipments) that follow a defined lifecycle controlled by DocStatus and DocAction.
- The primary lifecycle is Draft (DR) → In Progress (IP) → Completed (CO), with additional statuses for Voided (VO), Reversed (RE), and Closed (CL).
- Prepare validates a document without finalizing it; Complete makes it permanent and triggers accounting postings.
- Reverse-Correct creates an offsetting document with the original date; Reverse-Accrual uses today’s date — essential for handling corrections across closed periods.
- Document Types define processing behavior, numbering sequences, and accounting categories.
- Period Control prevents posting to closed periods, maintaining the integrity of finalized financial statements.
- The Fact_Acct table stores all accounting entries, linked back to source documents for full traceability.
- Most processing errors relate to missing prices, closed periods, insufficient inventory, or missing account mappings — all resolvable with proper setup.
What’s Next
With a solid understanding of how documents flow through iDempiere, Lesson 11 will introduce you to Basic Reporting. You will learn how to use print formats, report views, and Jasper Reports to extract meaningful information from the data your documents have created.
繁體中文
概述
- 您將學到:文件在 iDempiere 中如何經歷其生命週期——從建立為草稿到完成、作廢和沖銷——以及文件類型、序號和期間控制如何管控此流程。
- 先修課程:第 1 課(iDempiere 簡介)、第 3 課(介面導航)、第 7 課(會計科目表設定)
- 預估閱讀時間:22 分鐘
簡介
在 iDempiere 中,幾乎每筆業務交易——下銷售訂單、收貨、開立發票、記錄付款——都以文件表示。文件不是靜態的記錄;它們經歷由文件狀態和動作控制的精心定義的生命週期。此生命週期強制執行業務規則、確保資料完整性、觸發會計過帳,並維護完整的稽核軌跡。
了解文件處理是任何 iDempiere 使用者或管理員最基礎的技能之一。本課程詳細說明文件的生命週期,涵蓋每個狀態和動作,並釐清經常造成混淆的概念——例如作廢和沖銷的區別,或何時使用準備與完成。
什麼是 iDempiere 中的文件?
iDempiere 中的文件是通過定義的處理工作流程的交易記錄。系統中並非每筆記錄都是文件——主資料記錄如業務夥伴、產品和會計科目表條目不是文件。文件特指代表業務事件且具有 DocStatus 和 DocAction 欄位的記錄。
iDempiere 中的主要文件包括:
- 銷售訂單 (C_Order):客戶購買商品或服務的承諾。
- 採購訂單 (C_Order):您向供應商購買的承諾。銷售訂單和採購訂單共用同一資料表,但透過文件類型加以區分。
- 進貨單 (M_InOut):記錄從供應商實際收到貨物進入倉庫。
- 出貨單 (M_InOut):記錄從您的倉庫實際交付貨物給客戶。與訂單類似,進貨和出貨共用
M_InOut資料表。 - 應付帳款發票 (C_Invoice):供應商對已收到商品或服務的帳單。
- 應收帳款發票 (C_Invoice):您向客戶開立的商品或服務帳單。
- 付款 (C_Payment):記錄一筆貨幣交易——從客戶收款或向供應商付款。
- 銀行對帳單 (C_BankStatement):記錄來自銀行的交易以用於對帳。
- 總帳分錄 (GL_Journal):直接過帳到總帳的手動會計分錄。
- 庫存調撥 (M_Movement):記錄倉庫或儲位之間的貨物移動。
- 實際盤點 (M_Inventory):記錄庫存盤點調整。
文件狀態 (DocStatus)
DocStatus 欄位追蹤文件目前在其生命週期中的位置。iDempiere 定義了以下狀態:
主要狀態
- 草稿 (DR):文件已建立但尚未處理。它是完全可編輯的。這是每份新文件的初始狀態。草稿文件對庫存、會計或承諾沒有影響——它們本質上是可以自由修改或刪除的進行中工作記錄。
- 處理中 (IP):文件已準備(驗證)但尚未完成。在此狀態下,iDempiere 已執行驗證檢查——確認必填欄位已填寫、數量有效、價格存在且業務規則已滿足。文件保留資源(例如銷售訂單的庫存被保留)但尚未最終確定。文件仍可修改,但某些欄位可能受到限制。
- 已完成 (CO):文件已完全處理。它現在是業務事件的永久、不可變更記錄。已完成的文件觸發其全部效果:庫存數量更新、會計分錄過帳到總帳、承諾被記錄,文件收到其確定的文件號碼。已完成的文件無法編輯。要更改它,您必須作廢或建立沖銷。
- 已作廢 (VO):文件已被取消。作廢文件取消其效果。對於尚未完成的文件,作廢只是將所有數量和金額設為零。對於已完成的文件,行為取決於文件類型(請參閱下方的作廢 vs. 沖銷章節)。
- 已沖銷 (RE):文件已透過建立新的沖抵文件被沖銷。原始文件和沖銷文件互相引用,建立清晰的稽核軌跡。原始和沖銷的合併效果為零。
- 已關閉 (CL):文件已被行政關閉。關閉用於已完成但仍有剩餘未結數量或金額需要核銷的文件。例如,100 單位的採購訂單但只收到 80 單位,可以關閉以表示剩餘的 20 單位將永遠不會收到。已收到的 80 單位仍然有效;只有未結餘額被取消。
其他狀態
- 未知 (??):未定義或錯誤狀態,在正常操作中不應出現。如果您遇到此狀態,通常表示需要調查的處理錯誤。
- 等待付款 (WP):用於特定工作流程中,文件在進一步處理前暫停等待付款確認。
- 已核准 (AP):表示文件已通過核准工作流程的核准。這是處理中和已完成之間的中間狀態,用於組織政策要求在文件完成前需要管理層核准的情況。
文件動作 (DocAction)
DocStatus 告訴您文件在哪裡,而 DocAction 定義接下來可以做什麼。可用的動作會根據目前的狀態而改變。以下是文件動作:
核心動作
- 準備 (PR):驗證文件並將其從草稿轉換為處理中。準備會執行一系列檢查:所有必填欄位都已填寫嗎?參照的產品是否存在於價目表中?數量是否為正數?業務夥伴是否有效?如果所有檢查通過,文件進入處理中狀態。準備也會為銷售訂單保留庫存並計算稅額。將準備視為在最終承諾前捕捉錯誤的「試執行」。
- 完成 (CO):最終確定文件並將其轉換為已完成狀態。如果文件仍處於草稿狀態,完成會先準備它(執行所有驗證檢查)然後在一個步驟中完成它。完成觸發文件的真實效果——庫存移動、會計過帳和承諾更新。這是文件生命週期中最重要的動作,因為它使文件的影響成為永久的,且文件本身不可變更。
- 作廢 (VO):取消文件。行為取決於目前狀態:
- 如果文件處於草稿或處理中:數量和金額設為零,狀態變更為已作廢。不會建立沖銷文件,因為不存在永久效果。
- 如果文件已完成:行為因文件類型而異。某些已完成的文件可以直接作廢(金額設為零),而其他則需要沖銷。
- 關閉 (CL):行政關閉文件,核銷任何剩餘的未結數量或金額。僅適用於已完成的文件。關閉不會沖銷任何已處理的數量——它只消除未履行的部分。
- 沖銷 – 更正 (RC):建立一份完全沖抵原始文件的新文件,有效地撤銷交易。沖銷文件與原始文件日期相同,並過帳到同一會計期間。兩份文件互相交叉引用。當您在當期發現錯誤且想要撤銷交易,就像它從未發生過一樣時,使用沖銷-更正。
- 沖銷 – 應計 (RA):類似於沖銷-更正,但沖銷文件的日期為今天(當前日期)而非原始文件的日期。這意味著沖銷過帳到當前會計期間。當您需要撤銷已關閉的前期交易時使用沖銷-應計——原始分錄保留在其期間內,沖抵分錄出現在當前期間。
- 無 (–):無動作。這是當沒有進一步動作可用或適當時的預設值。
核准相關動作
- 核准 (—):在核准工作流程中核准文件,允許其繼續完成。
- 駁回 (—):在核准工作流程中駁回文件,將其退回修改。
文件生命週期實務
讓我們以銷售訂單為例,追蹤一份典型文件通過其生命週期:
- 建立(草稿):業務代表開啟銷售訂單視窗並建立新記錄。他們選擇客戶,輸入包含產品、數量和價格的訂單行。訂單以
DocStatus = DR儲存。此時,訂單只是一個計劃——沒有任何承諾。 - 準備(處理中):使用者點擊文件動作按鈕並選擇「準備」。iDempiere 驗證所有訂單行,檢查產品可用性,計算稅額,並驗證價目表。如果一切有效,狀態變更為
DocStatus = IP。庫存現在被保留(軟分配)但尚未實際承諾。使用者如有需要仍可修改訂單。 - 完成(已完成):使用者選擇「完成」。訂單以
DocStatus = CO最終確定。文件序號被消耗(訂單獲得其正式號碼),訂單變為不可變更。對於標準銷售訂單,完成不會移動庫存或建立會計分錄——這些在出貨和發票完成時發生。但是,銷售訂單現在代表一個確定的承諾。 - 下游文件:從已完成的銷售訂單,使用者生成出貨單(交付貨物)和發票(向客戶收費)。每個都是具有自己生命週期的獨立文件。出貨完成會減少庫存;發票完成會建立會計分錄(借記應收帳款,貸記收入)。
- 關閉或沖銷(如有需要):如果客戶在部分出貨後取消部分訂單,使用者可以關閉銷售訂單以核銷剩餘未交付的數量。如果整個訂單是錯誤的,使用者可以作廢或沖銷它(並且必須同時處理任何下游的出貨單和發票)。
文件類型和序號
文件類型 (C_DocType)
iDempiere 中的每份文件都關聯一個儲存在 C_DocType 資料表中的文件類型。文件類型控制幾個關鍵行為:
- 文件基礎類型:識別基本類別(例如銷售訂單、應付發票、應收發票、付款)。這決定了 iDempiere 應用哪種處理邏輯。
- 文件子類型:在基礎類型內進一步細化行為。對於銷售訂單,子類型包括標準訂單、倉庫訂單、賒帳訂單、POS 訂單和預付訂單——每種對庫存保留、開票和付款處理有不同的影響。
- 文件序號:指定用於生成文件號碼的編號序列。
- 總帳類別:確定會計過帳的總帳類別。
- 文件副本數:預設列印的副本數量。
您可以建立自訂文件類型以支援特定的業務流程。例如,您可以建立具有特定處理規則的「寄售銷售訂單」文件類型,或用於發票更正的「借項通知單」文件類型。
文件編號(文件序號)
文件序號(AD_Sequence)控制自動編號。每個文件類型引用一個生成唯一文件號碼的序列。關鍵的序列設定包括:
- 前綴和後綴:添加在號碼前後的文字(例如前綴 “SO-” 產生 SO-10001、SO-10002 等號碼)。
- 增量:連續號碼之間的間隔(通常為 1)。
- 目前下一個:將被指派的下一個號碼。
- 自動編號:啟用時,號碼自動指派。停用時,使用者必須手動輸入文件號碼(適用於供應商發票號碼)。
iDempiere 支援確定編號(在完成時指派)和臨時編號(在建立時指派)。對於大多數文件類型,確定號碼在文件完成時指派,確保序號不會有間隔——間隔可能在有嚴格連續編號要求的管轄區域造成合規問題。
期間控制
會計期間 (C_Period)
iDempiere 將會計年度分為儲存在 C_Period 資料表中的期間(通常為月份)。每個期間有開始日期、結束日期和控制文件是否能過帳到該期間的狀態。
期間狀態包括:
- 開放:文件可以完成並過帳到此期間。正常的日常操作需要當前期間為開放狀態。
- 已關閉:不能將新文件過帳到此期間。關閉期間是標準的月結程序,防止交易被意外回溯。
- 永久關閉:與已關閉類似,但不能重新開放。在最終審計後使用,以確保不會有任何更改。
期間控制可以在細粒度層級配置——您可以關閉應付發票的期間,同時保持總帳分錄的期間開放,允許會計團隊過帳調整分錄,同時防止新的供應商發票被回溯。
如果使用者嘗試完成日期在已關閉期間的文件,iDempiere 會以錯誤拒絕該動作。管理員必須重新開放期間,或使用者必須將文件日期更改為落在開放期間內的日期。
會計過帳的運作方式
Fact_Acct 資料表
當文件完成時,iDempiere 在 Fact_Acct 資料表中生成會計分錄。此資料表是實際的總帳——每份已完成文件產生的每筆借方和貸方都記錄在這裡。過帳流程:
- 文件完成觸發過帳引擎。
- 引擎讀取文件類型的會計規則、產品類別的科目對應、業務夥伴的會計預設值和組織的會計架構。
- 它生成適當的分錄。例如,完成應收發票建立:借記應收帳款,貸記收入(以及適用時的應付稅款)。
- 分錄寫入
Fact_Acct,並附帶回到來源文件的引用,允許從任何會計分錄向下鑽取到原始交易。
如果過帳失敗(例如因為缺少科目對應),文件仍然完成,但會被標記過帳錯誤。立即過帳系統設定控制過帳是同步發生(在完成時)還是非同步發生(透過背景程序)。管理員可以透過「未過帳」流程查看和解決過帳錯誤。
作廢 vs. 沖銷:何時使用哪個
iDempiere 中最常見的混淆來源之一是作廢、沖銷-更正和沖銷-應計之間的區別。以下是清楚的指南:
- 作廢:用於尚未完成的文件,或在當前期間的已完成文件中,您想要取消而不建立可見的沖銷軌跡。作廢將文件的數量和金額歸零。對於已完成的文件,會計分錄在同一文件內被沖銷。
- 沖銷 – 更正:用於需要清晰、可稽核沖銷的已完成文件。這會建立一份帶有相反符號的新文件,與原始文件交叉引用。兩份文件都以其原始日期保留在系統中。這在大多數情況下是首選方法,因為它維護了完整的稽核軌跡。
- 沖銷 – 應計:用於沖銷已關閉前期的交易。沖銷過帳到當前日期和當前期間,使原始期間的帳簿不受干擾。這對期間結束的完整性至關重要——您不應該為了沖銷一份文件而重新開放已關閉的期間。
常見文件處理錯誤及解決方案
在處理文件時,您不可避免地會遇到處理錯誤。以下是最常見的錯誤及其解決方法:
- 「找不到價格」:產品在與業務夥伴或訂單關聯的價目表中沒有價格。解決方案:將產品添加到適當的價目表版本,確保版本的生效日期在文件日期當天或之前。
- 「期間已關閉」:文件日期落在已關閉的會計期間。解決方案:將文件日期更改為開放期間內的日期,或請管理員重新開放期間。
- 「庫存不足」:嘗試出貨超過可用庫存數量(當不允許負庫存時)。解決方案:先收貨、調整庫存或減少出貨數量。
- 「文件過帳錯誤」:文件已完成但未能過帳到總帳,通常是因為缺少科目對應。解決方案:檢查產品類別會計、業務夥伴會計或銀行帳戶會計中缺少的科目。修復對應並重新過帳。
- 「需要核准」:文件在完成前需要主管核准。解決方案:透過核准工作流程發送文件,或由授權使用者核准。
- 「無法作廢/沖銷——存在相依文件」:您正嘗試作廢一個已有已完成出貨單或發票的訂單。解決方案:先作廢或沖銷相依文件(發票,然後出貨單),再作廢訂單。
重點摘要
- iDempiere 中的文件是交易記錄(訂單、發票、付款、出貨),遵循由 DocStatus 和 DocAction 控制的定義生命週期。
- 主要生命週期為草稿 (DR) → 處理中 (IP) → 已完成 (CO),另有已作廢 (VO)、已沖銷 (RE) 和已關閉 (CL) 等額外狀態。
- 準備驗證文件但不最終確定;完成使其成為永久並觸發會計過帳。
- 沖銷-更正建立與原始日期相同的沖抵文件;沖銷-應計使用今天的日期——這對跨已關閉期間處理更正至關重要。
- 文件類型定義處理行為、編號序列和會計類別。
- 期間控制防止過帳到已關閉的期間,維護已完成財務報表的完整性。
- Fact_Acct 資料表儲存所有會計分錄,連結回來源文件以實現完整的可追溯性。
- 大多數處理錯誤與缺少價格、已關閉期間、庫存不足或缺少科目對應有關——所有這些都可以透過適當的設定來解決。
下一步
有了對 iDempiere 文件流程的紮實理解,第 11 課將向您介紹基本報表。您將學習如何使用列印格式、報表檢視和 Jasper Reports,從您的文件所建立的資料中提取有意義的資訊。
日本語
概要
- 学習内容:iDempiere でドキュメントがそのライフサイクルをどのように辿るか——ドラフトとしての作成から完了、無効化、取消まで——そしてドキュメントタイプ、採番、期間制御がこのプロセスをどのように管理するか。
- 前提条件:レッスン 1(iDempiere 入門)、レッスン 3(インターフェースナビゲーション)、レッスン 7(勘定科目表の設定)
- 想定読了時間:22 分
はじめに
iDempiere では、ほぼすべてのビジネス取引(受注の作成、商品の入荷、請求書の発行、支払の記録)はドキュメントとして表現されます。ドキュメントは静的なレコードではなく、ドキュメントステータスとアクションによって制御される、慎重に定義されたライフサイクルを辿ります。このライフサイクルはビジネスルールを強制し、データの整合性を確保し、会計転記をトリガーし、完全な監査証跡を維持します。
ドキュメント処理の理解は、iDempiere のユーザーや管理者にとって最も基本的なスキルの一つです。このレッスンではドキュメントのライフサイクルを詳細に説明し、すべてのステータスとアクションをカバーし、よく混乱を招く概念(無効化と取消の違い、準備と完了をいつ使うかなど)を明確にします。
iDempiere のドキュメントとは?
iDempiere のドキュメントとは、定義された処理ワークフローを通過する取引レコードです。システム内のすべてのレコードがドキュメントではありません。ビジネスパートナー、製品、勘定科目表エントリなどのマスターデータレコードはドキュメントではありません。ドキュメントとは、ビジネスイベントを表し、DocStatus と DocAction フィールドを持つレコードを指します。
iDempiere の主要なドキュメントには以下が含まれます:
- 受注 (C_Order):顧客が商品やサービスを購入するコミットメント。
- 発注 (C_Order):仕入先から購入するコミットメント。受注と発注は同じテーブルを共有しますが、ドキュメントタイプで区別されます。
- 入荷 (M_InOut):仕入先から倉庫への商品の物理的な受領を記録します。
- 出荷 (M_InOut):倉庫から顧客への商品の物理的な配送を記録します。受注と同様に、入荷と出荷は
M_InOutテーブルを共有します。 - 買掛請求書 (C_Invoice):受領した商品やサービスに対する仕入先の請求書。
- 売掛請求書 (C_Invoice):配送した商品やサービスに対する顧客への請求書。
- 支払 (C_Payment):金銭取引を記録——顧客からの入金または仕入先への支払。
- 銀行取引明細 (C_BankStatement):消込のための銀行からの取引を記録します。
- GL 仕訳帳 (GL_Journal):総勘定元帳に直接転記される手動会計仕訳。
- 在庫移動 (M_Movement):倉庫またはロケーター間の商品の移動を記録します。
- 実地棚卸 (M_Inventory):棚卸数量の調整を記録します。
ドキュメントステータス (DocStatus)
DocStatus フィールドは、ドキュメントがライフサイクルのどの段階にあるかを追跡します。iDempiere は以下のステータスを定義しています:
主要ステータス
- ドラフト (DR):ドキュメントは作成されましたが、まだ処理されていません。完全に編集可能です。これはすべての新規ドキュメントの初期状態です。ドラフトドキュメントは在庫、会計、コミットメントに影響を与えません。自由に変更や削除が可能な作業中のレコードです。
- 進行中 (IP):ドキュメントは準備(検証)されましたが、まだ完了していません。この状態では、iDempiere は検証チェック(必須フィールドの入力確認、数量の有効性、価格の存在確認、ビジネスルールの充足)を実行済みです。ドキュメントはリソースを予約(例:受注の在庫が引当)しますが、まだ確定していません。ドキュメントはまだ変更可能ですが、一部のフィールドが制限される場合があります。
- 完了 (CO):ドキュメントは完全に処理されました。ビジネスイベントの永久的で不変のレコードとなります。完了したドキュメントは完全な効果をトリガーします:在庫数量の更新、会計仕訳の総勘定元帳への転記、コミットメントの記録、確定ドキュメント番号の付与。完了したドキュメントは編集できません。変更するには、無効化するか取消を作成する必要があります。
- 無効 (VO):ドキュメントは取り消されました。無効化するとドキュメントの効果がキャンセルされます。まだ完了していないドキュメントの場合、無効化はすべての数量と金額をゼロに設定するだけです。完了したドキュメントの場合、動作はドキュメントタイプによって異なります(下記の無効 vs. 取消セクションを参照)。
- 取消済 (RE):ドキュメントは新しい相殺ドキュメントの作成により取り消されました。元のドキュメントと取消ドキュメントは相互に参照し、明確な監査証跡を作成します。元のドキュメントと取消の合計効果はゼロです。
- クローズ (CL):ドキュメントは管理上クローズされました。クローズは、完了しているが残りの未処理数量や金額を償却すべきドキュメントに使用されます。例えば、100 ユニットの発注で 80 ユニットのみ入荷した場合、クローズすることで残りの 20 ユニットは入荷しないことを示します。入荷した 80 ユニットは有効なまま残り、未処理残高のみがキャンセルされます。
追加ステータス
- 不明 (??):未定義またはエラー状態で、通常の操作では発生しないはずです。このステータスに遭遇した場合、調査が必要な処理エラーを示している可能性があります。
- 支払待ち (WP):特定のワークフローで使用され、さらなる処理の前に支払確認が保留されているドキュメントです。
- 承認済 (AP):承認ワークフローでドキュメントが承認されたことを示します。これは進行中と完了の間の中間状態で、組織のポリシーがドキュメント完了前に管理者の承認を必要とする場合に使用されます。
ドキュメントアクション (DocAction)
DocStatus はドキュメントがどこにあるかを示し、DocAction は次に何ができるかを定義します。利用可能なアクションは現在のステータスに応じて変わります。以下がドキュメントアクションです:
コアアクション
- 準備 (PR):ドキュメントを検証し、ドラフトから進行中に遷移させます。準備は一連のチェックを実行します:すべての必須フィールドが入力されているか?参照された製品が価格リストに存在するか?数量は正の値か?ビジネスパートナーは有効か?すべてのチェックが通ると、ドキュメントは進行中ステータスに移行します。準備は受注の在庫引当と税額計算も行います。準備は最終コミットメント前にエラーを検出する「ドライラン」と考えてください。
- 完了 (CO):ドキュメントを確定し、完了ステータスに遷移させます。ドキュメントがまだドラフト状態の場合、完了はまず準備(すべての検証チェックを実行)してから一つのステップで完了します。完了はドキュメントの実際の効果をトリガーします——在庫移動、会計転記、コミットメント更新。これはドキュメントのライフサイクルで最も重要なアクションです。ドキュメントの影響を永久的にし、ドキュメント自体を不変にするためです。
- 無効化 (VO):ドキュメントをキャンセルします。動作は現在のステータスによって異なります:
- ドキュメントがドラフトまたは進行中の場合:数量と金額がゼロに設定され、ステータスが無効に変更されます。永久的な効果が存在しないため、取消ドキュメントは作成されません。
- ドキュメントが完了している場合:動作はドキュメントタイプによって異なります。一部の完了ドキュメントは直接無効化(金額をゼロに設定)できますが、他のものは取消が必要です。
- クローズ (CL):ドキュメントを管理上クローズし、残りの未処理数量や金額を償却します。完了したドキュメントに対してのみ使用可能です。クローズは処理済みの数量を取り消しません——未履行部分のみを消去します。
- 取消 – 修正 (RC):元のドキュメントを正確に相殺する新しいドキュメントを作成し、取引を実質的に取り消します。取消ドキュメントは元のドキュメントと同じ日付を持ち、同じ会計期間に転記されます。両方のドキュメントはクロスリファレンスされます。当期にエラーを発見し、取引をなかったことにしたい場合に取消-修正を使用します。
- 取消 – 見越 (RA):取消-修正と似ていますが、取消ドキュメントの日付は元のドキュメントの日付ではなく本日(現在の日付)になります。これは取消が当期の会計期間に転記されることを意味します。既にクローズされた前期の取引を取り消す必要がある場合に取消-見越を使用します。元の仕訳はその期間に残り、相殺仕訳が当期に表示されます。
- なし (–):アクションなし。これは利用可能または適切なアクションがない場合のデフォルトです。
承認関連アクション
- 承認 (—):承認ワークフローでドキュメントを承認し、完了への進行を許可します。
- 却下 (—):承認ワークフローでドキュメントを却下し、修正のために差し戻します。
ドキュメントライフサイクルの実践
受注を例にして、典型的なドキュメントのライフサイクルを追ってみましょう:
- 作成(ドラフト):営業担当者が受注ウィンドウを開き、新しいレコードを作成します。顧客を選択し、製品、数量、価格を含む明細行を入力します。受注は
DocStatus = DRで保存されます。この時点では、受注は計画に過ぎません。何もコミットされていません。 - 準備(進行中):ユーザーがドキュメントアクションボタンをクリックし、「準備」を選択します。iDempiere はすべての明細行を検証し、製品の在庫を確認し、税額を計算し、価格リストを検証します。すべてが有効であれば、ステータスは
DocStatus = IPに変わります。在庫は引当(ソフト割当)されますが、まだ物理的にコミットされていません。必要に応じて受注を変更できます。 - 完了(完了):ユーザーが「完了」を選択します。受注は
DocStatus = COで確定されます。ドキュメント番号シーケンスが消費され(受注が正式な番号を取得)、受注は不変になります。標準的な受注の場合、完了は在庫を移動したり会計仕訳を作成したりしません。それらは出荷や請求書が完了したときに発生します。ただし、受注は確定したコミットメントを表すようになります。 - 下流ドキュメント:完了した受注から、ユーザーは出荷(商品の配送)と請求書(顧客への請求)を生成します。それぞれが独自のライフサイクルを持つ別々のドキュメントです。出荷の完了は在庫を減少させます。請求書の完了は会計仕訳を作成します(借方:売掛金、貸方:収益)。
- クローズまたは取消(必要に応じて):部分出荷後に顧客が注文の一部をキャンセルした場合、ユーザーは受注をクローズして残りの未出荷数量を償却できます。注文全体がエラーだった場合、ユーザーはそれを無効化または取消できます(下流の出荷や請求書も処理する必要があります)。
ドキュメントタイプと採番
ドキュメントタイプ (C_DocType)
iDempiere のすべてのドキュメントは、C_DocType テーブルに格納されたドキュメントタイプに関連付けられています。ドキュメントタイプはいくつかの重要な動作を制御します:
- ドキュメント基本タイプ:基本カテゴリを識別します(例:受注、買掛請求書、売掛請求書、支払)。これにより iDempiere が適用する処理ロジックが決まります。
- ドキュメントサブタイプ:基本タイプ内でさらに動作を細分化します。受注のサブタイプには、標準注文、倉庫注文、信用注文、POS 注文、前払注文があり、それぞれ在庫引当、請求、支払処理に異なる影響を与えます。
- ドキュメントシーケンス:ドキュメント番号の生成に使用する採番シーケンスを指定します。
- GL カテゴリ:会計転記の総勘定元帳カテゴリを決定します。
- ドキュメント部数:デフォルトで印刷する部数。
特定のビジネスプロセスをサポートするためにカスタムドキュメントタイプを作成できます。例えば、特定の処理ルールを持つ「委託販売受注」ドキュメントタイプや、請求書の訂正用の「デビットノート」ドキュメントタイプを作成できます。
ドキュメント採番(ドキュメントシーケンス)
ドキュメントシーケンス(AD_Sequence)は自動採番を制御します。各ドキュメントタイプは一意のドキュメント番号を生成するシーケンスを参照します。主要なシーケンス設定には以下が含まれます:
- プレフィックスとサフィックス:番号の前後に追加されるテキスト(例:プレフィックス “SO-” は SO-10001、SO-10002 のような番号を生成)。
- 増分:連続する番号間のステップ(通常 1)。
- 次の番号:次に割り当てられる番号。
- 自動採番:有効にすると番号が自動的に割り当てられます。無効にすると、ユーザーがドキュメント番号を手動入力する必要があります(仕入先請求書番号に便利)。
iDempiere は確定採番(完了時に割当)と仮採番(作成時に割当)の両方をサポートします。ほとんどのドキュメントタイプでは、確定番号はドキュメントの完了時に割り当てられ、シーケンスに欠番が生じないようにします。厳格な連番要求がある管轄区域では、欠番がコンプライアンス上の問題を引き起こす可能性があります。
期間制御
会計期間 (C_Period)
iDempiere は会計年度を C_Period テーブルに格納された期間(通常は月)に分割します。各期間には開始日、終了日、およびドキュメントをその期間に転記できるかどうかを制御するステータスがあります。
期間のステータスには以下が含まれます:
- オープン:ドキュメントをこの期間に完了・転記できます。通常の日常業務では、当期がオープンである必要があります。
- クローズ:この期間に新しいドキュメントを転記できません。期間のクローズは標準的な月次締め手続きで、取引の偶発的なバックデートを防止します。
- 永久クローズ:クローズと同様ですが、再オープンできません。最終監査後に使用され、変更がないことを確保します。
期間制御は細かいレベルで設定できます。例えば、買掛請求書の期間をクローズしながら GL 仕訳帳の期間をオープンに保つことで、会計チームが調整仕訳を転記できるようにしつつ、新しい仕入先請求書のバックデートを防止できます。
ユーザーがクローズされた期間の日付でドキュメントを完了しようとすると、iDempiere はエラーでアクションを拒否します。管理者が期間を再オープンするか、ユーザーがドキュメント日付をオープン期間内の日付に変更する必要があります。
会計転記の仕組み
Fact_Acct テーブル
ドキュメントが完了すると、iDempiere は Fact_Acct テーブルに会計仕訳を生成します。このテーブルが実際の総勘定元帳です。すべての完了ドキュメントから生じるすべての借方と貸方がここに記録されます。転記プロセス:
- ドキュメントの完了が転記エンジンをトリガーします。
- エンジンはドキュメントタイプの会計ルール、製品カテゴリの勘定マッピング、ビジネスパートナーの会計デフォルト、および組織の会計スキーマを読み取ります。
- 適切な仕訳を生成します。例えば、売掛請求書の完了は次を作成します:借方 売掛金、貸方 収益(該当する場合は未払税金も)。
- 仕訳はソースドキュメントへの参照とともに
Fact_Acctに書き込まれ、任意の会計仕訳から元の取引へのドリルダウンが可能になります。
転記が失敗した場合(例えば勘定マッピングの欠落)、ドキュメントは完了状態のままですが、転記エラーのフラグが付けられます。即時転記システム設定は、転記が同期的(完了時)に行われるか非同期的(バックグラウンドプロセス経由)に行われるかを制御します。管理者は「未転記」プロセスを通じて転記エラーを確認・解決できます。
無効化 vs. 取消:どちらをいつ使うか
iDempiere で最も一般的な混乱の原因の一つは、無効化、取消-修正、取消-見越の違いです。以下に明確なガイドを示します:
- 無効化:まだ完了していないドキュメント、または当期の完了ドキュメントで目に見える取消の証跡を作成せずにキャンセルしたい場合に使用します。無効化はドキュメントの数量と金額をゼロにします。完了ドキュメントの場合、会計仕訳は同じドキュメント内で取り消されます。
- 取消 – 修正:明確で監査可能な取消が必要な完了ドキュメントに使用します。元のドキュメントとクロスリファレンスされた、逆符号の新しいドキュメントを作成します。両方のドキュメントは元の日付でシステムに残ります。完全な監査証跡を維持するため、ほとんどの場合これが推奨される方法です。
- 取消 – 見越:クローズされた前期の取引を取り消す場合に使用します。取消は当日の日付と当期に転記され、元の期間の帳簿はそのまま残ります。これは期末の整合性にとって不可欠です。ドキュメントを取り消すためだけにクローズされた期間を再オープンすべきではありません。
一般的なドキュメント処理エラーと解決策
ドキュメントを扱う中で、処理エラーに遭遇することは避けられません。以下に最も一般的なエラーとその解決方法を示します:
- 「価格が見つかりません」:製品がビジネスパートナーまたは受注に関連付けられた価格リストに価格を持っていません。解決策:製品を適切な価格リストバージョンに追加し、バージョンの有効開始日がドキュメント日付以前であることを確認します。
- 「期間がクローズされています」:ドキュメント日付がクローズされた会計期間に該当します。解決策:ドキュメント日付をオープン期間の日付に変更するか、管理者に期間の再オープンを依頼します。
- 「在庫不足」:利用可能な手持在庫を超える出荷を試みています(マイナス在庫が許可されていない場合)。解決策:まず入荷する、在庫を調整する、または出荷数量を減らします。
- 「ドキュメント転記エラー」:ドキュメントは完了しましたが、通常は勘定マッピングの欠落により総勘定元帳への転記に失敗しました。解決策:製品カテゴリの会計、ビジネスパートナーの会計、または銀行口座の会計で欠落している勘定を確認します。マッピングを修正して再転記します。
- 「承認が必要です」:ドキュメントは完了前に上司の承認が必要です。解決策:承認ワークフローを通じてドキュメントを回付するか、権限のあるユーザーに承認してもらいます。
- 「無効化/取消できません — 依存ドキュメントが存在します」:完了した出荷や請求書が既に存在する受注を無効化しようとしています。解決策:まず依存ドキュメント(請求書、次に出荷)を無効化または取り消し、それから受注を無効化します。
重要ポイント
- iDempiere のドキュメントは、DocStatus と DocAction によって制御される定義されたライフサイクルに従う取引レコード(受注、請求書、支払、出荷)です。
- 主要なライフサイクルはドラフト (DR) → 進行中 (IP) → 完了 (CO) で、無効 (VO)、取消済 (RE)、クローズ (CL) の追加ステータスがあります。
- 準備はドキュメントを検証するが確定しません。完了はドキュメントを永久的にし、会計転記をトリガーします。
- 取消-修正は元の日付の相殺ドキュメントを作成します。取消-見越は本日の日付を使用します。これはクローズされた期間をまたがる修正の処理に不可欠です。
- ドキュメントタイプは処理動作、採番シーケンス、会計カテゴリを定義します。
- 期間制御はクローズされた期間への転記を防止し、確定した財務諸表の整合性を維持します。
- Fact_Acct テーブルはすべての会計仕訳を格納し、完全なトレーサビリティのためにソースドキュメントにリンクされています。
- ほとんどの処理エラーは、価格の欠落、クローズされた期間、在庫不足、または勘定マッピングの欠落に関連しており、適切な設定ですべて解決可能です。
次のステップ
iDempiere でのドキュメントの流れをしっかりと理解したところで、レッスン 11 では基本レポートを紹介します。印刷フォーマット、レポートビュー、Jasper Reports を使用して、ドキュメントが作成したデータから有意義な情報を抽出する方法を学びます。