[DOC] Data files : noupdate information + examples

Solves #26818
This commit is contained in:
Victor Feyens
2019-09-18 08:54:51 +00:00
parent ef5251c0d7
commit ffc69127f8
+45 -4
View File
@@ -22,6 +22,7 @@ of an XML data file is the following:
.. code-block:: xml
<!-- the root elements of the data file -->
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<operation/>
...
@@ -30,6 +31,25 @@ of an XML data file is the following:
Data files are executed sequentially, operations can only refer to the result
of operations defined previously
.. note::
If the content of the data file is expected to be applied only once, you
can specify the odoo flag ``noupdate`` set to 1. If part of
the data in the file is expected to be applied once, you can place this part
of the file in a <data noupdate="1"> domain.
.. code-block:: xml
<odoo>
<data noupdate="1">
<!-- Only loaded when installing the module (odoo-bin -i module) -->
<operation/>
</data>
<!-- (Re)Loaded at install and update (odoo-bin -i/-u) -->
<operation/>
</odoo>
Core operations
===============
@@ -152,6 +172,27 @@ Parameters can be provided using ``eval`` (should evaluate to a sequence of
parameters to call the method with) or ``value`` elements (see ``list``
values).
.. code-block:: xml
<odoo>
<data noupdate="1">
<record name="partner_1" model="res.partner">
<field name="name">Odude</field>
</record>
<function model="res.partner" name="send_inscription_notice"
eval="[[ref('partner_1'), ref('partner_2')]]"/>
<function model="res.users" name="send_vip_inscription_notice">
<function eval="[[('vip','=',True)]]" model="res.partner" name="search"/>
</function>
</data>
<record id="model_form_view" model="ir.ui.view">
</record>
</odoo>
.. ignored assert
.. _reference/data/shortcuts:
@@ -168,7 +209,7 @@ data files provide shorter alternatives to defining them using
Defines an ``ir.ui.menu`` record with a number of defaults and fallbacks:
Parent menu
``parent``
* If a ``parent`` attribute is set, it should be the :term:`external id`
of an other menu item, used as the new item's parent
* If no ``parent`` is provided, tries to interpret the ``name`` attribute
@@ -177,10 +218,10 @@ Parent menu
created
* Otherwise the menu is defined as a "top-level" menu item (*not* a menu
with no parent)
Menu name
``name``
If no ``name`` attribute is specified, tries to get the menu name from
a linked action if any. Otherwise uses the record's ``id``
Groups
``groups``
A ``groups`` attribute is interpreted as a comma-separated sequence of
:term:`external identifiers` for ``res.groups`` models. If an
:term:`external identifier` is prefixed with a minus (``-``), the group
@@ -220,7 +261,7 @@ section of the view, and allowing a few *optional* attributes:
``report``
----------
Creates a ``ir.actions.report`` record with a few default values.
Creates a :ref:`IrActionsReport <reference/actions/report>` record with a few default values.
Mostly just proxies attributes to the corresponding fields on
``ir.actions.report``, but also automatically creates the item in the