How To Modularize The Location Selector
The objective of this article is to show you how to modify and modularize the Location Selector.
Before reading this guide, it is necessary to have a proper understanding of Openbravo's Modularity concept and how to create and package a module,
as we take the knowledge from these articles as a given in this guide.
In case you are working with configuration scripts or templates on a regular basis, the following link to an article might be of interest to you, since it describes how to create a configuration script.
The steps needed to change and modularize the Location Selector are as follows:
- Define your own Module and export it. The module folder will be then be generated, for example:
- Create the source folder for the Module we just created previously. For our example it should look like this:
- Copy the original files of the Location Selector into the newly created folder. When copying the files, maintain the original file names. The original files are located at:
Modify the following files to make them part of your package:
Change the defined package to: "com.openbravo.support.locationexample.info"
Change the package to: "com.openbravo.support.locationexample.info" Change the following mappings to use the new mappings: org/openbravo/erpCommon/info/Location_FS -> com/openbravo/support/locationexample/info/Location_FS org/openbravo/erpCommon/info/Location_F1 -> com/openbravo/support/locationexample/info/Location_F1 org/openbravo/erpCommon/info/Location_F2 -> com/openbravo/support/locationexample/info/Location_F2
After that you can apply all the changes you want to do. In our example we have just changed the labels for the fields.
- Define a new template module and mark it as In Development. You can use the template we used to deactivate the Trigger: In the Tables and Columns window, find the column which you want to use with the Locator Selector we have created and change the "Reference Searchkey" combo to use this new reference. In the example we have done it in the C_Bpartner_location table, in the c_location_Id column.
Compile the application with:
- Restart tomcat and use the column to check that the new reference is working with the new changes.
Following screenshot shows the results of our changes: