Monday 15 November 2010

Improving Openbravo ERP Shipment documents using Extension Points


Extension Points [1] is a cool feature that allows to enhance the capabilities of the core flows in modules without customizing Openbravo ERP. This way you will not have any conflict between the new enhancements in the core flows you developed and the upgrades of Openbravo ERP. Extension points are hooks in the core PL/SQL procedures that performs the business logic of the core Openbravo ERP flows that allows to add other PL/SQL procedures to the flow that enhance and modify the functionality.

To demonstrate the capabilities of the Extension Points that the Shippment Flow includes [2]. I created a very basic Picking and Packaging module that modifies the Shipment flow adding the following functionality:

  • Processes "Create Shipments from Orders" and "Generate Shipments" generate shipments in draft status and do not complete them automatically. This allows a new step in the shipment process to pick the goods from the warehouse and pack everything together before goods are delivered to the customer.
  • A new field is defined for all Shipment lines. This field is "Ready". When this field is marked it means that the goods of the line are ready for delivery to the customer. A shipment cannot be completed until all lines are marked as "Ready".
  • For informations purposes it has been added a new field named "Due date" in the Shipments header. This field will be useful for example to create reports that list late Shipments not yet delivered.

To dig into the technical details how Extension Points are used in this module. These are the new PL/SQL functions created.

  • PNP_CREATEDRAFT [3]. This function is hooked to the Extension Point "M_Inout_Create - Calling Post Process" that is executed in the automatic generation of shipments. This function just indicates that the generated shipments must not be completed.
  • PNP_VERIFYREADY [4]. This function is hooked to the Extension Point "M_Inout_Post - Finish_Process Extension Point" that is executed when completing a Shipment document. This function verifies that all lines of the Shipment are marked as ready, and if any of the lines is not ready it cancels the process.

The Picking and Packaging module is hosted in the Openbravo Forge [5], you can inspect the source code [6] and you can install also in your Openbravo ERP instance using the Module Management window. The latest version is 1.0.1 and it has a been published in "Test" maturity status, so if you want to install in your Openbravo ERP instance you need to modify the Standard Settings of the Module Management window. This Picking and Packaging module is not intended for production environments.

This module is basically a proof of concept of what can be done with Extension Points and Modularity to extend and improve Openbravo ERP capabilities but if you like it and you want to continue implementing more functionalities you are welcome, just send a message to me.

If you want more details about the internals of Extension points I recommend this blog post [7] by my colleague Gorka Ion.

[1] http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Concepts/DB/PL-SQL_code_infrastructure#Extension_points
[2] http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Reference/ExtensionPoints
[3] https://code.openbravo.com/erp/mods/org.openbravo.module.pickingandpackaging/file/1.0.1/src-db/database/model/functions/PNP_CREATEDRAFT.xml
[4] https://code.openbravo.com/erp/mods/org.openbravo.module.pickingandpackaging/file/1.0.1/src-db/database/model/functions/PNP_VERIFYREADY.xml
[5] http://forge.openbravo.com/projects/pickingandpackaging
[6] https://code.openbravo.com/erp/mods/org.openbravo.module.pickingandpackaging/
[7] http://obdeving.wordpress.com/2009/10/27/extending-existing-procedures-at-openbravo/

Thursday 30 September 2010

Amazing uses of Openbravo POS

The community around Openbravo POS is very active and with clever members that take advantage of the product to create great things. One of the best examples of I found recently through a post in the Spanish forums [1] is the use of an iPad with Openbravo POS.

This solution has been implemented by a Trattoria in Peru called Don Angelo [2]. The iPad is offered to the customers of the restaurant instead of the menu, and they use the iPad to view the menu, and make orders. This way orders are faster and with less mistakes. Customers find it very easy and everybody is very happy with this innovation.

This solution has also attracted the attention of the media [3] and they have also a very nice promotional video where you can see Openbravo POS in action [4].

The technical details are very simple: Openbravo POS runs inside a virtual machine in a host computer, and the iPad has installed the application WYSE pocketcloud [5] for iPad that cost only $14.99 and that allows to access to the virtual machine where Openbravo POS runs.

My congratulations to the developers of this innovative solution.

[1] http://forge.openbravo.com/plugins/espforum/view.php?group_id=101&forumid=446545&topicid=7017054&topid=7018879 (in Spanish)
[2] http://www.donangelo.pe/Trattoria_Don_Angelo/Promociones/Entradas/2010/7/21_Carta_Ipad_en_nuestro_Restaurante.html (in Spanish)
[3] http://www.peru.com/noticias/portada20100812/112347/Restaurante-peruano-entre-los-pioneros-en-el-mundo-en-uso-de-iPad-en-servicio (in Spanish)
[4] http://www.youtube.com/watch?v=xEh1WD9qeeg (in Spanish)
[5] http://www.wyse.com/products/software/pocketcloud/index.asp

Thursday 29 April 2010

The fix report

In Openbravo we have a great tool for Openbravo ERP and Openbravo POS, the Openbravo Issue Tracking System. This tool is open to all partners and members of the community. Here you can log new issues, search for open issues, closed issues, monitor the evolution of issues, participate in the issues discussions, etc. Issue reporting is very important. A good issue report is great for Openbravo engineers because it helps to evaluate the issue, and makes it easier to keep track of open issues, verify and fix them. In our wiki we have a defined QA Assurance Process and a detailed Bug Reporting Guidelines that explains how to log a good issue report. I recommend to everybody that works with Openbravo ERP and POS to have a look at these documents.

But if the issue report is very important to understand and fix the issue. The fix report is also very important too. The fix report is no more than a note added to the issue report by the engineer that explains in detail what has been done to fix the issue. The fix report makes it easier for the QA team to verify the correctness of a fix because when closing an issue they have to check that the issue is properly fixed and the modifications in the sources are correct. And it is important too for users, implementers and administrators of Openbravo ERP when they have to apply a fix or upgrade a live implementation. Changes in live Openbravo ERP environments are critical and we must provide to administrators the maximum confidence in the fixes provided. Apart from fixing the issue, the rest of the existing standard or custom functionality must continue working the same way. Usually regression issues introduced by an upgrade or a fix are several times worse than the issues fixed.

In order to improve the fix report we are introducing in the Support Team new guidelines to follow after a fix has been done and pushed to the Openbravo ERP or POS sources repository. The sections that this fix report must include are the following:
  • Testing of the issue: Describes the steps to follow in Openbravo ERP or POS to verify that the issue has been fixed and the results obtained. It is usually very similar to the steps to reproduce but changing the results obtained.
  • Explanation of the changeset that fixes the issue: High level explanation of the modifications in the sources. It should explain what has been modified in each file and why. For example when adding two new fields to a report, it has to be explained that the SQL query of the report has been modified to get the field values, the jasper report template has been modified to display the fields and also that has been included two new records in the AD_TEXTINTERFACES table to translate the report labels.
  • Other areas affected by the changeset: Usually the changes done to fix an issue affects source code that is used in several parts of the application. In this section it has to be listed all the functional areas related with the change done and how are affected, and what are the changes in the behaviour if any. This section is very important because it helps to explore if any regression can appear with this fix. For example, when modifying the PL/SQL function C_INVOICE_POST, it has to be explained that all functions and windows that create and post invoices can be affected. It also has to be explained what are the type of invoices that can be affected by the issue, whether the invoices affected by this fix depends on the document type of the invoice or the payment terms...
You have a few examples of fix reports in the following issues: 12959, 12474, 12628 and 12856. And if you have suggestions to improve more the fix report we are currently implementing, we will be glad to hear them.

Friday 12 March 2010

Simplifying development of callouts

Callouts are a piece of client logic in Openbravo ERP designed to be executed whenever a field changes and as a result changes parts of a tab/window without the need of refreshing it.

The logic performed by a callout is executed by a java servlet and you can use SQLC or DAL to access data. After the code has been written you only have to associate the callout to the column or columns that trigger the callout, and recompile the windows where this callout is used.

The problem for developers is that callout servlets have a lot of boilerplate code that is very similar in all callouts. This code is not related to the callout logic and makes it dificult to understand and maintain callouts.

To help here there is a new java class has been introduced to simplify the code of callouts and keep focused only in the logic and not in the plumbing needed to make the callout servlet work. This class is SimpleCallout and to develop a new callout based on this class you only have to create a new java class that extends SimpleCallout and overwrite the following method:

protected void execute(CalloutInfo info) throws ServletException;

In this method you can develop the logic of the callout and use the info object of class CalloutInfo to access window fields, database and other methods. The most important are:
  • public String getStringParameter(String param) : This method returns the value of a field named param as an String.
  • public String getStringParameter(String param, RequestFilter filter) : Returns the value of a field named param as an String using the filter to accept values.
  • public BigDecimal getBigDecimalParameter(String param) throws ServletException : This method returns the value of of a field named param as a BigDecimal.
  • public void addResult(String param, String value) : This method sets the value of a field named param with the String value indicated.
  • public void addResult(String param, Object value) : This method sets the value of a field named param with the value indicated. This method is useful to set numbers like BigDecimal objects.
  • public void addSelect(String param) : Starts the inclusion of values of a field named param of type select.
  • public void addSelectResult(String name, String value) : Adds an entry to the select field and marks it as unselected.
  • public void addSelectResult(String name, String value, boolean selected) : Adds an entry to the select field.
  • public void endSelect() : Finish the inclusion of values to the select field.
  • public String getLastFieldChanged() : Returns the name of field that triggered the callout.
  • public String getTabId() : Returns the Tab Id that triggered the callout.
  • public String getWindowId() : Returns the Window Id that triggered the callout.
  • public VariablesSecureApp vars : This instance field contains the VariablesSecureApp associated to the callout servlet.
You can find an example of a class that currently uses SimpleCallout to implement the logic of a callout. The class is SL_Project_Service. This callout just takes the numeric value of two fields, calculate the sum and writes the result in other field. This is the interesting part of the code that performs the logic:

@Override
protected void execute(CalloutInfo info) throws ServletException {

BigDecimal serviceSerCost = info.getBigDecimalParameter("inpservsercost");
BigDecimal serviceOutCost = info.getBigDecimalParameter("inpservoutcost");

BigDecimal serviceTotalCost = serviceSerCost.add(serviceOutCost);

info.addResult("inpservcost", serviceTotalCost);
}

SimpleCallout is currently in the pi repository of Openbravo ERP, there has not been released any version with this class included. It is not also part of the Openbravo ERP public API and until it is not included here you cannot rely on it because could change without notice. If you find that this class is interesting to be included in the public API, let me know and I will push to include it and extend it with more new functionality and functionality from other Callout helper classes.

Wednesday 3 February 2010

Prototyping with HTML 5 (2)

This blog post is just to announce the availability in the Openbravo forge of the prototype of the HTML 5 application based on Openbravo ERP web services I am working on. The project home page is Openbravo Mobile. And it is published the source code, a deployable .war file and an small wiki page with instructions to install. Everything under the Openbravo Public License.

All comments are welcome in the forum section.

Disclaimer: The project I am developing here is done in the personal investigation time I have reserved during development sprints and it is not in the roadmap of Openbravo ERP and there is not commitment from Openbravo to his partners, customers or community related to the availability or support of this project.

Wednesday 27 January 2010

Initial Data Load demostration - Feb 4th, 2010

Open to all Openbravo Community members, this webinar will demonstrate Openbravo modularity, will help you better understand development techniques, processes and tools you can use to create extension modules, and will show concrete functional solutions to address specific requirements that might inspire you to create your own solutions.

Initial Data Load is focused to Openbravo ERP partners and customers that aims to reduce the time needed to deploy a fresh Openbravo ERP installation simplifying the import of all master data and operational data needed to start working with Openbravo ERP. This can save a lot of time in the deployment of Openbravo ERP.

The Initial Data Load module is a commercial module available in the Openbravo Exchange Marketplace at no additional cost for Openbravo Professional subscribers.

Take a look at this post for more details about the webinar.