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/