Difference between revisions of "Create a custom document class"

From iDempiere en
m (Add category)
 
(6 intermediate revisions by 2 users not shown)
Line 14: Line 14:
 
== Steps to create a new custom document ==
 
== Steps to create a new custom document ==
  
 +
=== Create the model ===
 +
The "Model" is the database table representation and classes for the document's data.
 
* Create a new Model (will be explained more in detail)
 
* Create a new Model (will be explained more in detail)
 
** Except for the other mandatory fields the model must contain the following fields
 
** Except for the other mandatory fields the model must contain the following fields
Line 19: Line 21:
 
** C_DocTypeTarget_ID numeric(10,0) NOT NULL DEFAULT 0::numeric
 
** C_DocTypeTarget_ID numeric(10,0) NOT NULL DEFAULT 0::numeric
 
** DocAction character varying(2) NOT NULL DEFAULT 'CO'::bpchar (Reference = Button, Process = Custom Workflow, Reference Key = _Document Action)
 
** DocAction character varying(2) NOT NULL DEFAULT 'CO'::bpchar (Reference = Button, Process = Custom Workflow, Reference Key = _Document Action)
−
** DocStatus character varying(2) NOT NULL DEFAULT 'DR'::character varying
+
** DocStatus character varying(2) NOT NULL DEFAULT 'DR'::character varying (Reference = List, Reference Key = _Document Status)
 
** DocumentNo character varying(30) NOT NULL
 
** DocumentNo character varying(30) NOT NULL
 
** processed character(1) DEFAULT 'N'::bpchar
 
** processed character(1) DEFAULT 'N'::bpchar
Line 26: Line 28:
 
* Generate the model class
 
* Generate the model class
 
* The model class must implement DocAction.
 
* The model class must implement DocAction.
 +
 +
=== Define the window ===
 +
Define the window as you normally do. The following fields must be present to enable the document workflow.
 +
* Processed
 +
* DocStatus, set to "Read Only"
 +
* DocAction
  
 
=== Create Custom Workflow ===
 
=== Create Custom Workflow ===
Line 42: Line 50:
 
* Set Workflow Type = Document Process
 
* Set Workflow Type = Document Process
 
* Table = same table as the model.
 
* Table = same table as the model.
 +
 +
[[Category: HowTo-Technical]]
 +
[[Category: Development|P]]
 +
[[Category: Developer documentation‏‎]]
 +
[[Category: User Manual]]
 +
[[Category: System administration]]
 +
[[Category: Applying means]]
 +
[[Category: Document]]
 +
 +
 +
 +
 +
[[en:Create a custom document class]]
 +
[[es:Crear una clase de documento personalizada]]

Latest revision as of 14:08, 19 September 2015

A "document" in iDempiere is an application concept that is very useful. Many of iDempiere's built in functions use documents for its implementation. Examples of documents are:

  • Invoices
  • Shipments
  • Inventory moves/adjustments
  • Payments

What makes documents special from other entities (such as business partners / products) are that they have a document status.

The document status enables the documents to be in a workflow and be in different statuses.

This concept is very powerful and the possibility to create new custom documents makes iDempiere even more powerful and flexible.

Steps to create a new custom document

Create the model

The "Model" is the database table representation and classes for the document's data.

  • Create a new Model (will be explained more in detail)
    • Except for the other mandatory fields the model must contain the following fields
    • C_DocType_ID numeric(10,0) NOT NULL DEFAULT 0::numeric (Reference = Table, Reference Key = C_DocType)
    • C_DocTypeTarget_ID numeric(10,0) NOT NULL DEFAULT 0::numeric
    • DocAction character varying(2) NOT NULL DEFAULT 'CO'::bpchar (Reference = Button, Process = Custom Workflow, Reference Key = _Document Action)
    • DocStatus character varying(2) NOT NULL DEFAULT 'DR'::character varying (Reference = List, Reference Key = _Document Status)
    • DocumentNo character varying(30) NOT NULL
    • processed character(1) DEFAULT 'N'::bpchar
    • processing character(1) DEFAULT 'N'::bpchar
    • isapproved character(1) NOT NULL DEFAULT 'Y'::bpchar
  • Generate the model class
  • The model class must implement DocAction.

Define the window

Define the window as you normally do. The following fields must be present to enable the document workflow.

  • Processed
  • DocStatus, set to "Read Only"
  • DocAction

Create Custom Workflow

  • Create Workflow
  • Create Node (DocComplete)
    • Action = Document Action
    • Document Action = Complete
  • Create Node (DocPrepare)
    • Action = Document Action
    • Document Action = Prepare
    • Create Transition. Next Node = (DocComplete)
  • Create Node (Start)
    • Action = Wait (Sleep)
    • Create Transition. Next Node = (DocPrepare)
  • Go back to workflow and select Start Node = (Start)
  • Set Workflow Type = Document Process
  • Table = same table as the model.
Cookies help us deliver our services. By using our services, you agree to our use of cookies.