Most Powerful Open Source ERP

How To Create New Forms

How To showing the way of creating efficient and integrated forms in ERP5.
  • Last Update:2016-02-09
  • Version:001
  • Language:en

Creating efficient and integrated forms in ERP5 requires the knowledge of the design choices which guided the user interface design.

Table of Contents

The 3 modes

There are 3 modes in ERP5:

  • View mode:
    Used to display an object attributes, may or may not allow to modify them. It has tabs, one or more fields in one or more field groups.
  • Dialog mode:
    Used to ask the user for configuration of a listbox, a report, a business template download or as an aid to store data in object properties - like a relation string field or fast inputs. It has a cancel buttons which leads back to the previous view, a submit button to validate the entered data, and an optional update button to refresh the dialog.
  • List mode:
    Used to display a list of objects and to modify it. It has a listbox with checkboxes corresponding to objects, cut/copy/paste/delete actions are available concerning the selected objects, and special filter actions to reduce the number of displayed objects.
  • (not fitting into this list are login and list of module pages)

View mode

Available actions:

  • List mode:
    Only visible when the user is coming from a list. Allows to go back to the list which led here. This is different from the "previous" button of a browser, because it goes directly to the list mode even if the user navigated through the selection (see First, Previous, Next, Last actions). It is different from the breadcrumb leading to one level higher, because some listboxes are used to present objects present in another module (for example, related accounts of an organisation).
  • Print:
    Generates a PDF export of the current object.
  • New:
    Creates an object in the current object's container which is of the same type as current object.
  • First/Previous/Next/Last:
    Only visible when the user is coming from a list. Allows to navigate inside a selection. Each button does what it says.
  • Report:
    Only visible if there are possible reports for the current object. Leads to a dialog to allow the user to tune the report.
  • Import/Export:
    Only visible if there are possible import/export actions on the current object. Leads to a dialog to allow the user to select what to import or where to export.

How to organize fields

  • Use left and right groups, if you need more, you can use center.
  • Listbox must be in bottom group. For consistency, make sure form in view mode doesn't contains a listbox only, it's common to add a non editable 'my_title' field in center group in that case.
  • for compatibility with erp5_html_style, where order of group was important, order groups as left, right, center, bottom, hidden.
  • If you want a field not to be displayed, put it in hidden group (eg. lisbox/matrixbox editable fields).

Dialog mode

There are no available action in dialog mode, because the user is already executing an action, and he can (and must) go back to the object he comes from to execute action on this object. Make sure you checked HowToCreateActionDialogs page as well.

List mode

Available actions

  • Cut/Copy:
    Acts on the objects selected in the listbox present in this mode.
  • Paste:
    Pastes the object which might have been cut or copied before.
  • Print:
    Generates a PDF export of the current object.
  • New:
    Creates an object in current object with the first portal type allowed to be created in this context (see the action menu).
  • Delete:
    Acts on the objects selected in the listbox present in this mode. Displays a dialog listing selected objects to allow the user to confirm his choice.
  • Find:
    The user to enter search criterions which will apply to current object list.
  • Show all:
    Removes all filters on the current object list (from Find, Filter and listbox search field).
  • Filter:
    Acts on the objects selected in the listbox present in this mode. Will only display selected objects, others will be just filtered out. It is complementary to "Find", not exclusive.
  • Sort:
    Allows the user to sort the listbox content by specifying columns and sort order.
  • Configuration:
    Allows the user to add/remove columns to/from the listbox.

How to organize fields

  • Only one group is available, because list mode should only contain a list of objects in the module.
  • Listbox must be in bottom group.
  • for compatibility with erp5_html_style, where order of group was important, this bottom group must be the first in the list.

Field Naming

There are some special prefixes for form fields, here is the explanation about their technical implications.

  • (no prefix):
    This is always bad, because the_form_object.the_field_id can collide with a property of form object.
  • your_:
    This is the default field prefix. Nothing special except it won't collide with any property of the form object.
  • my_ :
    A field whose name starts with this prefix will get as default value - unless defined on the field - the value of the corresponding property on the context : 'my_title' will get its default value from context.title.

Related Articles