[IMP] all: replace <tree> in <list>
Remove historical error from semantically incorrect <tree>. Viewtiverse task-3599136 task-27709 task-3414068 closes odoo/documentation#8446 Related: odoo/odoo#159909 Related: odoo/enterprise#59787 Related: odoo/upgrade#5884 Signed-off-by: Christophe Matthieu (chm) <chm@odoo.com>
This commit is contained in:
parent
ea7fd9b847
commit
f8a114b334
@ -263,10 +263,10 @@ To declare a record in XML, the **record** notation (using *<record>*) is recomm
|
||||
<field name="model">object_name</field>
|
||||
<field name="priority" eval="16"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<list>
|
||||
<field name="my_field_1"/>
|
||||
<field name="my_field_2" string="My Label" widget="statusbar" statusbar_visible="draft,sent,progress,done" />
|
||||
</tree>
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@ -288,7 +288,7 @@ Use the following pattern :
|
||||
|
||||
* For a menu: :samp:`{<model_name>}_menu`, or :samp:`{<model_name>}_menu_{do_stuff}` for submenus.
|
||||
* For a view: :samp:`{<model_name>}_view_{<view_type>}`, where *view_type* is
|
||||
``kanban``, ``form``, ``tree``, ``search``, ...
|
||||
``kanban``, ``form``, ``list``, ``search``, ...
|
||||
* For an action: the main action respects :samp:`{<model_name>}_action`.
|
||||
Others are suffixed with :samp:`_{<detail>}`, where *detail* is a
|
||||
lowercase string briefly explaining the action. This is used only if
|
||||
|
@ -72,7 +72,7 @@ Its fields are:
|
||||
model to present views for
|
||||
``views``
|
||||
a list of ``(view_id, view_type)`` pairs. The second element of each pair
|
||||
is the category of the view (tree, form, graph, ...) and the first is
|
||||
is the category of the view (list, form, graph, ...) and the first is
|
||||
an optional database id (or ``False``). If no id is provided, the client
|
||||
should fetch the default view of the specified type for the requested
|
||||
model (this is automatically done by
|
||||
@ -105,7 +105,7 @@ list and form views::
|
||||
{
|
||||
"type": "ir.actions.act_window",
|
||||
"res_model": "res.partner",
|
||||
"views": [[False, "tree"], [False, "form"]],
|
||||
"views": [[False, "list"], [False, "form"]],
|
||||
"domain": [["customer", "=", true]],
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ dialog::
|
||||
In-database window actions have a few different fields which should be ignored
|
||||
by clients, mostly to use in composing the ``views`` list:
|
||||
|
||||
``view_mode`` (default= ``tree,form`` )
|
||||
``view_mode`` (default= ``list,form`` )
|
||||
comma-separated list of view types as a string (/!\\ No spaces /!\\). All of these types will be
|
||||
present in the generated ``views`` list (with at least a ``False`` view_id)
|
||||
``view_ids``
|
||||
@ -139,7 +139,7 @@ by clients, mostly to use in composing the ``views`` list:
|
||||
|
||||
<record model="ir.actions.act_window.view" id="test_action_tree">
|
||||
<field name="sequence" eval="1"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_mode">list</field>
|
||||
<field name="view_id" ref="view_test_tree"/>
|
||||
<field name="act_window_id" ref="test_action"/>
|
||||
</record>
|
||||
|
@ -265,11 +265,11 @@ The `field` element can have the following attributes:
|
||||
:noindex:
|
||||
|
||||
The comma-separated list of display modes (view types) to use for the field's linked records.
|
||||
Allowed modes are: `tree`, `form`, `kanban`, and `graph`.
|
||||
Allowed modes are: `list`, `form`, `kanban`, and `graph`.
|
||||
|
||||
:requirement: Optional
|
||||
:type: str
|
||||
:default: `tree`
|
||||
:default: `list`
|
||||
:scope: :class:`~odoo.fields.One2many` and :class:`~odoo.fields.Many2many` fields
|
||||
|
||||
.. include:: view_architectures/generic_attribute_class.rst
|
||||
@ -321,9 +321,9 @@ The `field` element can have the following attributes:
|
||||
.. code-block:: xml
|
||||
|
||||
<field name="children_ids">
|
||||
<tree>
|
||||
<list>
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</list>
|
||||
<form>
|
||||
<field name="id"/>
|
||||
<field name="name"/>
|
||||
@ -1154,7 +1154,7 @@ The `<setting>` element can have the following attributes:
|
||||
List
|
||||
====
|
||||
|
||||
The root element of list views is `tree`\ [#treehistory]_.
|
||||
The root element of list views is `list` (the previous name was `tree`).
|
||||
|
||||
.. admonition:: Possible structure and representation of its rendering
|
||||
|
||||
@ -1166,16 +1166,16 @@ The root element of list views is `tree`\ [#treehistory]_.
|
||||
|
||||
* - .. code-block:: xml
|
||||
|
||||
<tree>
|
||||
<list>
|
||||
...
|
||||
</tree>
|
||||
</list>
|
||||
|
||||
.. _reference/view_architectures/list/root:
|
||||
|
||||
Root attributes
|
||||
---------------
|
||||
|
||||
Optional attributes can be added to the root element `tree` to customize the view.
|
||||
Optional attributes can be added to the root element `list` to customize the view.
|
||||
|
||||
.. include:: view_architectures/root_attribute_string.rst
|
||||
|
||||
@ -1269,9 +1269,9 @@ Optional attributes can be added to the root element `tree` to customize the vie
|
||||
.. example::
|
||||
.. code-block:: xml
|
||||
|
||||
<tree decoration-danger="field_qty > field_limit">
|
||||
<list decoration-danger="field_qty > field_limit">
|
||||
...
|
||||
</tree>
|
||||
</list>
|
||||
|
||||
:requirement: Optional
|
||||
:type: :ref:`Python expression <reference/view_architectures/python_expression>`
|
||||
@ -1336,9 +1336,9 @@ Using the same field multiple times in a list view is not supported
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<tree>
|
||||
<list>
|
||||
<field name="FIELD_NAME"/>
|
||||
</tree>
|
||||
</list>
|
||||
|
||||
The `field` element can have the following attributes:
|
||||
|
||||
@ -1466,12 +1466,12 @@ The `field` element can have the following attributes:
|
||||
|
||||
* - .. code-block:: xml
|
||||
|
||||
<tree>
|
||||
<list>
|
||||
<field name="name" string="My Custom Name"/>
|
||||
<field name="amount" sum="Total"/>
|
||||
<field name="currency_id"/>
|
||||
<field name="tax_id"/>
|
||||
</tree>
|
||||
</list>
|
||||
|
||||
.. _reference/view_architectures/list/button:
|
||||
|
||||
@ -1480,10 +1480,10 @@ The `field` element can have the following attributes:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<tree>
|
||||
<list>
|
||||
<button type="object" name="ACTION" string="LABEL"/>
|
||||
<button type="object" name="ACTION" icon="FONT_AWESOME"/>
|
||||
</tree>
|
||||
</list>
|
||||
|
||||
The `button` element can have the following attributes:
|
||||
|
||||
@ -1517,14 +1517,14 @@ The `button` element can have the following attributes:
|
||||
|
||||
* - .. code-block:: xml
|
||||
|
||||
<tree>
|
||||
<list>
|
||||
<field name="name"/>
|
||||
<button type="edit" name="edit" icon="fa-edit" title="Edit"/>
|
||||
<button type="object" name="my_method" string="Button1" column_invisible="context.get('hide_button')" invisible="amount > 3"/>
|
||||
<field name="amount"/>
|
||||
<field name="currency_id"/>
|
||||
<field name="tax_id"/>
|
||||
</tree>
|
||||
</list>
|
||||
|
||||
.. _reference/view_architectures/list/groupby:
|
||||
|
||||
@ -1539,13 +1539,13 @@ thus belong on the Many2one co-model. These extra fields are fetched in batch.
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<tree>
|
||||
<list>
|
||||
...
|
||||
<groupby name="FIELD_NAME">
|
||||
<BUTTONS/>
|
||||
<FIELDS/>
|
||||
</groupby>
|
||||
</tree>
|
||||
</list>
|
||||
|
||||
The `groupby` element can have the following attributes:
|
||||
|
||||
@ -1570,7 +1570,7 @@ The `groupby` element can have the following attributes:
|
||||
|
||||
* - .. code-block:: xml
|
||||
|
||||
<tree>
|
||||
<list>
|
||||
<field name="name"/>
|
||||
<field name="amount"/>
|
||||
<field name="currency"/>
|
||||
@ -1581,7 +1581,7 @@ The `groupby` element can have the following attributes:
|
||||
<field name="email"/>
|
||||
<button type="object" name="my_method" string="Button1" invisible="email == 'jhon@conor.com'"/>
|
||||
</groupby>
|
||||
</tree>
|
||||
</list>
|
||||
|
||||
.. note::
|
||||
Fields inside the `groupby` element are used only to fetch and store the value, but they are
|
||||
@ -1594,12 +1594,12 @@ The `groupby` element can have the following attributes:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<tree>
|
||||
<list>
|
||||
<header>
|
||||
<BUTTONS/>
|
||||
</header>
|
||||
...
|
||||
</tree>
|
||||
</list>
|
||||
|
||||
The `header` element accepts the following children elements:
|
||||
|
||||
@ -1640,7 +1640,7 @@ The `header` element accepts the following children elements:
|
||||
|
||||
* - .. code-block:: xml
|
||||
|
||||
<tree>
|
||||
<list>
|
||||
<header>
|
||||
<button type="object" name="to_draft" string="Button1" invisible="context.get('hide_button')"/>
|
||||
</header>
|
||||
@ -1648,7 +1648,7 @@ The `header` element accepts the following children elements:
|
||||
<field name="amount"/>
|
||||
<field name="currency"/>
|
||||
<field name="tax_id"/>
|
||||
</tree>
|
||||
</list>
|
||||
|
||||
.. _reference/view_architectures/list/control:
|
||||
|
||||
@ -1660,13 +1660,13 @@ defined through a `create` element.
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<tree>
|
||||
<list>
|
||||
<control>
|
||||
<create string="LABEL"/>
|
||||
<BUTTONS/>
|
||||
</control>
|
||||
...
|
||||
</tree>
|
||||
</list>
|
||||
|
||||
The `control` element takes no attributes.
|
||||
|
||||
@ -1700,7 +1700,7 @@ The `create` element can have the following attributes:
|
||||
|
||||
* - .. code-block:: xml
|
||||
|
||||
<tree>
|
||||
<list>
|
||||
<field name="name"/>
|
||||
<field name="amount"/>
|
||||
<field name="currency"/>
|
||||
@ -1710,16 +1710,13 @@ The `create` element can have the following attributes:
|
||||
<create string="Add a section" context="{'default_type': 'section'}"/>
|
||||
<create string="Add a note" context="{'default_type': 'note'}"/>
|
||||
</control>
|
||||
</tree>
|
||||
</list>
|
||||
|
||||
.. note::
|
||||
Using the `control` element makes sense only if the list view is inside a
|
||||
:class:`~odoo.fields.One2many` or :class:`~odoo.fields.Many2many` field. If any `create` element
|
||||
is defined, it overwrites the default :guilabel:`add a line` button.
|
||||
|
||||
.. [#treehistory] For historical reasons, it has its origin in tree-type views later repurposed to a
|
||||
more table/list-type display
|
||||
|
||||
.. _reference/view_architectures/search:
|
||||
|
||||
Search
|
||||
|
@ -11,10 +11,10 @@
|
||||
<form>
|
||||
<field name="tag_ids" widget="many2many_tags"/>
|
||||
</form>
|
||||
<tree>
|
||||
<list>
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="level_progress" widget="progressbar"/>
|
||||
</tree>
|
||||
</list>
|
||||
|
||||
:requirement: Optional
|
||||
:type: str
|
||||
|
@ -9,9 +9,9 @@
|
||||
.. example::
|
||||
.. code-block:: xml
|
||||
|
||||
<tree default_order="sequence,name desc">
|
||||
<list default_order="sequence,name desc">
|
||||
...
|
||||
</tree>
|
||||
</list>
|
||||
|
||||
:requirement: Optional
|
||||
:type: str
|
||||
|
@ -273,7 +273,7 @@ action more easily.
|
||||
<record model="ir.actions.act_window" id="action_list_ideas">
|
||||
<field name="name">Ideas</field>
|
||||
<field name="res_model">idea.idea</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
</record>
|
||||
<menuitem id="menu_ideas" parent="menu_root" name="Ideas" sequence="10"
|
||||
action="action_list_ideas"/>
|
||||
@ -321,7 +321,7 @@ is implied by the root element of the ``arch`` field:
|
||||
<field name="model">object_name</field>
|
||||
<field name="priority" eval="16"/>
|
||||
<field name="arch" type="xml">
|
||||
<!-- view content: <form>, <tree>, <graph>, ... -->
|
||||
<!-- view content: <form>, <list>, <graph>, ... -->
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@ -330,20 +330,20 @@ is implied by the root element of the ``arch`` field:
|
||||
|
||||
The ``arch`` field must thus be declared as ``type="xml"`` to be parsed correctly.
|
||||
|
||||
Tree views
|
||||
list views
|
||||
----------
|
||||
|
||||
Tree views, also called list views, display records in a tabular form.
|
||||
list views, also called list views, display records in a tabular form.
|
||||
|
||||
Their root element is ``<tree>``. The simplest form of the tree view simply
|
||||
Their root element is ``<list>``. The simplest form of the list view simply
|
||||
lists all the fields to display in the table (each field as a column):
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<tree string="Idea list">
|
||||
<list string="Idea list">
|
||||
<field name="name"/>
|
||||
<field name="inventor_id"/>
|
||||
</tree>
|
||||
</list>
|
||||
|
||||
.. _howtos/module/views/form:
|
||||
|
||||
@ -716,7 +716,7 @@ field whenever some of its dependencies have been modified::
|
||||
.. exercise:: Computed fields
|
||||
|
||||
* Add the percentage of taken seats to the *Session* model
|
||||
* Display that field in the tree and form views
|
||||
* Display that field in the list and form views
|
||||
* Display the field as a progress bar
|
||||
|
||||
Default values
|
||||
@ -845,10 +845,10 @@ and ``message`` is the error message.
|
||||
Advanced Views
|
||||
==============
|
||||
|
||||
Tree views
|
||||
list views
|
||||
----------
|
||||
|
||||
Tree views can take supplementary attributes to further customize their
|
||||
list views can take supplementary attributes to further customize their
|
||||
behavior:
|
||||
|
||||
``decoration-{$name}``
|
||||
@ -872,20 +872,20 @@ behavior:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<tree string="Idea Categories" decoration-info="state=='draft'"
|
||||
<list string="Idea Categories" decoration-info="state=='draft'"
|
||||
decoration-danger="state=='trashed'">
|
||||
<field name="name"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
</list>
|
||||
|
||||
``editable``
|
||||
Either ``"top"`` or ``"bottom"``. Makes the tree view editable in-place
|
||||
Either ``"top"`` or ``"bottom"``. Makes the list view editable in-place
|
||||
(rather than having to go through the form view), the value is the
|
||||
position where new rows appear.
|
||||
|
||||
.. exercise:: List coloring
|
||||
|
||||
Modify the Session tree view in such a way that sessions lasting less than
|
||||
Modify the Session list view in such a way that sessions lasting less than
|
||||
5 days are colored blue, and the ones lasting more than 15 days are
|
||||
colored red.
|
||||
|
||||
@ -1173,7 +1173,7 @@ action may be triggered via a menu item, but is more generally triggered by a
|
||||
button.
|
||||
|
||||
An other way to launch wizards is through the :menuselection:`Action` menu of
|
||||
a tree or form view. This is done through the ``binding_model_id`` field of the
|
||||
a list or form view. This is done through the ``binding_model_id`` field of the
|
||||
action. Setting this field will make the action appear on the views of the model
|
||||
the action is "bound" to.
|
||||
|
||||
@ -1282,7 +1282,7 @@ A report is a combination two elements:
|
||||
|
||||
Because it largerly a standard action, as with :ref:`howto/module/wizard`
|
||||
it is generally useful to add the report as a *contextual item* on the
|
||||
tree and / or form views of the model being reported on via the
|
||||
list and / or form views of the model being reported on via the
|
||||
``binding_model_id`` field.
|
||||
|
||||
Here we are also using ``binding_type`` in order for the report to be in
|
||||
|
@ -75,7 +75,7 @@ A basic action for our `test_model` is:
|
||||
<record id="test_model_action" model="ir.actions.act_window">
|
||||
<field name="name">Test action</field>
|
||||
<field name="res_model">test_model</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
</record>
|
||||
|
||||
- ``id`` is an :term:`external identifier`. It can be used to refer to the record
|
||||
@ -83,7 +83,7 @@ A basic action for our `test_model` is:
|
||||
- ``model`` has a fixed value of ``ir.actions.act_window`` (:ref:`reference/actions/window`).
|
||||
- ``name`` is the name of the action.
|
||||
- ``res_model`` is the model which the action applies to.
|
||||
- ``view_mode`` are the views that will be available; in this case they are the list (tree) and form views.
|
||||
- ``view_mode`` are the views that will be available; in this case they are the list and form views.
|
||||
We'll see :doc:`later <14_qwebintro>` that there can be other view modes.
|
||||
|
||||
Examples can be found everywhere in Odoo, but
|
||||
|
@ -12,7 +12,7 @@ Views are defined in XML files with actions and menus. They are instances of the
|
||||
|
||||
In our real estate module, we need to organize the fields in a logical way:
|
||||
|
||||
- in the list (tree) view, we want to display more than just the name.
|
||||
- in the list view, we want to display more than just the name.
|
||||
- in the form view, the fields should be grouped.
|
||||
- in the search view, we must be able to search on more than just the name. Specifically, we want a
|
||||
filter for the 'Available' properties and a shortcut to group by postcode.
|
||||
@ -31,17 +31,17 @@ List
|
||||
:align: center
|
||||
:alt: List view
|
||||
|
||||
List views, also called tree views, display records in a tabular form.
|
||||
List views, also called list views, display records in a tabular form.
|
||||
|
||||
Their root element is ``<tree>``. The most basic version of this view simply
|
||||
Their root element is ``<list>``. The most basic version of this view simply
|
||||
lists all the fields to display in the table (where each field is a column):
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<tree string="Tests">
|
||||
<list string="Tests">
|
||||
<field name="name"/>
|
||||
<field name="last_seen"/>
|
||||
</tree>
|
||||
</list>
|
||||
|
||||
A simple example can be found
|
||||
`here <https://github.com/odoo/odoo/blob/6da14a3aadeb3efc40f145f6c11fc33314b2f15e/addons/crm/views/crm_lost_reason_views.xml#L46-L54>`__.
|
||||
|
@ -72,7 +72,7 @@ In practice a many2one can be seen as a dropdown list in a form view.
|
||||
========================= ========================= =========================
|
||||
|
||||
- Add the menus as displayed in this section's **Goal**
|
||||
- Add the field ``property_type_id`` into your ``estate.property`` model and its form, tree
|
||||
- Add the field ``property_type_id`` into your ``estate.property`` model and its form, list
|
||||
and search views
|
||||
|
||||
This exercise is a good recap of the previous chapters: you need to create a
|
||||
@ -179,7 +179,7 @@ operations like ``recs1 | recs2``.
|
||||
========================= ========================= =========================
|
||||
|
||||
- Add the menus as displayed in this section's **Goal**
|
||||
- Add the field ``tag_ids`` to your ``estate.property`` model and in its form and tree views
|
||||
- Add the field ``tag_ids`` to your ``estate.property`` model and in its form and list views
|
||||
|
||||
Tip: in the view, use the ``widget="many2many_tags"`` attribute as demonstrated
|
||||
`here <https://github.com/odoo/odoo/blob/5bb8b927524d062be32f92eb326ef64091301de1/addons/crm_iap_lead_website/views/crm_reveal_views.xml#L36>`__.
|
||||
@ -196,7 +196,7 @@ One2many
|
||||
|
||||
**Goal**: at the end of this section:
|
||||
|
||||
- a new ``estate.property.offer`` model should be created with the corresponding form and tree view.
|
||||
- a new ``estate.property.offer`` model should be created with the corresponding form and list view.
|
||||
- offers should be added to the ``estate.property`` model:
|
||||
|
||||
.. image:: 07_relations/property_offer.png
|
||||
@ -244,7 +244,7 @@ that accessing the data must be done in a loop::
|
||||
property_id Many2one (``estate.property``) required
|
||||
========================= ================================ ============= =================
|
||||
|
||||
- Create a tree view and a form view with the ``price``, ``partner_id`` and ``status`` fields. No
|
||||
- Create a list view and a form view with the ``price``, ``partner_id`` and ``status`` fields. No
|
||||
need to create an action or a menu.
|
||||
- Add the field ``offer_ids`` to your ``estate.property`` model and in its form view as
|
||||
depicted in this section's **Goal**.
|
||||
|
@ -70,10 +70,10 @@ a form view. For example:
|
||||
<form>
|
||||
<field name="description"/>
|
||||
<field name="line_ids">
|
||||
<tree>
|
||||
<list>
|
||||
<field name="field_1"/>
|
||||
<field name="field_2"/>
|
||||
</tree>
|
||||
</list>
|
||||
</field>
|
||||
</form>
|
||||
|
||||
@ -352,9 +352,9 @@ complete list):
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<tree decoration-success="is_partner==True">
|
||||
<list decoration-success="is_partner==True">
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</list>
|
||||
|
||||
The records where ``is_partner`` is ``True`` will be displayed in green.
|
||||
|
||||
|
@ -698,10 +698,10 @@ let's also add views so we can see and edit a course's teacher:
|
||||
<field name="name">Academy courses: list</field>
|
||||
<field name="model">academy.courses</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Courses">
|
||||
<list string="Courses">
|
||||
<field name="name"/>
|
||||
<field name="teacher_id"/>
|
||||
</tree>
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
<record id="academy_course_form" model="ir.ui.view">
|
||||
@ -761,9 +761,9 @@ model:
|
||||
<field name="name"/>
|
||||
<field name="biography"/>
|
||||
<field name="course_ids">
|
||||
<tree Sstring="Courses" editable="bottom">
|
||||
<list string="Courses" editable="bottom">
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</list>
|
||||
</field>
|
||||
</sheet>
|
||||
</form>
|
||||
|
Loading…
Reference in New Issue
Block a user