jueves, 11 de febrero de 2010

Building a Localization Pack (I)

This is the first of several posts that we are going to publish from the Openbravo Localization Team on how to develop localization features. We will be using the recently released Spanish Localization Packs as an example, and we will demonstrate how can you re-use them to support the localization needs of other regions, or extend them in order to add further capabilities for Spain. Additionally, since the Spanish Localization Packs include many sophisticated features, these blog posts can also benefit any developer interested in developing modular capabilities for Openbravo.

In this first post, I will talk about the Tax Report Launcher, that allows the user to retrieve taxing information from the ERP, and put that figures into a file (such as a VAT statement to be presented on-line, for example). This is a public module that everybody can install. We invite localizers to benefit from it, and develop and release reports on top of it, as new extension modules.

If you have a look to the module itself, you will realize that is not that complex thing, but a really good idea. Let me introduce you to the concept of Parameter. A report created in the tax report launcher, defines a set of parameters (following the VAT example, a parameter could be Sales for 16% VAT). This parameter can be associated to one or more tax rates defined in the client. This association is done a 100% through the UI:

* Definition of the parameters in a report to be run over the tax report launcher

* In linked items, all tax rates associated to this parameter are shown.

* Assignation of a parameter to a tax rate

In the case of the Spanish Localization Packs, a Taxes for Spain module has been released, with the configuration needed for the most part of small and medium companies in Spain. When a report is developed, it includes a dataset that assigns corresponding tax parameters of the report, to the existing tax rates in the Taxes for Spain module (in the VAT statement example, the report will create all the parameters, and one of them could be the Domestic Sales where VAT 16% was applied parameter; at the same time, will associate the Sales 16% VAT tax rate to this parameter). This way, user don't need to configure anything manually.

The Launcher also defines a Java public interface. Each report running on this launcher will have a Java class implementing this template. This code will implement all the business logic of the report. The good thing is that the developer will be able to retrieve all the tax rates associated to each of the defined parameters (in the example of the VAT statement, user could query database, asking for the total amount of the posted transactions in the system due to domestic sales operations subject to the VAT 16% tax rate).

Once those amounts are retrieved, and calculations are done, the result can be presented to the user as a file, suitable for on-line submission. Let's put all of this in a simple picture:


Two examples of reports developed using the Tax Report Launcher are AEAT 347 and AEAT 349.

If I succeeded in arousing your curiosity, please have a look to the webinar we recorded regarding this topic for further information!

See you in the next post!

No hay comentarios: