Most Powerful Open Source ERP

How To How To Add A Report

How To showing how to add a report in ERP5.
  • Last Update:2016-02-09
  • Version:002
  • Language:en

This describes a process of adding a report to the report dialog - how to actually create the report, is another story. We assume it is going to be an accounting report, but it works the same way for other modules.

Table of Contents

Steps

Add an entry to the "Report select"

  • Go to portal_types -> Accounting Transaction Module -> Actions.
  • Add an action:
    • Name : any you wich
    • Id : unique
    • Action : like ${object_url}/AccountingTransactionModule_view<my_new_report>ReportDialog
    • Persmission : View
    • Category : object_report

this is the first report for that module a Report icon will appear on the main View form. After clicking it You will be redirected to a report dialog form. If it's a subsequent report, it will now appear in the dropdown list on the dialog form.

2. Create a dialog

The report dialog is an ERP5 Form - the best way is to copy one of the stock report dialogs and customize for your needs. The dialog is here so that the user can specify parameter for the report (like a section, a start date ... ).

When adding new fields, the naming convention should be used (your_field_name). This way when processing submitted REQUEST in a report or a script, it's easy to access field's values by using just field_name keys. This is especially essential when processing date values, since they are glued together from three separate fields.

An important thing is that if the report is going to be an ERP5Form printout, the dialog has to have a hidden field your_portal_skin, defaulting to Print; if the report is a ERP5 PDF Form or ERP5 PDF Template, it is not needed. Adding this field my_portal_skin will add a portal_skin key in the request, which CMF Skin Tool will use to decide which skin folder will be used.

In the dialog's settings, its Page Template has to be form_dialog, and its action is the report or the script which handles the dialog output. In the latter case the script should return the report itself.

For consistency, name the report AccountingTransactionModule_view<my_new_report>Report.

Related Articles