Business API – Really required in OpenERP ?

OpenObject is foundation of the OpenERP Project, OpenObject is written in python and it is having the rich GTK / KDE / Web clients. It has well defined set of API’s to design, create, deploy and access the application rapidly, i.e (predefined orm, set of fields and their visual mappings), that’s why it is also called as a RAD Framework.
The simplicity of the API’s make it a powerful framework. We can divide the OpenObject into the following components.
ORM – Object Relational Mapping

OpenObject orm is tightly coupled with the PostgreSQL database. The set of orm api’s are only defined for the PostgreSQL, may be this is the disadvantage of the Framework, but I am considering it as an advantage that use the powerful open source database, There is also a branch available for the framework that is designed to work with MySQL, Oracle, and MsSQL.
Model in OpenObject Framework
Api’s defined in the orm, that takes care the mapping between the model and database table. Maps the type, constraints, operations for the searching, reading and writing data from and to the database.
Mapping a OpenObject model in to the PostgreSQL
Business Process
Business process is a requirement for any framework which is ready to deploy the business application. OpenObject is having the flexible and powerful business process engine known as a workflow engine that converts and handle the xml based business process definition.
XML Definition of the Workflow
Workflow engine reads and Instantiate the workflow for each record of model on which the workflow is defined. OpenObject allow you to see the workflow in two mode, definition mode and Instance mode.
Visual Representation of the Workflow – Definition model

OpenObject Services

OpenObject offers an access to different kind of services based on the xml-rpc and net-rpc protocols. The service component of the OpenObject framework makes it Service Oriented architecture – SOA. One can access any kind of service through the xml based data exchange protocol called xml-rpc and  python native data structure based data exchange protocol called net-rpc. OpenObject framework has published the common, object, report, wizard as a service that can be accessed from anywhere.
Report Engine
OpenObject’s report engine allows to generates a .Pdf file as a report, and it takes .xml, .xslt, and .rml as a input file, which is parsed by the Report engine parser and converted in to the .Pdf file with the desired data filled up.

Report Engine’s work in OpenObject Framework

Role of the Client – GTK, KDE and WEB
All the clients of OpenObject Framework works on the same principle with more or less equal functionalities. The clients consume the services offered by the OpenObject Service components and translate data into user understandable format, also performs the operations which are requested by the users.

GTK client that visualize application in User accessible form
There are set of api’s to define the module/addons for the OpenObject framework, they include rules to define Model, Views, Business Process, also it has the set of rules to define the custom reports through  rml / sxw / xml / xslt. Overall the OpenObject framework will be the right choice for whom those who want to deliver quick solutions in terms of modules. The modular approach of the framework allows to build the robust and flexible application, which will be easily expanded just by adding modules to the application.
We have discussed about the different components of the OpenObject framework. There are API’s that are used to define each of those components from the user application. OpenObject strongly believe in  re-usability and modular approach. Each new requirement is developed and deployed in terms of new module instead of changing the existing stable application. OpenObject is perfect framework as RAD, but let’s think OpenObject as a business application framework.

What is Business API?

The Business Application Framework provides the means for specification and realisation of the Business Application Service Handlers. A Business Application may be a group of set of handlers like authentication, payment etc. for a specific company or for a specific process of a company. A company (Service Provider) may provide a Business Application that will be used to encapsulate a set of service handlers.
Independent Business API’s resides @ Logic tier

If you look at the above figure and compare it with the OpenObject Framework.
Data tier = PostgreSQL
Presentation tier = GTK, WEB, KDE Clients
Logic tier =  OpenObject API (Framework) + All Module

Logic tier in the OpenERP is combination of the OO API and the Business Modules which are define to meet the business requirements. The Framework API and Business is not separated quite well and that’s why we need to write repetitive code for the same business process.

Why Business Api’s are required ?

OpenObject framework has the set of API’s to develop custom modules. If we look in the Business Process which generally represented by the OpenERP modules like Account, Stock, CRM, etc., they all are well defined. Let’s take an example of the account.invoice model which represent the Invoice object.

Invoice can be created through Sale, Purchase, Project,
Stock, Timesheet, and Point of Sale

If we look into the code of each and every module that creates the invoice, you may find more or less the same code. –

Methods that create Invoice from different models

I don’t think it is easy to manage the same code at the different places, as the purpose is same as to create an Invoice. A set of rules (api’s) that are specially designed to define, develop and integrate the business functions, that will avoid the duplication of the business process, and allows to extend and change it as and when required, without affecting the normal behavior of the business. This is what I mean by the Business API.

Due to the lack of Business API
  • Increased LOC
  • Not easy to manage
  • Chance to Introduce more bugs
  • Testing a same process at multiple places multiple time
  • Poor community contribution
OpenERP gives us the freedom to write the business process quickly through the technical api, but at some places I believe that its better to have some set of api’s that specially defined for the business process and some critical process like creating invoice, stock movement, etc..
The Account.Tax and its all computing methods are the perfect example. Its defined quite well in the OpenERP and it is called from all the module that need to calculate the Tax.
Thanks to all of you in advance, for listing down a kind of processes which are to be streamline in terms of  Business API.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s