Override Workflow by Document Type(English)

Reason

Photo by Campaign Creators on Unsplash

在 iDempiere 單據按完成時,會由 DocAction 所定義的 AD_Process 去觸發所對應的 AD_Workflow _ID, 啟動 Workflow 流程. 它是以 Table / Column 基礎. iDempiere 有一個特色,多種單據共用一個 資料表(Table). 像銷售訂單, 報價單, 計劃訂單, 採購單…等等都定義在C_Order 資料表.

When the iDempiere document is completed, the AD_Process defined by DocAction will trigger the corresponding AD_Workflow _ID to start the Workflow process. It is based on Table / Column. iDempiere has a feature that multiple documents share a table (Table). Like Sales orders, quotations, planned orders, purchase orders… etc. are all defined in the C_Order table.

這樣會讓Workflow 流程設計起來變得很複雜, Workflow Start 後, 要先去判斷IsSOTrx 是銷售訂單或採購單. 甚至還要判斷單據類型C_DocumentType_ID來決定它是報價單還是正式訂單.

This will make the design of the Workflow process very complicated. After Workflow Start, you must first determine whether the IsSOTrx is a sales order or a purchase order. You must even determine the document type C_DocumentType_ID to determine whether it is a quotation or a formal order.

Improvement

首先,在 Document Type 新增加一個欄位: AD_Workflow_ID 用來取代原本的Workflow.
將Start Workflow Process 時, 進行流程轉換的動作.
透過 ProcessInfo 取後單據資訊, 包括 Record_ID , AD_Table_ID. 對檢測它的 Document Type 是否含有合法的 AD_Workflow_ID. 若有的話. 進行Override 動作.

First of all, add a new column in Document Type: AD_Workflow_ID is used to replace the original Workflow.
When the Workflow Process is started, the process is converted.
Obtain the post-document information through ProcessInfo, including Record_ID, AD_Table_ID. Check whether its Document Type contains a legal AD_Workflow_ID. If so, perform the Override action.

System administrator operating instructions

1) 單據的 AD_Workflow_ID 預設值為 NULL. 表示 Workflow 參考 AD_Table中AD_Column內的 Process 所定義的AD_Workflow_ID.

1) In Document Type, The default value of AD_Workflow_ID is NULL. It means that Workflow refers to the AD_Workflow_ID defined by the Process in the AD_Column in the AD_Table.

2)若有特殊的需求, 只要在單據上的Document Type指定另一個AD_Workflow_ID 來取代預設的 AD_Workflow_ID.

2) If you have special needs, just specify another AD_Workflow_ID in the Document Type on the receipt to replace the default AD_Workflow_ID.

發佈留言