How to change an existing Report

From InfiniteERP Wiki
Revision as of 21:46, 20 November 2021 by Wikiadmin (talk | contribs) (Created page with "== Objective == One of the firsts customizations required when deploying Openbravo is to modify the templates of the most common documents: Orders, Shipments and Invoices. The...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Objective

One of the firsts customizations required when deploying Openbravo is to modify the templates of the most common documents: Orders, Shipments and Invoices. These documents are common to customers and vendors of the client company and must follow its requirements and corporate image. This document explains how to modify these templates in a modular way taking as example the report template for Sales Orders.

Acknowledgments

Before starting make sure you read the prerequisite knowledge and modularity concepts articles.

You should read also the how to create a report article that explains some concepts and common configuration you must follow in order to use iReport.

Bulbgraph.png   Important Note: This article doesn't explain how to work with iReport

Defining the Module

You should define first a new module that contains your report modifications. For more information about creating a module read the documentation on How_To_Create_and_Package_a_Module.

  • As System Administrator
    • Create a new record in the Module window
    • Fill all required fields
    • Fill all required data in child tabs: Dependency, DB Prefix, etc
Howto-change-report1.png
  • Export your changes to create the module structure
    ant export.database

Copying the Base Template

After exporting your changes, you'll get a new folder under the modules folder.

  • Create a src folder
  • Copy the base templates from src/org/openbravo/erpReports/C_Order*.jrxml to your module folder
Bulbgraph.png   Note: You should follow the Java package structure

You should end up with some structure like this one:

Howto-change-report2.png

Changing the Template

After making a copy of the base template to your module, you're ready to make all the changes you like. For sake of simplicity, we'll just add a simple label to the report header.

  • Start iReport
  • Open the C_OrderJR.jrxml file of your module
  • Add a simple label: "My customization"
Bulbgraph.png   You can customize your template with any change you like, more fields, changing position, etc
Howto-change-report3.png
  • Rebuild your changes to deploy the module structure
    ant smartbuild
  • Reload Openbravo from tomcat Manager

Defining the Report Template at Document Level

Report templates are defined at document level. You need to change it in order to work.

  • As Client Admin Role
  • Go to: Financial Management > Accounting > Setup > Document Type
Howto-change-report4.png
  • Search for Name Standard Order and open it
  • Open the Report Template tab and modify the Template Location field
    • Use the location where your copy is located
      @basedesign@/org/openbravo/howto/mysalesorder
  • Save the changes
Howto-change-report5.png

Testing the changes

All the definitions required to use your customized Sales Order template has been done. There is only needed to verify that the new document template created renders the document as expected with an existing Sales Order document.

  • Open any Sales Order using Standard Order as document type
  • Print it
Howto-change-report6.png