Adding a Custom Field in Compiere 3

Exclusive offer: get 50% off this eBook here
Compiere 3

Compiere 3 — Save 50%

An essential and concise guide to understanding and implementing Compiere.

$26.99    $13.50
by Andries L Pretorius | June 2010 | Open Source

Having seen the Compiere Application Dictionary and its components, in this article by Andries L Pretorius, author of Compiere 3 Implementation Guide, we will cover how to add a menu item and a custom list field to a Compiere window by using the AD components.

(For more resources on Compiere 3, see here.)

The user menu is your default tree, and is accessed through the System Administrator role. You can find the Menu item in the screen tree:

Compiere 3 Implementation Guide

The above screenshot illustrates a typical window set-up, which is done as follows:

  1. Create a new menu item by clicking on the New button. Enter a name and a description.
  2. Define its action type: A menu item's action type can be a Window, Form,Process, Report, Task, or Workflow. Link an AD item to the menu, which is illustrated above, where window Sales Order is linked to the Sales Order menu item.
  3. Move the menu item in context of the main menu tree for users understanding and access.

It is recommended that you define your own windows, or copy from the existing dictionary, for customizations. Because dictionary (system) defined items may be overwritten during the process of migrating to a new version, it is better to copy a window and customize it in the copied window (or create new). This applies to Java code as well: never change the original source as it may be overwritten during migration.

Adding a new field to a window and database

In this section we are going to illustrate how the System Administrator would go about adding a new field to the database. As an illustration, we are going to add a probability reference field that can be used to measure a predefined set of outcomes on an order to the Sales Order window.

  1. .Find the context by Zooming to the Table from the Window. Open and find the Sales Order window in the Window, Tab, and Field menu item when logged in as System Administrator:

    Compiere 3 Implementation Guide

  2. Zoom from the window into the underlying Table and Column window.Order records are maintained in the database in the C_Order table:

    Compiere 3 Implementation Guide

  3. Next we refer the Column tab, and create a new column in the table(see the field naming conventions below). The new column must be as a System Element defined and hence we need to create a System Element prior to using it as a Column in the Table:

    Compiere 3 Implementation Guide

  4. Once the System Element has been defined, we set up the Column as follows:

    Compiere 3 Implementation Guide

  5. Create a new Reference key as follows:

    Compiere 3 Implementation Guide

    Because this is a custom list, we choose a validation type of List Validation, and a value format of L, indicating that any letters are allowed. For a full list of these conventions, refer to the help documentation in the system by pressing F1.

  6. We then define the Reference key's list validation options as follows:

    Compiere 3 Implementation Guide

  7. The finalized column (and thus the ultimate window field) set-up is thus shown as follows:

    Compiere 3 Implementation Guide

Compiere 3 An essential and concise guide to understanding and implementing Compiere.
Published: June 2010
eBook Price: $26.99
Book Price: $44.99
See more
Select your format and quantity:

(For more resources on Compiere 3, see here.)

We finalize the set-up of the field by indicating:

  1. Field naming conventions: Compiere recommends that customer-specific table and database column names be prefixed by EXT_, XX_, or CUST_, or the four letter entity registered with Compiere, such as SAAC_. This would also apply to indexes and constraints. The reason for this is that these entities are ignored in the migration process.
  2. Length of field: Because we know that for this particular field there is going to be only one character we define a length of 1.
  3. Default logic: We assume U, based on our list being Unknown.
  4. Mandatory UI: Indicates that this field will be mandatory in the window, but not at database level.
  5. Updatable: Indicates that the field is editable.
  6. Always Updatable: Indicates that the field is always updatable, regardless of document status.

Final step in column creation—Create / Synchronize with the database

The final step in the process of creating a field is to make sure that it is synchronized to the underlying database from the AD. Scroll down on the column tab to find the Synchronize Column button, as shown in the example below:

Compiere 3 Implementation Guide

Adding our custom field to the Order window

Back in the menu item Window, Tab, and Field (find the Sales Order window) > Tab (header/top level):

  1. Click on the Create Fields button to add the field to the database:

    Compiere 3 Implementation Guide

  2. Change the desired sequence of the field to the correct position in the list of fields:

    Compiere 3 Implementation Guide

  3. Re-open the appropriate Sales Order window to display the field:

    Compiere 3 Implementation Guide

Summary

In this article we illustrated how to add a menu item and a custom list field to a Compiere window by using the AD components.


Further resources on this subject:


Compiere 3 An essential and concise guide to understanding and implementing Compiere.
Published: June 2010
eBook Price: $26.99
Book Price: $44.99
See more
Select your format and quantity:

About the Author :


Andries L Pretorius

Andries L Pretorius, CA(SA) ACMA(UK), an accountant by training who understands programming, is founder of Astidian Systems a leading Compiere and professional open source applications development and consulting house, which is a pioneer in deploying Compiere within its market for more than the last seven years.

He has led many Compiere implementations as well as SAP R/3 and Great Plains (now MS Dynamics) implementations both from a consulting and business owner perspective. He has been the lead architect in many custom Compiere enhancements and has over 15 years of experience in ERP and CRM applications.

His experience includes CFO and COO of leading South African retail, wholesale, and distribution enterprises, financial manager at a telecoms provider in Singapore as well as being articled at Deloitte Johannesburg and New York offices.

You can reach him on his blog on www.astidian.com/blog.

Books From Packt


ADempiere 3.4 ERP Solutions
ADempiere 3.4 ERP Solutions

Microsoft Silverlight 4 Business Application Development: Beginner’s Guide
Microsoft Silverlight 4 Business Application Development: Beginner’s Guide

Mastering phpMyAdmin 3.1 for Effective MySQL Management
Mastering phpMyAdmin 3.1 for Effective MySQL Management

Application Development for IBM WebSphere Process Server 7 and Enterprise Service Bus 7
Application Development for IBM WebSphere Process Server 7 and Enterprise Service Bus 7

Microsoft Dynamics NAV 2009 Application Design
Microsoft Dynamics NAV 2009 Application Design

SAP Business ONE Implementation
SAP Business ONE Implementation

Oracle Database 11g – Underground Advice for Database Administrators
Oracle Database 11g – Underground Advice for Database Administrators

Maximize Your Investment: 10 Key Strategies for Effective Packaged Software Implementations
Maximize Your Investment: 10 Key Strategies for Effective Packaged Software Implementations


Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software