Archive for October 29, 2009

Inter-Company Documents Module

October 29, 2009 Leave a comment

Does your company perform sales – purchases between internal organizations? Do you need to create matching documents for those flows? The Inter-company Documents module is the solution you are looking for!

What are inter-company documents?

An inter-company document is an order or invoice created within two subsidiaries of one same company. Whenever a document of this type is created, a matching document should be created in the target organization. The Inter-company documents module provides a tool to automate the generation of this matching document.

Let me explain the concept with an example. Let’s assume that certain enterprise is formed of several subsidiaries. For instance organization A and organization B. Each time a sales invoice is completed in organization A for organization B, it is desired that a matching purchase invoice is created in the organization B for organization A.

The module supports the following flows:

  • Inter-company invoices initiated either from purchase invoices or sales invoices
  • Inter-company orders initiated either from purchase orders or sales orders.

It provides a mean to drill from the generated document to the original document and vice versa.

How can I take advantage of this?

The inter-company module is already available in the Openbravo Forge for users on Openbravo ERP 2.50MP4 and up. In order to make the most of this module, some configuration must be done. First of all, each inter-company organization have to be represented by a business partner. This way, the documents will be address to the corresponding business partner. This mapping can be done in the Organization window’s Information tab: General Setup || Enterprise || Organization.
For instance, imagine a company with a main organization, called Main, and two subsidiaries called A and B. Each of them should be mapped to a business partner, for instance orgMain, orgA and orgB business partners.

Additionally, the document types used for inter-company transactions have to be defined. This can be done in Financial Management || Accounting || Setup || Document Type. In order to define a document type as inter-company document type, the inter-company flag needs to be checked. Also, some inter-company relations have to be defined for it in the inter-company relations tab. Here, for each document type, a matching document type, a source organization and a target organization can be set. If no matching document is defined, that is, if the target document field is left blank, no matching document will be created in the target organization. The matching document could be created manually in a later stage.

Once the configuration is done, we are ready to go!

At this moment, it is possible to complete orders or invoices using the newly created inter-company document type. And automatically, following to the configuration done, it will create a matching document in the organization of the selected business partner. This matching document can be easily accessed through the linked items icon. Automatically generated matching documents have an original document field that can be used to navigate to it.

Further information is available in the user manual.

Technical Aspects

This module has being developed using Extension Points core enhancement. The functionality has been developed through database PL procedures named Interco_create_order and Interco_create_invoice. These procedures are executed right after C_Order_Post and C_Invoice_Post procedures. These two core procedures have an Extension Point at the end, so we can easily call the inter-company procedures. Find more information about extension points in this blog post recently published!

We have developed the functionality of this module in the following way: first of all, in the PL procedure, we get the necessary parameters from c_invoice_post or c_order_post to create the desired matching document. The new document will be created based on the data of the original invoice and in the default values of the matching business partner. The matching document’s type will be the one defined in the configuration.

Once the new document is created, it is completed calling to c_invoice_post or c_order_post again. This step will complete the new document and – caution – it will call our PL function again! It is important to check in the beginning of our PL whether it is being called by a manual document or by an automatically created document as we don’t want to have deadlocks in our code!

Right before the end, the message returned to the extension point is updated. This way when the completion process of the original document is finished it is shown the document number of the generated matching document.

Feel free to check out the technical documentation for more details!

Inter-company module is publicly available in the central repository, so we would like to encourage you to install it and use it! Do not hesitate to give use feedback, we are willing to hear from you!

Categories: apagola, Openbravo