form views guidelines

6
Form Views Guidelines This document presents functional and technical guidelines for creating/organizing form views in Odoo. For each item, both the functional and technical aspects are explained. The goal of the new style of forms is to make Odoo easier to use, and to guide users through the system. Business Views Business views are targeted at regular users, not advanced users. Examples are: Opportunities, Products, Partners, Tasks, Projects, etc. In general, a business view is composed of a status bar on top (with technical or business flow), 1. a sheet in the middle (the form itself), 2. a bottom part with History and Comments. 3. Technically, the new form views are structured as follows in XML: <form> <header> ... content of the status bar ... </header> <sheet> ... content of the sheet ... </sheet> <div class="oe_chatter"> ... content of the bottom part ... </div> </form> The Status Bar The purpose of the status bar is to show the status of the current record and the action buttons. The Buttons The order of buttons follows the business flow. For instance, in a sale order, the logical steps are: Send the quotation 1. Confirm the quotation 2. Create the final invoice 3. Send the goods 4. Highlighted buttons (in red by default) emphasize the logical next step, to help the user. It is usually the first active button. On the other hand, cancel buttons must remain grey (normal). For instance, in Invoice the button Refund v: latest Form Views Guidelines — odoo 8.0b1 documentation http://odoo-80.readthedocs.org/en/latest/guides/f... 1 of 6 09-10-2014 10:38

Upload: m-carmo-leal

Post on 20-Nov-2015

17 views

Category:

Documents


3 download

DESCRIPTION

Form Views Guidelines

TRANSCRIPT

  • Form Views GuidelinesThis document presents functional and technical guidelines for creating/organizing form views in Odoo. For each

    item, both the functional and technical aspects are explained. The goal of the new style of forms is to make Odoo

    easier to use, and to guide users through the system.

    Business Views

    Business views are targeted at regular users, not advanced users. Examples are: Opportunities, Products, Partners,

    Tasks, Projects, etc.

    In general, a business view is composed of

    a status bar on top (with technical or business flow),1.

    a sheet in the middle (the form itself),2.

    a bottom part with History and Comments.3.

    Technically, the new form views are structured as follows in XML:

    ... content of the status bar ... ... content of the sheet ... ... content of the bottom part ...

    The Status BarThe purpose of the status bar is to show the status of the current record and the action buttons.

    The Buttons

    The order of buttons follows the business flow. For instance, in a sale order, the logical steps are:

    Send the quotation1.

    Confirm the quotation2.

    Create the final invoice3.

    Send the goods4.

    Highlighted buttons (in red by default) emphasize the logical next step, to help the user. It is usually the first active

    button. On the other hand, cancel buttons must remain grey (normal). For instance, in Invoice the button Refund

    v: latest

    Form Views Guidelines odoo 8.0b1 documentation http://odoo-80.readthedocs.org/en/latest/guides/f...

    1 of 6 09-10-2014 10:38

  • must never be red.

    Technically, buttons are highlighted by adding the class oe_highlight:

    The Status

    Uses the statusbar widget, and shows the current state in red. States common to all flows (for instance, a saleorder begins as a quotation, then we send it, then it becomes a full sale order, and finally it is done) should be

    visible at all times but exceptions or states depending on particular sub-flow should only be visible when current.

    The states are shown following the order used in the field (the list in a selection field, etc). States that are always

    visible are specified with the attribute statusbar_visible .

    statusbar_colors can be used to give a custom color to specific states.

    The SheetAll business views should look like a printed sheet:

    Elements inside a or do not define groups, elements inside them are laid out according tonormal HTML rules. They content can be explicitly grouped using or regular elements.

    1.

    By default, the element defines two columns inside, unless an attribute col="n" is used. Thecolumns have the same width (1/n th of the groups width). Use a element to produce a column offields.

    2.

    To give a title to a section, add a string attribute to a element:

    this replaces the former use of .

    3.

    The element does not produce a label, except as direct children of a element[1]. Use

  • View mode Edit mode

    Use HTML text, , , to produce nice headers, and with the class oe_edit_only toonly display the fields label in edit mode. The class oe_inline will make fields inline (instead of blocks): contentfollowing the field will be displayed on the same line rather than on the line below it. The form above is produced by

    the following XML:

    at % success rate

    Button Box

    Many relevant actions or links can be displayed in the form. For example, in Opportunity form, the actions Schedule

    a Call and Schedule a Meeting take an important place in the use of the CRM. Instead of placing them in the

    More menu, put them directly in the sheet as buttons (on the top right) to make them more visible and more easily

    accessible.

    Technically, the buttons are placed inside a to group them as a block on the right-hand side of the sheet.

    Groups and Titles

    A column of fields is now produced with a element, with an optional title.

    It is recommended to have two columns of fields on the form. For this, simply put the elements thatcontain the fields inside a top-level element.

    To make view extension (../reference/views.html#reference-views-inheritance) simpler, it is recommended to put a

    name attribute on elements, so new fields can easily be added at the right place.

    Special Case: Subtotals

    Some classes are defined to render subtotals like in invoice forms:

    v: latest

    Form Views Guidelines odoo 8.0b1 documentation http://odoo-80.readthedocs.org/en/latest/guides/f...

    3 of 6 09-10-2014 10:38

  • Placeholders and Inline Fields

    Sometimes field labels make the form too complex. One can omit field labels, and instead put a placeholder inside

    the field. The placeholder text is visible only when the field is empty. The placeholder should tell what to place inside

    the field, it must not be an example as they are often confused with filled data.

    One can also group fields together by rendering them inline inside an explicit block element like `. This allows

    grouping semantically related fields as if they were a single (composite) fields.

    The following example, taken from the Leads form, shows both placeholders and inline fields (zip and city).

    Edit mode View mode

    Images

    Images, like avatars, should be displayed on the right of the sheet. The product form looks like:

    v: latest

    Form Views Guidelines odoo 8.0b1 documentation http://odoo-80.readthedocs.org/en/latest/guides/f...

    4 of 6 09-10-2014 10:38

  • The form above contains a element that starts with:

    Tags

    Most Many2many fields, like categories, are better rendered as a list of tags. Use the widget many2many_tags forthis:

    Task-based forms

    Conguration FormsExamples of configuration forms: Stages, Leave Type, etc. This concerns all menu items under Configuration of

    each application (like Sales/Configuration).

    For those views, the guidelines are:

    no header (because no state, no workflow, no button)1.

    no sheet2.

    Regular Wizards (dialog)Example: Schedule a Call from an opportunity.

    The guidelines are:

    avoid separators (the title is already in the popup title bar, so another separator is not relevant)1.

    avoid cancel buttons (user generally close the popup window to get the same effect)2.

    action buttons must be highlighted (red)3.

    when there is a text area, use a placeholder instead of a label or a separator4.

    like in regular form views, put buttons in the element5.

    Conguration WizardExample: Settings / Configuration / Sales. The guidelines are:

    always in line (no popup)1.

    no sheet2.

    v: latest

    Form Views Guidelines odoo 8.0b1 documentation http://odoo-80.readthedocs.org/en/latest/guides/f...

    5 of 6 09-10-2014 10:38

  • Copyright 2014, OpenERP s.a.. Created using Sphinx (http://sphinx-doc.org/) 1.2.2.

    odoo docs theme based on Bootstrap 3.2 documentation (http://getbootstrap.com) adapted to Sphinx (http://sphinx-

    doc.org/) output with branding and color changes.

    keep the cancel button (users cannot close the window)3.

    the button Apply must be red4.

    [1] for backwards compatibility reasons

    v: latest

    Form Views Guidelines odoo 8.0b1 documentation http://odoo-80.readthedocs.org/en/latest/guides/f...

    6 of 6 09-10-2014 10:38