View source | View content page | Page history | Printable version   

Projects:Multiple Tax Category/Technical Documentation



In this document are described the technical details of the Multiple Tax Category module implementation. In order to implement this module it needs to be developed in core the ability for extension modules to change the tax category assigned to a product. POS does not follow the ERP procedures to calculate the taxes so it also needs some enhancements to implement this module. Considering this the development of this module can be separated into 3 phases:

  1. Core enhancements
  2. Module development
  3. POS enhancements

Core enhancements

Currently the Tax Category is defined in the Product table. So each product can only have 1 tax category available. To properly implement this module it must be possible to define more than 1 tax category for a product. To achieve this all processes that retrieve the tax category of the product need to be modified. These processes instead of fetching the tax category of the product entity have to call a new process that returns the tax category to be used based on some fixed dimensions.

These developments are included in core using the Feature Request XXXX


The process that calculates the tax to be used is developed in PL/SQL so, this development must be done using the same language. A new procedure C_GET_PRODUCT_TAXCATEGORY is created.

This procedure receives as parameters the product and the dimensions that can be used to define the tax category of a product:

First step is to search if there is a module implementing this procedure. This is manages through preferences. When a module implementing a different tax category for products is installed it is needed to create a preference so the system knows that it have to use it. The preference must implement the Get Product Tax Category impementation (GETPRODUCTTAXCATEGORY) property and the value must be de dbprefix of the module implementing the procedure.

If a preference is found it is called the procedure passing the same parameters that must have the following name $DBPREFIX_GET_PRODUCT_TAXCATEGORY.

If no preference is found or there is an issue executing the procedure it is returned the tax category defined in the product.

C_Get_Tax modification

All core processes that retrieve a tax uses the C_Get_Tax procedure. This means that only this procedure need to be updated to use the new C_GET_PRODUCT_TAXCATEGORY procedure.

In this procedure, the query that gets the tax category from the M_Product table is replaced by a call to the new procedure.

Other modules modification

All processes that calculates tax rates should use the C_Get_Tax procedure or the Tax Java class of org.openbravo.erpCommon.businessUtility package. This class uses the C_Get_Tax procedure so it is covered with the changes done.

If a module retrieves the tax category from the Product table it must be updated to take into account the implementation of this Feature Request.

Module development

The Multiple Tax Category module is a commercial module that implements a new method to define the tax categories of a product based on organization.

Module information:

Tax Category tab in Product window

New tab added to Product window where user can assign to a Product a different Tax Category for each organization. Only the organization of the Product and its children are available.


This is the procedure that calculates the tax category. It retrieves the tax category defined in the new tab for the given product and organization. If no value is found it is called the same function using the parent organization instead. If no value is found on any parent organization null is returned.

In case a null value is returned core uses the tax category defined in the header of the product.

POS enhancements

As said, the POS does not use the C_Get_Tax procedure to load the taxes and have its own implementation. To be able to use the multiple tax category module, or other implementing the get_product_taxcategory procedure, some changes need to be done.

In the POS there are some dimensions that are fixed, so only the tax rates of those dimensions are included. These dimensions are the Organization and the Shipment From location. In the current implementation only modules that implement these dimensions will work. This is, modules that implement the product tax categories by date and/or Shipment To Location will not work in the POS.

As only fixed dimensions are used the tax category is calculated when the Products are loaded in the client database when the user logs in. To do so the ProductProperties java class of src/org/openbravo/retail/posterminal/master needs to be changed.

The line loading the tax category need to be replaced by a call to the C_GET_PRODUCT_TAXCATEGORY core procedure.

Retrieved from ""

This page has been accessed 2,469 times. This page was last modified on 22 November 2013, at 13:15. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.