Update documentation of infrastructure

Co-authored-by: David Harper <dave@libateq.org>
This commit is contained in:
Cédric Krier
2024-08-07 23:24:57 +02:00
co-authored by David Harper
parent a080a11b3e
commit 67bfcde06f
48 changed files with 1250 additions and 90 deletions
+1
View File
@@ -64,6 +64,7 @@ project = info['name']
release = version = info['series']
default_role = 'ref'
highlight_language = 'none'
exclude_patterns = ['**/*.inc.rst']
extensions = [
'sphinx_copybutton',
'sphinx.ext.intersphinx',
+1
View File
@@ -7,4 +7,5 @@ always activated.
.. toctree::
:maxdepth: 2
ir/index
res/index
@@ -0,0 +1,87 @@
.. _model-ir.action:
Action
======
The *Action* concept contains common user interface behavior properties.
The list of keywords specifies where the action is available and for which
`Model <model-ir.model>`.
If any `Groups <model-res.group>` are added to the action, then only members of
at least one of these groups will have access to the action.
.. seealso::
The Actions can be found by opening the main menu item:
|Administration --> User Interface --> Actions --> Actions|__
.. |Administration --> User Interface --> Actions --> Actions| replace:: :menuselection:`Administration --> User Interface --> Actions --> Actions`
__ https://demo.tryton.org/model/ir.action
.. _model-ir.action.report:
Report Action
=============
The *Report Action* stores the properties needed to execute the named
:class:`~trytond.report.Report`.
.. seealso::
The Report Actions can be found by opening the main menu item:
|Administration --> User Interface --> Actions --> Reports|__
.. |Administration --> User Interface --> Actions --> Reports| replace:: :menuselection:`Administration --> User Interface --> Actions --> Reports`
__ https://demo.tryton.org/model/ir.action.report
.. _model-ir.action.act_window:
Window Action
=============
The *Window Action* stores the properties necessary for the client to open a
tab for a :class:`~trytond.model.ModelStorage`.
It consists of a list of `Views <model-ir.ui.view>` and domains.
.. seealso::
The Window Actions can be found by opening the main menu item:
|Administration --> User Interface --> Actions --> Window Actions|__
.. |Administration --> User Interface --> Actions --> Window Actions| replace:: :menuselection:`Administration --> User Interface --> Actions --> Window Actions`
__ https://demo.tryton.org/model/ir.action.act_window
.. _model-ir.action.wizard:
Wizard Action
=============
The *Wizard Action* defines how the client should run the named
:class:`~trytond.wizard.Wizard`.
.. seealso::
The Wizard Actions can be found by opening the main menu item:
|Administration --> User Interface --> Actions --> Wizards|__
.. |Administration --> User Interface --> Actions --> Wizards| replace:: :menuselection:`Administration --> User Interface --> Actions --> Wizards`
__ https://demo.tryton.org/model/ir.action.wizard
.. _model-ir.action.url:
URL Action
==========
Each *URL Action* stores a `URL <https://en.wikipedia.org/wiki/URL>`_ to open.
.. seealso::
The URL Actions can be found by opening the main menu item:
|Administration --> User Interface --> Actions --> URLs|__
.. |Administration --> User Interface --> Actions --> URLs| replace:: :menuselection:`Administration --> User Interface --> Actions --> URLs`
__ https://demo.tryton.org/model/ir.action.url
@@ -0,0 +1,19 @@
.. _model-ir.attachment:
Attachment
==========
*Attachment* is a :class:`~trytond.ir.resource.ResourceMixin` that stores
documents for any :class:`~trytond.model.ModelStorage` record.
.. seealso::
Attachments are found by opening the main menu item:
|Administration --> Models --> Attachments|__
.. |Administration --> Models --> Attachments| replace:: :menuselection:`Administration --> Models --> Attachments`
__ https://demo.tryton.org/model/ir.attachment
The attachments related to a record are found by opening the
:guilabel:`Attachment` menu item of the toolbar.
@@ -0,0 +1,11 @@
.. _model-ir.avatar:
Avatar
======
*Avatar* is a :class:`~trytond.ir.resource.ResourceMixin` that stores a single
`avatar <https://en.wikipedia.org/wiki/Avatar_(computing)>`_ for any
:meth:`~trytond.model.avatar_mixin` record.
Each *Avatar* record has a :abbr:`UUID (Universally Unique Identifier)` which
is used to construct a URL that returns the picture.
A version of the picture is stored in a cache for each size requested.
@@ -0,0 +1,7 @@
.. _model-ir.cache:
Cache
=====
The *Cache* stores when the named :class:`~trytond.cache.Cache` was last
invalidated.
@@ -0,0 +1,23 @@
.. _model-ir.calendar.month:
Calendar Month
==============
The *Calendar Month* stores each month of the `Gregorian calendar
<https://en.wikipedia.org/wiki/Gregorian_calendar>`_.
.. note::
Its goal is to provide a target for :class:`~trytond.model.fields.Many2One`
fields with localized month names.
.. _model-ir.calendar.day:
Calendar Day
============
The *Calendar Day* stores each day of the `week
<https://en.wikipedia.org/wiki/Week>`_.
.. note::
Its goal is to provide a target for :class:`~trytond.model.fields.Many2One`
fields with localized week day names.
@@ -0,0 +1,8 @@
.. _model-ir.configuration:
Configuration
=============
The *Configuration* is a :class:`~trytond.model.ModelSingleton` that stores
configuration from the `database setup <topics-setup-database>`, like the
default language and the host name.
@@ -0,0 +1,15 @@
.. _model-ir.cron:
Cron
====
The *Cron* stores the configuration for `scheduled actions <topics-cron>`.
.. seealso::
The Scheduled Actions can be found by opneing the main menu item:
|Administration --> Scheduler --> Actions|__
.. |Administration --> Scheduler --> Actions| replace:: :menuselection:`Administration --> Scheduler --> Actions`
__ https://demo.tryton.org/model/ir.cron
@@ -0,0 +1,6 @@
.. _model-ir.date:
Date
====
The *Date* :class:`~trytond.model.Model` provides the current date.
@@ -0,0 +1,36 @@
.. _model-ir.email:
Email
=====
The *Email* is a :class:`~trytond.ir.resource.ResourceAccessMixin` that stores
a copy of the emails sent from a :class:`~trytond.model.ModelStorage` record.
.. seealso::
Emails are found by opening the main menu item:
|Administration --> Models --> E-mails|__
.. |Administration --> Models --> E-mails| replace:: :menuselection:`Administration --> Models --> E-mails`
__ https://demo.tryton.org/model/ir.email
The emails related to a record are found by opening the :guilabel:`E-mails
Archives` menu item from the relate toolbar.
.. _model-ir.email.template:
Email Template
==============
The *Email Template* stores templates per `Model <model-ir.model>` and is used
to fill in the client's E-mail form.
.. seealso::
Email Templates are found by opening the main menu item:
|Administration --> User Interface --> Actions --> E-mail Templates|__
.. |Administration --> User Interface --> Actions --> E-mail Templates| replace:: :menuselection:`Administration --> User Interface --> Actions --> E-mail Templates`
__ https://demo.tryton.org/model/ir.email.template
@@ -0,0 +1,23 @@
.. _model-ir.error:
Error
=====
The *Error* stores exceptions raised by non interactive processes.
An *Error* can be processed and then solved by a `User <model-res.user>`.
When an *Error* is solved the process that originally reported the error is run
again.
.. note::
A `scheduled task <model-ir.cron>` deletes the errors after the configured
`number of days <config-queue.clean_days>`.
.. seealso::
The Errors can be found by opening the main menu item:
|Administration --> Scheduler --> Errors|__
.. |Administration --> Scheduler --> Errors| replace:: :menuselection:`Administration --> Scheduler --> Errors`
__ https://demo.tryton.org/model/ir.error
@@ -0,0 +1,18 @@
.. _model-ir.export:
Export
======
The *Export* stores the saved exports for each `User <model-res.user>`.
An export is composed of a list of :class:`~trytond.model.fields.Field` names.
When an *Export* is associated with a `Group <model-res.group>`, it becomes
available for all the *Users* of that *Group*.
.. seealso::
The exports can be found by opening the main menu item:
|Administration --> Models --> Exports|__
.. |Administration --> Models --> Exports| replace:: :menuselection:`Administration --> Models --> Exports`
__ https://demo.tryton.org/model/ir.export
+34
View File
@@ -0,0 +1,34 @@
******
Design
******
The *Internal Resource Module* introduces the following concepts:
.. note::
For historical reasons the module's technical name is ``ir``.
.. include:: model.inc.rst
.. include:: action.inc.rst
.. include:: module.inc.rst
.. include:: attachment.inc.rst
.. include:: avatar.inc.rst
.. include:: cache.inc.rst
.. include:: calendar.inc.rst
.. include:: configuration.inc.rst
.. include:: cron.inc.rst
.. include:: date.inc.rst
.. include:: email.inc.rst
.. include:: error.inc.rst
.. include:: export.inc.rst
.. include:: lang.inc.rst
.. include:: message.inc.rst
.. include:: note.inc.rst
.. include:: queue.inc.rst
.. include:: rule.inc.rst
.. include:: sequence.inc.rst
.. include:: session.inc.rst
.. include:: translation.inc.rst
.. include:: trigger.inc.rst
.. include:: ui.inc.rst
@@ -0,0 +1,18 @@
.. _model-ir.lang:
Language
========
The *Language* defines the properties such as the direction and the formatting
of the supported languages.
By loading the translations for a *Language*, it becomes translatable and can
be used to translate the user interface.
.. seealso::
The Languages can be found by opening the main menu item:
|Administration --> Localization --> Languages|__
.. |Administration --> Localization --> Languages| replace:: :menuselection:`Administration --> Localization --> Languages`
__ https://demo.tryton.org/model/ir.lang
@@ -0,0 +1,16 @@
.. _model-ir.message:
Message
=======
The *Message* stores translatable text that is shown to the `Users
<model-res.user>`.
.. seealso::
The Messages can be found by opening the main menu item:
|Administration --> Localization --> Messages|__
.. |Administration --> Localization --> Messages| replace:: :menuselection:`Administration --> Localization --> Messages`
__ https://demo.tryton.org/model/ir.message
+156
View File
@@ -0,0 +1,156 @@
.. _model-ir.model:
Model
=====
The *Model* stores a record of each subclass of :class:`~trytond.model.Model`
that is registered in the :class:`~trytond.pool.Pool`.
A model is composed of `Fields <model-ir.model.field>` that represents each
:class:`~trytond.model.fields.Field` it contains.
The administrator can enable global search for records of the model by checking
the :guilabel:`Global Search` box.
.. seealso::
Models are found by opening the main menu item:
|Administration --> Models --> Models|__
.. |Administration --> Models --> Models| replace:: :menuselection:`Administration --> Models --> Models`
__ https://demo.tryton.org/model/ir.model
Reports
-------
.. _report-ir.model.workflow_graph:
Workflow Graph
--------------
The *Workflow Graph* prints a `state diagram
<https://en.wikipedia.org/wiki/State_diagram>`_ for each selected
:class:`~trytond.model.Workflow` *Model*.
Wizards
-------
.. _wizard-ir.model.print_model_graph:
Graph
^^^^^
The *Graph* wizard prints an `object diagram
<https://en.wikipedia.org/wiki/Object_diagram>`_ that shows the relationships
between the selected *Models* down to the specified depth.
.. _model-ir.model.field:
Model Field
===========
The *Model Field* keeps a record for each subclass of
:class:`~trytond.model.fields.Field` that a `Model <model-ir.model>` contains.
.. seealso::
Model Fields are found by opening the main menu item:
|Administration --> Models --> Models --> Fields|__
.. |Administration --> Models --> Models --> Fields| replace:: :menuselection:`Administration --> Models --> Models --> Fields`
__ https://demo.tryton.org/model/ir.model.field
.. _model-ir.model.access:
Model Access
============
The *Model Access* defines the `access rights <topics-access_rights>` to
`Models <model-ir.model>` for each `Group <model-res.group>`.
.. seealso::
Models Access are found by opening the main menu item:
|Administration --> Models --> Models Access|__
.. |Administration --> Models --> Models Access| replace:: :menuselection:`Administration --> Models --> Models Access`
__ https://demo.tryton.org/model/ir.model.access
.. _model-ir.model.field.access:
Model Field Access
===================
The *Model Field Access* defines the `access rights <topics-access_rights>` to
`Model Fields <model-ir.model.field>` for each `group <model-res.group>`.
.. seealso::
Model Fields Access are found by opening the main menu item:
|Administration --> Models --> Models Access --> Fields Access|__
.. |Administration --> Models --> Models Access --> Fields Access| replace:: :menuselection:`Administration --> Models --> Models Access --> Fields Access`
__ https://demo.tryton.org/model/ir.model.field.access
.. _model-ir.model.button:
Model Button
============
The *Model Button* stores the buttons defined in the `Models <model-ir.model>`.
It also contains a list of `Groups <model-res.group>` that have `access
<topics-access_rights>` to the button and a list of rules that must be
satisfied to trigger the button's action.
.. seealso::
Model Buttons are found by opening the main menu item:
|Administration --> Models --> Models Access --> Buttons|__
.. |Administration --> Models --> Models Access --> Buttons| replace:: :menuselection:`Administration --> Models --> Models Access --> Buttons`
__ https://demo.tryton.org/model/ir.model.button
.. _model-ir.model.data:
Model Data
==========
The *Model Data* keeps track of the :class:`~trytond.model.ModelStorage`
records created by modules via `XML files <topics-modules-tryton-cfg>`.
If a *Model Data* is out of sync (i.e. the values in the database do not match
the values in the XML definition), it is possible to force synchronisation
using the :guilabel:`Sync` button.
.. seealso::
Model Data are found by opening the main menu item:
|Administration --> Models --> Data|__
.. |Administration --> Models --> Data| replace:: :menuselection:`Administration --> Models --> Data`
__ https://demo.tryton.org/model/ir.model.data
.. _model-ir.model.log:
Model Log
=========
The *Model Log* records events such as modification, suppression, click, launch
and transition that happened to a :class:`~trytond.model.ModelStorage` record.
.. seealso::
Model Logs are found by opening the main menu item:
|Administration --> Models --> Models --> Logs|__
.. |Administration --> Models --> Models --> Logs| replace:: :menuselection:`Administration --> Models --> Models --> Logs`
__ https://demo.tryton.org/model/ir.model.log
The logs related to a record are found by opening the :guilabel:`View
Logs...` menu item of the toolbar.
@@ -0,0 +1,58 @@
.. _model-ir.module:
Module
======
Every Tryton `Module <topics-modules>` has one entry.
The *Module* keeps track of whether it is activated or not.
.. seealso::
Modules are found by opening the main menu item:
|Administration --> Modules --> Modules|__
.. |Administration --> Modules --> Modules| replace:: :menuselection:`Administration --> Modules --> Modules`
__ https://demo.tryton.org/model/ir.module
Wizards
-------
.. _wizard-ir.module.activate_upgrade:
Activate / Upgrade Module
^^^^^^^^^^^^^^^^^^^^^^^^^
The *Activate / Upgrade Module* wizard performs the activation or upgrade of
the `Modules <model-ir.module>` marked as "To Upgrade", "To Remove" and "To
Activate".
It then launches the `Config Module <wizard-ir.module.config_wizard>` wizard.
.. _model-ir.module.config_wizard.item:
Module Config Wizard Item
=========================
The *Module Config Wizard Item* keeps track of the configuration `Actions
<model-ir.action>` to be launched after the `Activate / Upgrade Module
<wizard-ir.module.activate_upgrade>` wizard.
.. seealso::
Module Config Wizard Items are found by opening the main menu item:
|Administration --> Modules --> Config Wizard Items|__
.. |Administration --> Modules --> Config Wizard Items| replace:: :menuselection:`Administration --> Modules --> Config Wizard Items`
__ https://demo.tryton.org/model/ir.module.config_wizard.item
Wizards
-------
.. _wizard-ir.module.config_wizard:
Config Modules
^^^^^^^^^^^^^^
The *Config Modules* wizard launches all the pending `Items
<model-ir.module.config_wizard.item>` sequentially.
@@ -0,0 +1,21 @@
.. _model-ir.note:
Note
====
*Note* is a :class:`~trytond.ir.resource.ResourceMixin` that stores `User
<model-res.user>`'s messages associated with any
:class:`~trytond.model.ModelStorage` record.
The *Note* keeps track of who has read each message.
.. seealso::
Notes are found by opening the main menu item:
|Administration --> Models --> Notes|__
.. |Administration --> Models --> Notes| replace:: :menuselection:`Administration --> Models --> Notes`
__ https://demo.tryton.org/model/ir.note
The notes related to a record are found by opening the :guilabel:`Note` menu
item of the toolbar.
@@ -0,0 +1,8 @@
.. _model-ir.queue:
Queue
=====
The *Queue* stores the `tasks <topics-task-queue>` to be run asynchronously.
An expected :py:class:`~datetime.datetime` can be set to define when the task
should be run.
@@ -0,0 +1,25 @@
.. _model-ir.rule.group:
Rule Group
==========
The *Rule Group* stores a set of `Rules <model-ir.rule>` that define the
`access rights <topics-access_rights>` for records of a `Model
<model-ir.model>`.
.. seealso::
The Rule Group can be found by opening the main menu item:
|Administration --> Models --> Record Rules|__
.. |Administration --> Models --> Record Rules| replace:: :menuselection:`Administration --> Models --> Record Rules`
__ https://demo.tryton.org/model/ir.rule.group
.. _model-ir.rule:
Rule
====
The *Rule* defines a `Domain <topics-domain>` for a `Rule Group
<model-ir.rule>`.
@@ -0,0 +1,52 @@
.. _model-ir.sequence:
Sequence
========
The *Sequence* defines the properties to generate unique and sequential strings
with numbers.
A prefix and suffix can be added to the generated sequence string.
These support formatting that can include the current `Date <model-ir.date>`.
.. seealso::
The Sequences can be found by opening the main menu item:
|Administration --> Sequences --> Sequences|__
.. |Administration --> Sequences --> Sequences| replace:: :menuselection:`Administration --> Sequences --> Sequences`
__ https://demo.tryton.org/model/ir.sequence
.. _model.ir.sequence.strict:
Sequence Strict
===============
The *Sequence Strict* is similar to the `Sequence <model-ir.sequence>` but it
prevents any gaps in the generated numbers.
.. seealso::
The Sequences Strict can be found by opening the main menu item:
|Administration --> Sequences --> Sequences Strict|__
.. |Administration --> Sequences --> Sequences Strict| replace:: :menuselection:`Administration --> Sequences --> Sequences Strict`
__ https://demo.tryton.org/model/ir.sequence.strict
.. _model-ir.sequence.type:
Sequence Type
=============
The *Sequence Type* is used to categorize the `Sequences <model-ir.sequence>`
and defines the `Groups <model-res.group>` allowed to edit them.
.. seealso::
The Sequence Types can be found by opening the main menu item:
|Administration --> Sequences --> Types|__
.. |Administration --> Sequences --> Types| replace:: :menuselection:`Administration --> Sequences --> Types`
__ https://demo.tryton.org/model/ir.sequence.type
@@ -0,0 +1,15 @@
.. _model-ir.session:
Session
=======
The *Session* generates and stores the session keys for connected `Users
<model-res.user>`.
.. _model-ir.session.wizard:
Session Wizard
==============
The *Session Wizard* stores the data from active :class:`~trytond.wizard.State`
of the :class:`~trytond.wizard.Wizard`.
@@ -0,0 +1,49 @@
.. _model-ir.translation:
Translation
===========
The *Translation* stores the translated strings for each `Language
<model-ir.translation>`.
Wizards
-------
.. _wizard-ir.translation.set:
Set Translation
^^^^^^^^^^^^^^^
The *Set Translation* wizard creates missing entries for the ``en`` language
for the activated modules.
.. _wizard-ir.translation.clean:
Clean Translation
^^^^^^^^^^^^^^^^^
The *Clean Translation* wizard deletes obsolete entries.
.. _wizard-ir.translation.update:
Update Translation
^^^^^^^^^^^^^^^^^^
The *Update Translation* wizard creates missing entries for other languages
based on the ``en`` entries.
.. _wizard-ir.translation.export:
Export Translation
^^^^^^^^^^^^^^^^^^
The *Export Translation* wizard generates a PO-file for the selected module and
language.
.. _wizard-ir.translation.report:
Open Report Translation
^^^^^^^^^^^^^^^^^^^^^^^
The *Open Report Translation* wizard opens the list of translations for the
`Reports <model-ir.action.report>`.
@@ -0,0 +1,16 @@
.. _model-ir.trigger:
Trigger
=======
The *Trigger* registers the `conditions and the action <topics-triggers>` to
execute when a :class:`~trytond.model.Model` record is modified.
.. seealso::
The Triggers can be found by opening the main menu item:
|Administration --> Models --> Triggers|__
.. |Administration --> Models --> Triggers| replace:: :menuselection:`Administration --> Models --> Triggers`
__ https://demo.tryton.org/model/ir.trigger
+131
View File
@@ -0,0 +1,131 @@
.. _model-ir.ui.menu:
UI Menu
=======
The *Menu* defines the tree structure for the client menu.
Each entry may be linked to one or more `Actions <model-ir.action>` via the
``tree_open`` keyword.
Also, each `User <model-res.user>` can add menu records to their favorites.
.. seealso::
The Menu entries can be found by opening the main menu item:
|Administration --> User Interface --> Menu|__
.. |Administration --> User Interface --> Menu| replace:: :menuselection:`Administration --> User Interface --> Menu`
__ https://demo.tryton.org/model/ir.ui.menu
.. _model-ir.ui.view:
UI View
=======
The *View* stores the definitions of the different types of view for each
:class:`~trytond.model.Model`.
A *View* can inherit from another *View* to extend its content.
.. seealso::
The Views can be found by opening the main menu item:
|Administration --< User Interface --> Views|__
.. |Administration --< User Interface --> Views| replace:: :menuselection:`Administration --< User Interface --> Views`
__ https://demo.tryton.org/model/ir.ui.view
Wizards
-------
.. _wizard-ir.ui.view.show:
Show View
^^^^^^^^^
The *Show View* wizard renders the form `View <model-ir.ui.view>`.
.. _model-ir.ui.view_tree_width:
UI View Tree Width
==================
The *View Tree Width* stores the `User <model-res.user>`'s desired column
widths for each `Field <model-ir.model.field>` of the `Model <model-ir.model>`.
.. seealso::
The View Tree Widths can be found by opening the main menu item:
|Administration --> User Interface --> View Tree Width|__
.. |Administration --> User Interface --> View Tree Width| replace:: :menuselection:`Administration --> User Interface --> View Tree Width`
__ https://demo.tryton.org/model/ir.ui.view_tree_width
.. _model-ir.ui.view_tree_optional:
UI View Tree Optional
=====================
The *View Tree Optional* stores whether a `User <model-res.user>` wants an
optional field to be displayed or not for a `View <model-ir.ui.view>`.
.. seealso::
The View Tree Optionals can be found by opening the main menu item:
|Administration --> User Interface --> View Tree Optional|__
.. |Administration --> User Interface --> View Tree Optional| replace:: :menuselection:`Administration --> User Interface --> View Tree Optional`
__ https://demo.tryton.org/model/ir.ui.view_tree_optional
.. _model-ir.ui.view_tree_state:
UI View Tree State
==================
The *View Tree State* stores, for each `User <model-res.user>`, the tree view's
expanded and selected nodes for a `Model <model-ir.model>`, `Domain
<topics-domain>` and children.
.. seealso::
The View Tree States can be found by opening the main menu item:
|Administration --> User Interface --> Tree State|__
.. |Administration --> User Interface --> Tree State| replace:: :menuselection:`Administration --> User Interface --> Tree State`
__ https://demo.tryton.org/model/ir.ui.view_tree_state
.. _model-ir.ui.view_search:
UI View Search
==============
The *View Search* stores the `User's <model-res.user>` saved `Domain
<topics-domain>` for a `Model <model-ir.model>`.
.. seealso::
The View Searches can be found by opening the main menu item:
|Administration --> User Interface --> View Search|__
.. |Administration --> User Interface --> View Search| replace:: :menuselection:`Administration --> User Interface --> View Search`
__ https://demo.tryton.org/model/ir.ui.view_search
.. _model-ir.ui.icon:
UI Icon
=======
The *Icon* defines the path where a named icon is stored.
.. seealso::
The Icons can be found by opening the main menu item:
|Administration --> User Interface --> Icons|__
.. |Administration --> User Interface --> Icons| replace:: :menuselection:`Administration --> User Interface --> Icons`
__ https://demo.tryton.org/model/ir.ui.icon
+15
View File
@@ -0,0 +1,15 @@
.. _ir:
########################
Internal Resource Module
########################
The *Internal Resource Module* provides the basic internal resources needed to
run Tryton.
This includes the models, actions and user interface definitions.
.. toctree::
:maxdepth: 2
design/index
reference
+142
View File
@@ -0,0 +1,142 @@
*************
API Reference
*************
Resources
=========
.. module:: trytond.ir.resource
.. class:: ResourceAccessMixin
This mixin_ adds a ``resource`` :class:`~trytond.model.fields.Reference`
field and applies the same access right as the resource to the
:class:`~trytond.model.ModelStorage`.
.. class:: ResourceMixin
This mixin_ extends the :class:`ResourceAccessMixin` to add some metadata
fields and the option to copy the record using :meth:`resource_copy`.
.. method:: resource_copy(resource, name, string)
Returns a mixin_ that adds the named :class:`~trytond.model.fields.One2Many`
to the ``resource`` :class:`~trytond.model.ModelStorage`.
The mixin also adds a ``copy_resources_to(target)`` instance method that
copies the resource records to the ``target``.
Attachments
===========
.. module:: trytond.ir.attachment
.. class:: AttachmentCopyMixin
A mixin_ setup by the :meth:`~trytond.ir.resource.resource_copy` for the
`Attachments <model-ir.attachment>`.
Notes
=====
.. module:: trytond.ir.note
.. class:: NoteCopyMixin
A mixin_ setup by the :meth:`~trytond.ir.resource.resource_copy` for the
`Notes <model-ir.note>`.
Language
========
.. module:: trytond.ir.lang
.. class:: Language
.. method:: Language.get([code])
Returns the language instance for the ``code`` or the
:attr:`~trytond.transaction.Transaction.language`.
.. method:: Language.format(percent, value[, grouping[, monetary[, \*\*additional]]])
Formats the ``value`` according to the language by substitution of the
``%?`` specifier.
.. method:: Language.currency(val, currency[, symbol[, grouping[, digits]]])
Formats the numeric ``value`` according to the language and the currency.
.. method:: Language.strftime(value[, format])
Formats the :py:class:`~datetime.date` or :py:class:`~datetime.datetime`
according to the language.
.. method:: Language.format_number(value[, digits[, grouping[, monetary]]])
Formats the number ``value`` according to the language.
.. method:: Language.format_number_symbol(value, symbol[, digits[, grouping]])
Formats the number ``value`` with the :class:`~trytond.model.SymbolMixin`
instance according to the language.
.. _HTML Editor:
HTML Editor
===========
A route is registered to allow HTML :class:`~trytond.model.fields.Text` fields
to be edited using a web editor:
- ``GET`` ``/<database_name>/ir/html/<model>/<record>/<field>``
Returns the web page containing the editor with:
``model`` is the name of the :class:`~trytond.model.ModelStorage`.
``record`` is the :class:`~trytond.model.Model.id` of the record.
``field`` is the name of the :class:`~trytond.model.fields.Text` field.
- ``POST`` ``/<database_name>/ir/html/<model>/<record>/<field>``
Save the ``text`` value in the form with:
``model`` is the name of the :class:`~trytond.model.ModelStorage`.
``record`` is the :class:`~trytond.model.Model.id` of the record.
``field`` is the name of the :class:`~trytond.model.fields.Text` field.
.. _Download CSV Data:
Download CSV Data
=================
A route is registered to download records as a CSV file:
- ``GET`` ``/<database_name>/data/<model>``
Returns a CSV file for the records of ``model`` using the parameters:
``l`` is the language.
``d`` is a JSON encoded domain.
``c`` is a JSON encoded context.
``s`` is an integer to limit the number of records.
``p`` is the offset to apply to the list of records.
``o`` is a list of fields and orders separated by ``,``.
``f`` is a list of field names.
``enc`` is the encoding with ``UTF-8`` as default.
``dl`` is the CSV delimiter.
``qc`` is the quoting char.
``h`` is a boolean integer whether to include the header or not.
``loc`` is a boolean integer whether to use locale format or not.
.. _Fetch Avatar:
Fetch Avatar
============
A route is registered from which an `Avatar <model-ir.avatar>` can be downloaded:
- ``GET`` ``/avatar/<database_name>/<uuid>``
Returns the avatar using ``s`` parameter for the size and with:
``database_name`` is the name of the database encoded in base64.
``uuid`` is the UUID of the avatar.
.. _mixin: https://en.wikipedia.org/wiki/Mixin
+3 -3
View File
@@ -8,9 +8,9 @@ Internationalization
Return the message translated into the ``language``.
The ``message_id`` is the ``XML`` id for the ``ir.message`` that is to be
translated, and the ``variables`` keyword arguments are used as a mapping to
format the string.
The ``message_id`` is the ``XML`` id for the `Message <model-ir.message>`
that is to be translated, and the ``variables`` keyword arguments are used
as a mapping to format the string.
If ``language`` is not set, then the :attr:`Transaction.language
<trytond.transaction.Transaction.language>` is used.
+1
View File
@@ -12,6 +12,7 @@ Reference of the ``trytond`` API:
models
fields
wizard
report
pyson
transaction
exceptions
+11 -8
View File
@@ -76,7 +76,8 @@ Class methods:
.. classmethod:: Model.__register__(module_name)
Register the model in ``ir.model`` and ``ir.model.field``.
Register the model in `Model <model-ir.model>` and `Model Field
<model-ir.model.field>`.
See :meth:`trytond.pool.PoolBase.__register__`.
.. classmethod:: Model.default_get(fields_names[, with_rec_name])
@@ -338,8 +339,8 @@ Class methods:
.. classmethod:: ModelStorage.trigger_create(records)
Trigger create actions.
It calls actions defined in ``ir.trigger`` with ``on_create`` set and
``condition`` is true.
It calls actions defined in the `Trigger <model-ir.trigger>` where
``on_create`` is set and the ``condition`` is true.
.. classmethod:: ModelStorage.read(ids, fields_names)
@@ -385,8 +386,9 @@ Class methods:
.. classmethod:: ModelStorage.trigger_write(eligibles)
Trigger write actions.
It will call actions defined in ``ir.trigger`` with ``on_write`` set and
``condition`` was false before :meth:`~ModelStorage.write` and true after.
It calls actions defined in `Trigger <model-ir.trigger>` where ``on_write``
is set and the ``condition`` was false before :meth:`~ModelStorage.write`
and true after.
.. classmethod:: ModelStorage.index_set_field(name)
@@ -399,8 +401,8 @@ Class methods:
.. classmethod:: ModelStorage.trigger_delete(records)
Trigger delete actions.
It will call actions defined in ``ir.trigger`` with ``on_delete`` set and
``condition`` is true.
It calls actions defined in `Trigger <model-ir.trigger>` where ``on_delete``
is set and ``condition`` is true.
.. classmethod:: ModelStorage.copy(records[, default])
@@ -1198,7 +1200,8 @@ avatar, if it's not set then no default avatar is generated.
.. attribute:: AvatarMixin.avatars
The :class:`~fields.One2Many` field used to store the ``ir.avatar`` records.
The :class:`~fields.One2Many` field used to store the `Avatar
<model-ir.avatar>` records.
.. attribute:: AvatarMixin.avatar
+131
View File
@@ -0,0 +1,131 @@
.. _ref-report:
.. module:: trytond.report
Report
======
A report generates printable documents from
:class:`~trytond.model.ModelStorage` records.
There is also a more :ref:`practical introduction into reports
<topics-reports>`.
.. class:: Report()
This is the base class for all reports.
Class attributes are:
.. attribute:: Report.__name__
The unique name used to reference the report throughout the platform.
Class methods are:
.. classmethod:: Report.__setup__()
Setup the class before adding it to the :class:`~trytond.pool.Pool`.
.. classmethod:: Report.__post_setup__()
Setup the class after adding it to the :class:`~trytond.pool.Pool`.
.. classmethod:: Report.__register__(module_name)
Registers the report.
.. classmethod:: Report.check_access()
Verifies if the :attr:`~trytond.transaction.Transaction.user` is allowed to
execute the report.
.. classmethod:: Report.header_key(record)
Returns a tuple of keys, composed of couples of name and record value, used
to group document with the same header.
.. classmethod:: Report.execute(ids, data)
Executes the report for the :class:`~trytond.model.ModelStorage` instances
with the ``ids`` and returns a tuple containing the report type, the content,
a boolean to indicate direct printing and the report name.
``data`` is a dictionary that will be available in the evaluation context of
the report.
.. classmethod:: Report.get_context(records, header, data)
Returns a dictionary with the evaluation context of the report template.
The context is filled by default with the keys:
- ``header``
- ``data``
- :attr:`~trytond.transaction.Transaction.context`
- :attr:`~trytond.transaction.Transaction.user`
- ``records``
- ``record`` (containing the first ``records``)
- :meth:`~Report.format_date`
- :meth:`~Report.format_datetime`
- :meth:`~Report.format_timedelta`
- :meth:`~Report.format_currency`
- :meth:`~Report.format_number`
- :meth:`~Report.format_number_symbol`
- :py:mod:`datetime`
- :meth:`~Report.barcode`
- :meth:`~Report.qrcode`
- ``set_lang``
.. classmethod:: Report.render(report, report_context)
Returns the content of the `Report <model-ir.action.report>` rendered by the
templating engine.
.. classmethod:: Report.convert(report, data, [timeout[, retry]])
Converts the report content ``data`` into the format defined by the `Report
<model-ir.action.report>`.
.. classmethod:: Report.format_date(value[, lang[, format]])
Returns the formatted :py:class:`~datetime.date`.
.. classmethod:: Report.format_datetime(value[, lang[, format[, timezone]]])
Returns the formatted :py:class:`~datetime.datetime`.
.. classmethod:: Report.format_timedelta(value[, converter[, lang]])
Returns the formatted :py:class:`~datetime.timedelta`.
.. classmethod:: Report.format_currency(value, lang, currency[, symbol[, grouping[, digits]]])
Returns the formatted numeric value.
.. classmethod:: Report.format_number(value, lang[, digits[, grouping[, monetary]]])
Returns the formatted numeric value.
.. classmethod:: Report.format_number_symbol(value, lang, symbol[, digits[, grouping[, monetary]]])
Returns the numeric value formatted using the
:class:`~trytond.model.SymbolMixin` instance.
.. classmethod:: Report.barcode(name, code[, size[, \*\*kwargs]])
Returns named barcode image for the ``code``, the mimetype and the size.
The optional keyword arguments are the same as
:func:`~trytond.tools.barcode.generate_svg`.
.. classmethod:: Report.qrcode(code[, size[, \*\*kwargs]])
Returns the QRCode image for the ``code``, the mimetype and the size.
The optional keyword arguments are the sames as
:func:`~trytond.tools.qrcode.generate_svg`.
Email
=====
.. function:: get_email(report, record, languages)
Returns the :py:class:`~email.message.EmailMessage` and title using the
`Report <model-ir.action.report>` rendered for the
:class:`~trytond.model.ModelStorage` record for each language.
+4 -3
View File
@@ -195,7 +195,8 @@ StateAction
.. class:: StateAction(action_id)
A :class:`StateTransition` which let the client launch an ``ir.action``.
A :class:`StateTransition` which lets the client launch an `Action
<model-ir.action>`.
This action definition can be customized with a method on wizard having the
same name as the state but starting with ``do_``.
@@ -204,13 +205,13 @@ Instance attributes are:
.. attribute:: StateAction.action_id
The XML id of the ``ir.action``.
The XML id of the `Action <model-ir.action>`.
Instance methods are:
.. method:: StateAction.get_action()
Return the ``ir.action`` definition.
Return the `Action <model-ir.action>` definition.
StateReport
+25 -19
View File
@@ -17,11 +17,12 @@ The access rights are checked if the :attr:`Transaction.context
Model
=====
They are defined by records of ``ir.model.access`` which define for each couple
of model and group, the ``read``, ``write``, ``create`` and ``delete``
permission. The permissions are related to the
:class:`~trytond.model.ModelStorage` methods with the same name and on
:meth:`~trytond.model.ModelStorage.search` using the ``read`` permission.
They are defined by records of `Model Access <model-ir.model.access>` which
define for each combined model and group, the ``read``, ``write``, ``create``
and ``delete`` permissions.
The permissions are related to the :class:`~trytond.model.ModelStorage` methods
with the same name and on :meth:`~trytond.model.ModelStorage.search` using the
``read`` permission.
If any group the user belongs to has the checked permission activated, then the
user is granted this permission.
@@ -35,8 +36,8 @@ If there is no record for the model, then access is granted to all users.
Actions
=======
Each ``ir.action`` has a ``groups`` field which contains a list of user groups
that are allowed to see and launch it.
Each `Action <model-ir.action>` has a ``groups`` field which contains a list of
user groups that are allowed to see and launch it.
There is a special case for :ref:`wizard <topics-wizard>` for which the read
access on the model is also checked and also the write access if there is no
@@ -45,8 +46,9 @@ groups linked.
Field
=====
They are defined by records of ``ir.model.field.access`` and work like those
for `Model`_ but are applied to :ref:`fields <ref-models-fields>`.
They are defined by records of `Model Field Access
<model-ir.model.field.access>` and work like those for `Model`_ but are applied
to :ref:`fields <ref-models-fields>`.
.. note::
Fields for which the user has no read access are automatically removed from
@@ -55,9 +57,10 @@ for `Model`_ but are applied to :ref:`fields <ref-models-fields>`.
Button
======
For each button of a model the records of ``ir.model.button`` define the list of
groups that are allowed to call it. The user only needs to belong to one of the
groups to be granted the permission to use it.
For each button of a model the records of `Model Button
<model-ir.model.button>` define the list of groups that are allowed to call it.
The user only needs to belong to one of the groups to be granted the permission
to use it.
If no group is defined for a button, the ``write`` permission to the model is
checked instead.
@@ -70,17 +73,19 @@ The ``read`` permission to the model is always enforced.
Button Rule
-----------
The ``ir.model.button`` can contain a list of rules which define how many
different users must click on the button. Each rule, for which the condition
is met, must be passed to actually trigger the action. The counter can be reset
when another defined button is clicked.
The `Model Button <model-ir.model.button>` can contain a list of rules which
define how many different users must click on the button.
Each rule, for which the condition is met, must be passed to actually trigger
the action.
The counter can be reset when another defined button is clicked.
Record Rule
===========
The record rules are conditions that records must meet for the user to be
granted permission to use them.
They are defined by records of ``ir.rule.group`` which contains:
They are defined by records of `Rule Group <model-ir.rule.group>` which
contains:
- The model the rule applies to.
- The type of permissions to be granted.
@@ -90,8 +95,9 @@ They are defined by records of ``ir.rule.group`` which contains:
- A default flag to apply the rule, by default, to all users.
This then allows other less restrictive rules, that apply to the user,
to grant them additional permissions.
- A list of ``ir.rule`` records, each with a :ref:`domain <topics-domain>`
that is used to select the records to which the rule applies.
- A list of `Rule <model-ir.rule>` records, each with a :ref:`domain
<topics-domain>` that is used to select the records to which the rule
applies.
A rule group matches a record if the record is validated by at least one of the
domains.
+6 -5
View File
@@ -7,17 +7,18 @@ Scheduled Actions
Tryton provides a scheduler (aka cron) which can execute methods of
:ref:`models <topics-models>` periodically at set intervals.
The planning is managed by ``ir.cron`` records which store the method to call
and the interval of time between calls. The method must be a class method of a
:class:`~trytond.model.Model` which can be called without any parameters.
The planning is managed by `Cron <model-ir.cron>` records which store the
method to call and the interval of time between calls.
The method must be a class method of a :class:`~trytond.model.Model` which can
be called without any parameters.
.. note::
The timezone used to schedule the action is
:attr:`timezone.SERVER <trytond.tools.timezone.SERVER>`.
To register a new method with the scheduler, you must extend the ``ir.cron``
model and append the new method to the
To register a new method with the scheduler, you must extend the `Cron
<model-ir.cron>` model and append the new method to the
:attr:`~trytond.model.fields.Selection.selection` attribute of the ``method``
field in :meth:`~trytond.model.Model.__setup__()`. The name of the selection
must be the model name and the method name joined together with a ``|`` between
+1 -1
View File
@@ -192,7 +192,7 @@ Here is the list of the tags:
other types, it is required to use the ``eval`` attribute.
``menuitem``
Shortcut to create ``ir.ui.menu`` records.
Shortcut to create `Menu <model-ir.ui.menu>` records.
Here is the list of attributes:
``id``
+4 -3
View File
@@ -29,7 +29,8 @@ These are specific to ODT files.
.. _relatorio: https://relatorio.tryton.org/
.. _Genshi: https://genshi.edgewall.org/
When defining an ``ir.action.report`` the following attributes are available:
When defining a `Report <model-ir.action.report>` the following attributes are
available:
``name``
The name of the report.
@@ -174,8 +175,8 @@ Creating a simple report template for a model within a module
-------------------------------------------------------------
Once you have created a report template stored in your module, you must create
an XML record of ``ir.action.report`` and another XML record of
``ir.action.keyword`` like:
an XML record for the `Report <model-ir.action.report>` and another XML record for the
`Action Keyword <model-ir.action>` like:
.. code-block:: xml
+2 -2
View File
@@ -18,8 +18,8 @@ The first argument of the method must be an instance or a list of instances of
:class:`~trytond.model.Model`.
This other arguments must be JSON-ifiable.
A task is pushed into the ``queue`` by calling the desired method on the
:attr:`~trytond.model.Model.__queue__`.
A task is pushed into the `Queue <model-ir.queue>` by calling the desired
method on the :attr:`~trytond.model.Model.__queue__`.
This stores in the queue all the current parameters of the call and it will be
execute by a worker or at the end of the transaction if no worker is
configured.
+6 -5
View File
@@ -12,7 +12,7 @@ The official language files are named after the `POSIX locale
standard, e.g. de.po, es.po, es_AR.po, es_EC.po...
The names of custom language files must match the code of the language in the
:class:`~trytond.model.Model` ``ir.lang``.
`Language <model-ir.lang>`.
If a language is set ``translatable``, the translations is loaded into the
database on each update.
@@ -59,11 +59,12 @@ To override the translation of another module the ``msgctxt`` string must have
the following content: ``type:name:module.xml_id``
type
The field type of ir.translation.
The field type of `Translation <model-ir.translation>`.
name
The field name of ir.translation.
The field name of *Translation*.
module
The field module ir.translation.
The field module *Translation*.
xml_id
The XML id that is stored in ``ir.model.data`` as ``fs_id``.
The XML id that is stored in `Model Data <model-ir.model.data>` as
``fs_id``.
It is optional and can be omitted if it is None.
+8 -7
View File
@@ -18,11 +18,12 @@ The method signature is::
<method name>(cls, records, trigger)
Where ``records`` is the list of records that triggered the event and
``trigger`` is the ``ir.trigger`` instance which is triggered.
``trigger`` is the `Trigger <model-ir.trigger>` instance which is triggered.
Triggers are defined by records of ``ir.trigger``. Each record must define a
pyson condition which will be evaluated when the event occurs. Only those
records for which the condition is evaluated to true will be processed by the
trigger with the exception of modification triggers which will only process the
records for which the condition is evaluated to false before and evaluated to
true after the modification.
Triggers are defined by records of `Trigger <model-ir.trigger>`.
Each record must define a :class:`~trytond.pyson.PYSON` condition which will be
evaluated when the event occurs.
Only those records for which the condition is evaluated to true will be
processed by the trigger with the exception of modification triggers which will
only process the records for which the condition is evaluated to false before
and evaluated to true after the modification.
+1 -1
View File
@@ -7,7 +7,7 @@ Extending View
Extending a view means, that the original view will be modified by a set of
rules which are defined with XML.
For this purpose, the extension engine uses XPath_ expressions.
The view is defined with the field ``inherit`` of the ``ir.ui.view``.
The view is defined with the `View <model-ir.ui.view>`'s ``inherit`` field.
If the field :ref:`domain <topics-domain>` is not set or evaluated to ``True``,
the inheritance will be proceeded.
+14 -12
View File
@@ -11,7 +11,7 @@ In Tryton, :class:`ModelView <trytond.model.ModelView>` can have several views.
An ``action`` opens a window and defines which view to show.
The views are built from XML that is stored in the :file:`view` directory of
the module or in the databases thanks to the model ir.ui.view.
the module or in the databases thanks to the `View <model-ir.ui.view>`.
So generally, they are defined in XML files with this kind of XML where name is
the name of the XML file in the :file:`view` directory:
@@ -398,7 +398,8 @@ Display an image with those attributes:
``name``
The image name or the field name which contains the image name.
For the ``icon`` type it must be the name of a record of ``ir.ui.icon``.
For the ``icon`` type it must be the name of an `Icon <model-ir.ui.icon>`
record.
For the ``url`` type it must be the URL. It can be relative to the server.
``url_size``
@@ -462,8 +463,8 @@ Display a button with those attributes:
``button(cls, records)``
The function may return an ``ir.action`` id or one of those client side
action keywords:
The function may return an `Action <model-ir.action>` id or one of these
client side action keywords:
.. _topics-views-client-actions:
@@ -507,22 +508,22 @@ Display a button with those attributes:
:ref:`help <common-attributes-help>`.
.. warning::
The button should be registered on ``ir.model.button`` where the default
value of the ``string``, ``confirm`` and ``help`` attributes can be can be
defined.
The button should be registered as a `Model Button <model-ir.model.button>`
where the default value of the ``string``, ``confirm`` and ``help``
attributes can be can be defined.
.. _form-link:
link
----
Display an ``ir.action.act_window`` as a button with a counter or one counter
per tab.
Display an `Window Action <model-ir.action.act_window>` as a button with a
counter or one counter per tab.
When clicked it opens the window.
The available attributes are:
``name``
The XML id of ``ir.action.act_window``.
The XML id of `Window Action <model-ir.action.act_window>`.
``icon``
The name of the icon to display.
@@ -628,7 +629,7 @@ A tree view is used to display records inside a list or a tree.
It is a tree if there is a ``field_childs`` defined and this tree has the drag
and drop activated if the ``field_childs`` and the ``parent field`` are defined
in the ``ir.ui.view`` record.
in the `View <model-ir.ui.view>` record.
The columns of the view are put on the screen from left to right.
@@ -751,7 +752,8 @@ displayed in the same column with the attributes:
``icon``
The image name or the field name which contains the image name.
For the ``icon`` type it must be the name of a record of ``ir.ui.icon``.
For the ``icon`` type it must be the name of an `Icon <model-ir.ui.icon>`
record.
For the ``url`` type it must be the URL and it can be relative to the server.
``icon_type``
@@ -32,8 +32,8 @@ following class method is added in :file:`opportunity.py` file:
Call other model methods
------------------------
In the previous example we called the ``today`` method of the ``ir.date`` model
from the :class:`~trytond.pool.Pool` instance.
In the previous example we called the ``today`` method of the `Date
<model-ir.date>` model from the :class:`~trytond.pool.Pool` instance.
The :attr:`~trytond.model.Model.__name__` value is used to get the class.
It is very important to get the class from the pool instead of using a normal
Python import, because the pool ensures that all of the extensions are applied
+2 -2
View File
@@ -43,8 +43,8 @@ Extend the Party view
Now that we added a new field to the ``party.party``
:class:`~trytond.model.Model`, we can also add it the form view.
This is done by adding a ``ir.ui.view`` record that inherit the party form view
of the ``party`` module.
This is done by adding a `View <model-ir.ui.view>` record that inherit the
party form view of the ``party`` module.
Here is the content of the :file:`party.xml` file:
.. code-block:: xml
+7 -7
View File
@@ -28,8 +28,8 @@ And we register it in the :class:`~trytond.pool.Pool` as type ``report`` in
module='opportunity', type_='report')
Now we have to create a ``ir.action.report`` and ``ir.action.keyword`` in
:file:`opportunity.xml`:
Now we have to create a `Report <model-ir.action.report>` and `Action Keyword
<model-ir.action>` in :file:`opportunity.xml`:
.. code-block:: xml
@@ -51,8 +51,8 @@ Now we have to create a ``ir.action.report`` and ``ir.action.keyword`` in
</data>
</tryton>
The ``ir.action.report`` links the ``trytond.report.Report`` with the
:class:`~trytond.model.Model`.
The `Report <model-ir.action.report>` links the :class:`~trytond.report.Report`
with the :class:`~trytond.model.Model`.
``name``
The string that is shown on the menu.
@@ -65,9 +65,9 @@ The ``ir.action.report`` links the ``trytond.report.Report`` with the
``template_extension``
The template format.
And like for the :ref:`wizard <tutorial-module-wizard>`, the
``ir.action.keyword`` makes the ``trytond.report.Report`` available as action
to any ``training.opportunity``.
And like for the :ref:`wizard <tutorial-module-wizard>`, the `Action Keyword
<model-ir.action>` makes the :class:`~trytond.report.Report` available as
action to any ``training.opportunity``.
Finally we create the OpenDocument_ template as :file:`opportunity.fodt` using
LibreOffice_.
+2 -2
View File
@@ -126,8 +126,8 @@ Now we have to declare the XML data file in the :file:`tryton.cfg` file:
Create menu entry
-----------------
In order to show our models on the user menu we need an
``ir.action.act_window`` and a menu entry.
In order to show our models on the user menu we need an `Window Action
<model-ir.action.act_window>` and a menu entry.
An action window is used to relate one or more views, usually a list and a form
view.
+7 -6
View File
@@ -110,8 +110,8 @@ And we register it in the :class:`~trytond.pool.Pool` as type ``wizard`` in
opportunity.Convert,
module='opportunity', type_='wizard')
Finally we just need to create a ``ir.action.wizard`` and ``ir.action.keyword``
in :file:`opportunity.xml`:
Finally we just need to create a `Wizard <model-ir.action.wizard>` and an
`Action Keyword <model-ir.action>` in :file:`opportunity.xml`:
.. code-block:: xml
@@ -131,8 +131,8 @@ in :file:`opportunity.xml`:
</data>
</tryton>
The ``ir.action.wizard`` links the :class:`~trytond.wizard.Wizard` with the
:class:`~trytond.model.Model`.
The `Wizard <model-ir.action.wizard>` links the :class:`~trytond.wizard.Wizard`
with the :class:`~trytond.model.Model`.
``name``
The string that is shown on the menu.
@@ -141,8 +141,9 @@ The ``ir.action.wizard`` links the :class:`~trytond.wizard.Wizard` with the
``model``
The name of the :class:`~trytond.model.Model`.
And the ``ir.action.keyword`` makes the :class:`~trytond.wizard.Wizard`
available as action to any ``training.opportunity``.
And the `Action Keyword <model-ir.action>` makes the
:class:`~trytond.wizard.Wizard` available as action to any
``training.opportunity``.
``keyword``
The type of `keyword <topics-actions>`.
+2 -2
View File
@@ -98,8 +98,8 @@ dictionary and decorate the transition method with the
def lost(cls, opportunities):
...
Every button must also be recorded in ``ir.model.button`` to define its label
(and also the :ref:`access right <topics-access_rights>`).
Every button must also be recorded as a `Model Button <model-ir.model.button>` to
define its label (and also the :ref:`access right <topics-access_rights>`).
We must add to the ``opportunity.xml`` file:
.. code-block:: xml