Purpose of the module
One of the most common development activities in Openbravo is to create a new tab which allows the user to add, modify and delete new information into the database, or to add additional fields to existing tabs. Following Openbravo's Model Driven Development, these processes require the user to create Application Dictionary components for each tab and field he wants to add. The creation of these objects can sometimes be difficult, as lots of properties need to be specified, and some concepts that need to be taken into account, such as Modularity Naming Rules, can be complicated to some non-advanced users.
Moreover, these processes also require the user to add database physical objects (tables and columns) which correspond to the added tabs and fields. These objects are normally created directly through the Database Management System, and not through Openbravo, and this involves an additional step that can also be very difficult to non-advanced users.
The main purpose of this module is to centrallize all the information which is needed for these two common processes, and to greatly simplify the whole process. This module will therefore allow the user to:
- Create a customization module which will contain all the created objects
- Choose an existing tab in the application, or specify the information needed to create a new one
- Specify the information needed to create a new field from scratch, or choose one from a list of predefined Field Templates (which will be the most common cases of newly user created fields).
And after that, it will:
- Create all the necessary objects in the database (both application dictionary objects and database physical objects) automatically, through a process that is triggered by a single user click.
- Allow the user to initiate the rebuild of the system, which will complete the process (this is necessary to compile the newly created and the modified windows again)
High level summary of the whole process
All the functionalities which the Easy Extensible Attributes module provides can be accessed through one single window: the Easy Extensible Attributes window, which can be found in General Setup/Application.
The process the user needs to follow to create or to extend new tabs has several steps. This is a short description of every one of them:
- Create or specify the module to extend: The new objects will be created inside a module which needs to be created by the user. The next section in this user manual will cover this topic
- Create a new record in the Easy Extendable attributes window: In this record, you specify whether you want to create a new tab, or extend an existing tab. If you want to create a new tab, you need to provide some additional information.
- Create new records in the Field tab of the Easy Extendable Attributes window: In this tab, you need to create a new record for each additional field you want to create.
- Apply the changes to the Application Dictionary: This process is called from a button in the Easy Extensible Attributes window, in the "Window" tab, and creates all the objects in the Application Dictionary and all the physical database objects.
- Rebuild the system: This final step involves recompiling the application and restarting tomcat. This can also be called directly from the Easy Extensible Attributes window.
These are the steps you need to follow to create the tabs and fields. In the subsequent sections of this guide we will explain each one more in detail.
Initial requirement: Creating a module
This module creates Application Dictionary and database physical objects. As you know, the correct way to create these objects is to use a module which will contain them. Therefore, the main requirement to use this module is to have your own customization module.
You can choose to create the module manually through the application, or you can use the built-in tool to do so.
Creating the module manually has the advantage that you can choose your own name, javapackage, dbprefix, ... However, if you do it this way you must make sure that you create the module correctly. This means that you must make sure that:
- The module has a defined database prefix.
- The module has a defined datapackage.
- The module has the "Translation required" setting set as "yes".
- The module is set as "In Development"
If you want to use the built-in tool, you just have to select the "Create standard module" checkbox that appears just beside the Module menu, in the Easy Extensible Attributes window.
Specially for new users, it's recommended to use the built-in tool to create the module.
First step: create a new tab or specify an existing tab
The first main step in the process is to create a new entry in the Easy Extensible Attributes window. In this record, you specify:
- The module in which all the objects will be created (must be the module you created in the previous step)
- The window you want to extend
- Whether you want to extend an existing tab of this window, or create a new one in it.
If you choose to extend a tab, you will need to specify the existing tab you want to extend:
and after selecting the correct tab, you are done with this step, and you can continue with the next one.
If instead you want to create a new tab, you need to provide a little bit more information:
- The tab name will be used also (with correct adjustments to take into account Openbravo naming rules) for the physical table name, and for the Java DAL entity created for the table.
- The child of tab can be left blank. If you choose one tab, the new tab will be created as a child of the selected tab. If this is the case, there will be a direct relationship between the entities you create in your tab, and the entities of the parent tab (each entity created in the child tab will have a parent).
- The after tab is used to position the new tab in the correct place in the Tabs bar.
How to create new fields
Once you have created a new record in the Window tab of the Easy Extensible Attributes module (either to create a new tab, or to extend an existing tab), the next step is to specify the new fields you want to create.
To do this, you need to create one record in the "Fields" tab for every field you want to add to the tab.
You can follow two main paths when creating a field:
- You can choose to insert all the necessary data manually.
- Or, you can choose to use one of the proposed Field Templates.
If you select one of the field templates, the name and the field type of the field will be automatically set up for you.
The Show Details check activates several additional options you can