19921 lines
856 KiB
Plaintext
19921 lines
856 KiB
Plaintext
# SOME DESCRIPTIVE TITLE.
|
||
# Copyright (C) Odoo S.A.
|
||
# This file is distributed under the same license as the Odoo package.
|
||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||
#
|
||
#, fuzzy
|
||
msgid ""
|
||
msgstr ""
|
||
"Project-Id-Version: Odoo 14.0\n"
|
||
"Report-Msgid-Bugs-To: \n"
|
||
"POT-Creation-Date: 2021-05-18 07:12+0200\n"
|
||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||
"MIME-Version: 1.0\n"
|
||
"Content-Type: text/plain; charset=UTF-8\n"
|
||
"Content-Transfer-Encoding: 8bit\n"
|
||
|
||
#: ../../content/developer.rst:3
|
||
msgid "Developer"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/glossary.rst:5
|
||
msgid "Glossary"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/glossary.rst:8
|
||
msgid "external id"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/glossary.rst:9
|
||
msgid "external identifier"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/glossary.rst:10
|
||
msgid "external identifiers"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/glossary.rst:12
|
||
msgid "string identifier stored in ``ir.model.data``, can be used to refer to a record regardless of its database identifier during data imports or export/import roundtrips."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/glossary.rst:16
|
||
msgid "External identifiers are in the form :samp:`{module}.{id}` (e.g. ``account.invoice_graph``). From within a module, the :samp:`{module}.` prefix can be left out."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/glossary.rst:20
|
||
msgid "Sometimes referred to as \"xml id\" or ``xml_id`` as XML-based :ref:`reference/data` make extensive use of them."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/glossary.rst:22
|
||
msgid "format string"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/glossary.rst:24
|
||
msgid "inspired by `jinja variables`_, format strings allow more easily mixing literal content and computed content (expressions): content between ``{{`` and ``}}`` is interpreted as an expression and evaluated, other content is interpreted as literal strings and displayed as-is"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/glossary.rst:29
|
||
msgid "GIS"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/glossary.rst:30
|
||
msgid "Geographic Information System"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/glossary.rst:32
|
||
msgid "any computer system or subsystem to capture, store, manipulate, analyze, manage or present spatial and geographical data."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/glossary.rst:34
|
||
msgid "minified"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/glossary.rst:35
|
||
msgid "minification"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/glossary.rst:37
|
||
msgid "process of removing extraneous/non-necessary sections of files (comments, whitespace) and possibly recompiling them using equivalent but shorter structures (`ternary operator`_ instead of ``if/else``) in order to reduce network traffic"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos.rst:3
|
||
msgid "Tutorials"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:7
|
||
msgid "Building a Module"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:11
|
||
msgid "This tutorial requires :ref:`having installed Odoo <setup/install>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:14
|
||
msgid "Start/Stop the Odoo server"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:16
|
||
msgid "Odoo uses a client/server architecture in which clients are web browsers accessing the Odoo server via RPC."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:19
|
||
msgid "Business logic and extension is generally performed on the server side, although supporting client features (e.g. new data representation such as interactive maps) can be added to the client."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:23
|
||
msgid "In order to start the server, simply invoke the command :ref:`odoo-bin <reference/cmdline>` in the shell, adding the full path to the file if necessary:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:31
|
||
msgid "The server is stopped by hitting ``Ctrl-C`` twice from the terminal, or by killing the corresponding OS process."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:35
|
||
msgid "Build an Odoo module"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:37
|
||
msgid "Both server and client extensions are packaged as *modules* which are optionally loaded in a *database*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:40
|
||
msgid "Odoo modules can either add brand new business logic to an Odoo system, or alter and extend existing business logic: a module can be created to add your country's accounting rules to Odoo's generic accounting support, while the next module adds support for real-time visualisation of a bus fleet."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:45
|
||
msgid "Everything in Odoo thus starts and ends with modules."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:48
|
||
msgid "Composition of a module"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:50
|
||
msgid "An Odoo module can contain a number of elements:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:54
|
||
msgid "Business objects"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:53
|
||
msgid "Declared as Python classes, these resources are automatically persisted by Odoo based on their configuration"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:57
|
||
msgid ":ref:`Object views <reference/views>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:57
|
||
msgid "Definition of business objects UI display"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:65
|
||
msgid ":ref:`Data files <reference/data>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:60
|
||
msgid "XML or CSV files declaring the model metadata :"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:62
|
||
msgid ":ref:`views <reference/views>` or :ref:`reports <reference/reports>`,"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:63
|
||
msgid "configuration data (modules parametrization, :ref:`security rules <reference/security>`),"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:64
|
||
msgid "demonstration data"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:65
|
||
msgid "and more"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:68
|
||
msgid ":ref:`Web controllers <reference/controllers>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:68
|
||
msgid "Handle requests from web browsers"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:71
|
||
msgid "Static web data"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:71
|
||
msgid "Images, CSS or javascript files used by the web interface or website"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:74
|
||
#: ../../content/developer/reference/guidelines.rst:32
|
||
msgid "Module structure"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:76
|
||
msgid "Each module is a directory within a *module directory*. Module directories are specified by using the :option:`--addons-path <odoo-bin --addons-path>` option."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:83
|
||
msgid "most command-line options can also be set using :ref:`a configuration file <reference/cmdline/config>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:86
|
||
msgid "An Odoo module is declared by its :ref:`manifest <reference/module/manifest>`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:88
|
||
msgid "A module is also a `Python package <http://docs.python.org/2/tutorial/modules.html#packages>`_ with a ``__init__.py`` file, containing import instructions for various Python files in the module."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:93
|
||
msgid "For instance, if the module has a single ``mymodule.py`` file ``__init__.py`` might contain::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:98
|
||
msgid "Odoo provides a mechanism to help set up a new module, :ref:`odoo-bin <reference/cmdline/server>` has a subcommand :ref:`scaffold <reference/cmdline/scaffold>` to create an empty module:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:106
|
||
msgid "The command creates a subdirectory for your module, and automatically creates a bunch of standard files for a module. Most of them simply contain commented code or XML. The usage of most of those files will be explained along this tutorial."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:110
|
||
msgid "Module creation"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:112
|
||
msgid "Use the command line above to create an empty module Open Academy, and install it in Odoo."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:116
|
||
msgid "Object-Relational Mapping"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:118
|
||
msgid "A key component of Odoo is the :abbr:`ORM (Object-Relational Mapping)` layer. This layer avoids having to write most :abbr:`SQL (Structured Query Language)` by hand and provides extensibility and security services\\ [#rawsql]_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:122
|
||
msgid "Business objects are declared as Python classes extending :class:`~odoo.models.Model` which integrates them into the automated persistence system."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:126
|
||
msgid "Models can be configured by setting a number of attributes at their definition. The most important attribute is :attr:`~odoo.models.Model._name` which is required and defines the name for the model in the Odoo system. Here is a minimally complete definition of a model::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:137
|
||
msgid "Model fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:139
|
||
msgid "Fields are used to define what the model can store and where. Fields are defined as attributes on the model class::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:150
|
||
msgid "Common Attributes"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:152
|
||
msgid "Much like the model itself, its fields can be configured, by passing configuration attributes as parameters::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:157
|
||
msgid "Some attributes are available on all fields, here are the most common ones:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:159
|
||
msgid ":attr:`~odoo.fields.Field.string` (``unicode``, default: field's name)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:160
|
||
msgid "The label of the field in UI (visible by users)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:162
|
||
msgid ":attr:`~odoo.fields.Field.required` (``bool``, default: ``False``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:162
|
||
msgid "If ``True``, the field can not be empty, it must either have a default value or always be given a value when creating a record."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:164
|
||
msgid ":attr:`~odoo.fields.Field.help` (``unicode``, default: ``''``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:165
|
||
msgid "Long-form, provides a help tooltip to users in the UI."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:167
|
||
msgid ":attr:`~odoo.fields.Field.index` (``bool``, default: ``False``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:167
|
||
msgid "Requests that Odoo create a `database index`_ on the column."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:170
|
||
msgid "Simple fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:172
|
||
msgid "There are two broad categories of fields: \"simple\" fields which are atomic values stored directly in the model's table and \"relational\" fields linking records (of the same model or of different models)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:176
|
||
msgid "Example of simple fields are :class:`~odoo.fields.Boolean`, :class:`~odoo.fields.Date`, :class:`~odoo.fields.Char`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:180
|
||
msgid "Reserved fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:182
|
||
msgid "Odoo creates a few fields in all models\\ [#autofields]_. These fields are managed by the system and shouldn't be written to. They can be read if useful or necessary:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:186
|
||
msgid ":attr:`~odoo.fields.Model.id` (:class:`~odoo.fields.Id`)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:187
|
||
msgid "The unique identifier for a record in its model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:188
|
||
msgid ":attr:`~odoo.fields.Model.create_date` (:class:`~odoo.fields.Datetime`)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:189
|
||
msgid "Creation date of the record."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:190
|
||
msgid ":attr:`~odoo.fields.Model.create_uid` (:class:`~odoo.fields.Many2one`)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:191
|
||
msgid "User who created the record."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:192
|
||
msgid ":attr:`~odoo.fields.Model.write_date` (:class:`~odoo.fields.Datetime`)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:193
|
||
msgid "Last modification date of the record."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:195
|
||
msgid ":attr:`~odoo.fields.Model.write_uid` (:class:`~odoo.fields.Many2one`)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:195
|
||
msgid "user who last modified the record."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:198
|
||
msgid "Special fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:200
|
||
msgid "By default, Odoo also requires a ``name`` field on all models for various display and search behaviors. The field used for these purposes can be overridden by setting :attr:`~odoo.models.Model._rec_name`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:204
|
||
msgid "Define a model"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:206
|
||
msgid "Define a new data model *Course* in the *openacademy* module. A course has a title and a description. Courses must have a title."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:210
|
||
msgid "Data files"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:212
|
||
msgid "Odoo is a highly data driven system. Although behavior is customized using Python_ code part of a module's value is in the data it sets up when loaded."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:215
|
||
msgid "some modules exist solely to add data into Odoo"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:218
|
||
msgid "Module data is declared via :ref:`data files <reference/data>`, XML files with ``<record>`` elements. Each ``<record>`` element creates or updates a database record."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:232
|
||
msgid "``model`` is the name of the Odoo model for the record."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:233
|
||
msgid "``id`` is an :term:`external identifier`, it allows referring to the record (without having to know its in-database identifier)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:235
|
||
msgid "``<field>`` elements have a ``name`` which is the name of the field in the model (e.g. ``description``). Their body is the field's value."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:238
|
||
msgid "Data files have to be declared in the manifest file to be loaded, they can be declared in the ``'data'`` list (always loaded) or in the ``'demo'`` list (only loaded in demonstration mode)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:242
|
||
msgid "Define demonstration data"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:244
|
||
msgid "Create demonstration data filling the *Courses* model with a few demonstration courses."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:247
|
||
msgid "The content of the data files is only loaded when a module is installed or updated."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:250
|
||
msgid "After making some changes, do not forget to use :ref:`odoo-bin -u openacademy <reference/cmdline>` to save the changes to your database."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:257
|
||
msgid "Actions and Menus"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:259
|
||
msgid "Actions and menus are regular records in database, usually declared through data files. Actions can be triggered in three ways:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:262
|
||
msgid "by clicking on menu items (linked to specific actions)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:263
|
||
msgid "by clicking on buttons in views (if these are connected to actions)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:264
|
||
msgid "as contextual actions on object"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:266
|
||
msgid "Because menus are somewhat complex to declare there is a ``<menuitem>`` shortcut to declare an ``ir.ui.menu`` and connect it to the corresponding action more easily."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:283
|
||
msgid "The action must be declared before its corresponding menu in the XML file."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:285
|
||
msgid "Data files are executed sequentially, the action's ``id`` must be present in the database before the menu can be created."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:288
|
||
msgid "Define new menu entries"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:290
|
||
msgid "Define new menu entries to access courses under the OpenAcademy menu entry. A user should be able to :"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:293
|
||
msgid "display a list of all the courses"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:294
|
||
msgid "create/modify courses"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:297
|
||
msgid "Basic views"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:299
|
||
msgid "Views define the way the records of a model are displayed. Each type of view represents a mode of visualization (a list of records, a graph of their aggregation, …). Views can either be requested generically via their type (e.g. *a list of partners*) or specifically via their id. For generic requests, the view with the correct type and the lowest priority will be used (so the lowest-priority view of each type is the default view for that type)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:307
|
||
msgid ":ref:`View inheritance <reference/views/inheritance>` allows altering views declared elsewhere (adding or removing content)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:311
|
||
msgid "Generic view declaration"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:313
|
||
msgid "A view is declared as a record of the model ``ir.ui.view``. The view type is implied by the root element of the ``arch`` field:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:327
|
||
msgid "The view's content is XML."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:330
|
||
msgid "The ``arch`` field must thus be declared as ``type=\"xml\"`` to be parsed correctly."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:334
|
||
#: ../../content/developer/howtos/backend.rst:855
|
||
msgid "Tree views"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:336
|
||
msgid "Tree views, also called list views, display records in a tabular form."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:338
|
||
msgid "Their root element is ``<tree>``. The simplest form of the tree view simply lists all the fields to display in the table (each field as a column):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:351
|
||
msgid "Form views"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:353
|
||
msgid "Forms are used to create and edit single records."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:356
|
||
msgid "Their root element is ``<form>``. They are composed of high-level structure elements (groups, notebooks) and interactive elements (buttons and fields):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:385
|
||
msgid "Customise form view using XML"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:387
|
||
msgid "Create your own form view for the Course object. Data displayed should be: the name and the description of the course."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:390
|
||
msgid "Notebooks"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:392
|
||
msgid "In the Course form view, put the description field under a tab, such that it will be easier to add other tabs later, containing additional information."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:396
|
||
msgid "Form views can also use plain HTML for more flexible layouts:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:423
|
||
#: ../../content/developer/howtos/backend.rst:928
|
||
#: ../../content/developer/howtos/backend.rst:970
|
||
msgid "Search views"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:425
|
||
msgid "Search views customize the search field associated with the list view (and other aggregated views). Their root element is ``<search>`` and they're composed of fields defining which fields can be searched on:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:436
|
||
msgid "If no search view exists for the model, Odoo generates one which only allows searching on the ``name`` field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:439
|
||
msgid "Search courses"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:441
|
||
msgid "Allow searching for courses based on their title or their description."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:444
|
||
#: ../../content/developer/howtos/website.rst:644
|
||
msgid "Relations between models"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:446
|
||
msgid "A record from a model may be related to a record from another model. For instance, a sale order record is related to a client record that contains the client data; it is also related to its sale order line records."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:450
|
||
msgid "Create a session model"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:452
|
||
msgid "For the module Open Academy, we consider a model for *sessions*: a session is an occurrence of a course taught at a given time for a given audience."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:455
|
||
msgid "Create a model for *sessions*. A session has a name, a start date, a duration and a number of seats. Add an action and a menu item to display them. Make the new model visible via a menu item."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:460
|
||
#: ../../content/developer/reference/javascript_reference.rst:2053
|
||
msgid "Relational fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:462
|
||
msgid "Relational fields link records, either of the same model (hierarchies) or between different models."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:465
|
||
msgid "Relational field types are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:472
|
||
msgid ":class:`Many2one(other_model, ondelete='set null') <odoo.fields.Many2one>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:468
|
||
msgid "A simple link to an other object::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:472
|
||
msgid "`foreign keys <http://www.postgresql.org/docs/9.3/static/tutorial-fk.html>`_"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:486
|
||
msgid ":class:`One2many(other_model, related_field) <odoo.fields.One2many>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:475
|
||
msgid "A virtual relationship, inverse of a :class:`~odoo.fields.Many2one`. A :class:`~odoo.fields.One2many` behaves as a container of records, accessing it results in a (possibly empty) set of records::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:484
|
||
msgid "Because a :class:`~odoo.fields.One2many` is a virtual relationship, there *must* be a :class:`~odoo.fields.Many2one` field in the :samp:`{other_model}`, and its name *must* be :samp:`{related_field}`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:494
|
||
msgid ":class:`Many2many(other_model) <odoo.fields.Many2many>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:489
|
||
msgid "Bidirectional multiple relationship, any record on one side can be related to any number of records on the other side. Behaves as a container of records, accessing it also results in a possibly empty set of records::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:496
|
||
msgid "Many2one relations"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:498
|
||
msgid "Using a many2one, modify the *Course* and *Session* models to reflect their relation with other models:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:501
|
||
msgid "A course has a *responsible* user; the value of that field is a record of the built-in model ``res.users``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:503
|
||
msgid "A session has an *instructor*; the value of that field is a record of the built-in model ``res.partner``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:505
|
||
msgid "A session is related to a *course*; the value of that field is a record of the model ``openacademy.course`` and is required."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:507
|
||
msgid "Adapt the views."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:509
|
||
msgid "Inverse one2many relations"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:511
|
||
msgid "Using the inverse relational field one2many, modify the models to reflect the relation between courses and sessions."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:514
|
||
msgid "Multiple many2many relations"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:516
|
||
msgid "Using the relational field many2many, modify the *Session* model to relate every session to a set of *attendees*. Attendees will be represented by partner records, so we will relate to the built-in model ``res.partner``. Adapt the views accordingly."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:522
|
||
#: ../../content/developer/reference/javascript_reference.rst:411
|
||
#: ../../content/developer/reference/views.rst:184
|
||
msgid "Inheritance"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:525
|
||
msgid "Model inheritance"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:527
|
||
msgid "Odoo provides two *inheritance* mechanisms to extend an existing model in a modular way."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:530
|
||
msgid "The first inheritance mechanism allows a module to modify the behavior of a model defined in another module:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:533
|
||
msgid "add fields to a model,"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:534
|
||
msgid "override the definition of fields on a model,"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:535
|
||
msgid "add constraints to a model,"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:536
|
||
msgid "add methods to a model,"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:537
|
||
msgid "override existing methods on a model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:539
|
||
msgid "The second inheritance mechanism (delegation) allows to link every record of a model to a record in a parent model, and provides transparent access to the fields of the parent record."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:548
|
||
msgid ":attr:`~odoo.models.Model._inherit`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:549
|
||
msgid ":attr:`~odoo.models.Model._inherits`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:552
|
||
msgid "View inheritance"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:554
|
||
msgid "Instead of modifying existing views in place (by overwriting them), Odoo provides view inheritance where children \"extension\" views are applied on top of root views, and can add or remove content from their parent."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:558
|
||
msgid "An extension view references its parent using the ``inherit_id`` field, and instead of a single view its ``arch`` field is composed of any number of ``xpath`` elements selecting and altering the content of their parent view:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:579
|
||
msgid "``expr``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:579
|
||
msgid "An XPath_ expression selecting a single element in the parent view. Raises an error if it matches no element or more than one"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:595
|
||
msgid "``position``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:582
|
||
msgid "Operation to apply to the matched element:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:584
|
||
msgid "``inside``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:585
|
||
msgid "appends ``xpath``'s body at the end of the matched element"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:587
|
||
#: ../../content/developer/reference/qweb.rst:528
|
||
#: ../../content/developer/reference/views.rst:282
|
||
msgid "``replace``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:587
|
||
msgid "replaces the matched element with the ``xpath``'s body, replacing any ``$0`` node occurrence in the new body with the original element"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:589
|
||
#: ../../content/developer/reference/qweb.rst:522
|
||
#: ../../content/developer/reference/views.rst:288
|
||
msgid "``before``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:590
|
||
msgid "inserts the ``xpath``'s body as a sibling before the matched element"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:591
|
||
#: ../../content/developer/reference/qweb.rst:524
|
||
#: ../../content/developer/reference/views.rst:285
|
||
msgid "``after``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:592
|
||
msgid "inserts the ``xpaths``'s body as a sibling after the matched element"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:595
|
||
#: ../../content/developer/reference/qweb.rst:533
|
||
#: ../../content/developer/reference/views.rst:308
|
||
msgid "``attributes``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:594
|
||
msgid "alters the attributes of the matched element using special ``attribute`` elements in the ``xpath``'s body"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:599
|
||
msgid "When matching a single element, the ``position`` attribute can be set directly on the element to be found. Both inheritances below will give the same result."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:613
|
||
msgid "Alter existing content"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:615
|
||
msgid "Using model inheritance, modify the existing *Partner* model to add an ``instructor`` boolean field, and a many2many field that corresponds to the session-partner relation"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:618
|
||
msgid "Using view inheritance, display this fields in the partner form view"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:621
|
||
msgid "Domains"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:623
|
||
msgid "In Odoo, :ref:`reference/orm/domains` are values that encode conditions on records. A domain is a list of criteria used to select a subset of a model's records. Each criteria is a triple with a field name, an operator and a value."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:627
|
||
msgid "For instance, when used on the *Product* model the following domain selects all *services* with a unit price over *1000*::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:632
|
||
msgid "By default criteria are combined with an implicit AND. The logical operators ``&`` (AND), ``|`` (OR) and ``!`` (NOT) can be used to explicitly combine criteria. They are used in prefix position (the operator is inserted before its arguments rather than between). For instance to select products \"which are services *OR* have a unit price which is *NOT* between 1000 and 2000\"::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:644
|
||
msgid "A ``domain`` parameter can be added to relational fields to limit valid records for the relation when trying to select records in the client interface."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:647
|
||
msgid "Domains on relational fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:649
|
||
msgid "When selecting the instructor for a *Session*, only instructors (partners with ``instructor`` set to ``True``) should be visible."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:652
|
||
msgid "More complex domains"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:654
|
||
msgid "Create new partner categories *Teacher / Level 1* and *Teacher / Level 2*. The instructor for a session can be either an instructor or a teacher (of any level)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:659
|
||
msgid "Computed fields and default values"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:661
|
||
msgid "So far fields have been stored directly in and retrieved directly from the database. Fields can also be *computed*. In that case, the field's value is not retrieved from the database but computed on-the-fly by calling a method of the model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:666
|
||
msgid "To create a computed field, create a field and set its attribute :attr:`~odoo.fields.Field.compute` to the name of a method. The computation method should simply set the value of the field to compute on every record in ``self``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:671
|
||
msgid "``self`` is a collection"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:674
|
||
msgid "The object ``self`` is a *recordset*, i.e., an ordered collection of records. It supports the standard Python operations on collections, like ``len(self)`` and ``iter(self)``, plus extra set operations like ``recs1 + recs2``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:679
|
||
msgid "Iterating over ``self`` gives the records one by one, where each record is itself a collection of size 1. You can access/assign fields on single records by using the dot notation, like ``record.name``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:699
|
||
msgid "Dependencies"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:701
|
||
msgid "The value of a computed field usually depends on the values of other fields on the computed record. The ORM expects the developer to specify those dependencies on the compute method with the decorator :func:`~odoo.api.depends`. The given dependencies are used by the ORM to trigger the recomputation of the field whenever some of its dependencies have been modified::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:720
|
||
msgid "Computed fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:722
|
||
msgid "Add the percentage of taken seats to the *Session* model"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:723
|
||
msgid "Display that field in the tree and form views"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:724
|
||
msgid "Display the field as a progress bar"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:727
|
||
msgid "Default values"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:729
|
||
msgid "Any field can be given a default value. In the field definition, add the option ``default=X`` where ``X`` is either a Python literal value (boolean, integer, float, string), or a function taking a recordset and returning a value::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:738
|
||
msgid "The object ``self.env`` gives access to request parameters and other useful things:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:741
|
||
msgid "``self.env.cr`` or ``self._cr`` is the database *cursor* object; it is used for querying the database"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:743
|
||
msgid "``self.env.uid`` or ``self._uid`` is the current user's database id"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:744
|
||
msgid "``self.env.user`` is the current user's record"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:745
|
||
msgid "``self.env.context`` or ``self._context`` is the context dictionary"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:746
|
||
msgid "``self.env.ref(xml_id)`` returns the record corresponding to an XML id"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:747
|
||
msgid "``self.env[model_name]`` returns an instance of the given model"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:749
|
||
msgid "Active objects – Default values"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:751
|
||
msgid "Define the start_date default value as today (see :class:`~odoo.fields.Date`)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:753
|
||
msgid "Add a field ``active`` in the class Session, and set sessions as active by default."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:757
|
||
msgid "Onchange"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:759
|
||
msgid "The \"onchange\" mechanism provides a way for the client interface to update a form whenever the user has filled in a value in a field, without saving anything to the database."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:763
|
||
msgid "For instance, suppose a model has three fields ``amount``, ``unit_price`` and ``price``, and you want to update the price on the form when any of the other fields is modified. To achieve this, define a method where ``self`` represents the record in the form view, and decorate it with :func:`~odoo.api.onchange` to specify on which field it has to be triggered. Any change you make on ``self`` will be reflected on the form."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:792
|
||
msgid "For computed fields, valued ``onchange`` behavior is built-in as can be seen by playing with the *Session* form: change the number of seats or participants, and the ``taken_seats`` progressbar is automatically updated."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:796
|
||
msgid "Warning"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:798
|
||
msgid "Add an explicit onchange to warn about invalid values, like a negative number of seats, or more participants than seats."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:802
|
||
msgid "Model constraints"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:804
|
||
msgid "Odoo provides two ways to set up automatically verified invariants: :func:`Python constraints <odoo.api.constrains>` and :attr:`SQL constraints <odoo.models.Model._sql_constraints>`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:808
|
||
msgid "A Python constraint is defined as a method decorated with :func:`~odoo.api.constrains`, and invoked on a recordset. The decorator specifies which fields are involved in the constraint, so that the constraint is automatically evaluated when one of them is modified. The method is expected to raise an exception if its invariant is not satisfied::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:823
|
||
msgid "Add Python constraints"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:825
|
||
msgid "Add a constraint that checks that the instructor is not present in the attendees of his/her own session."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:828
|
||
msgid "SQL constraints are defined through the model attribute :attr:`~odoo.models.Model._sql_constraints`. The latter is assigned to a list of triples of strings ``(name, sql_definition, message)``, where ``name`` is a valid SQL constraint name, ``sql_definition`` is a table_constraint_ expression, and ``message`` is the error message."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:834
|
||
msgid "Add SQL constraints"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:836
|
||
msgid "With the help of `PostgreSQL's documentation`_ , add the following constraints:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:839
|
||
msgid "CHECK that the course description and the course title are different"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:840
|
||
msgid "Make the Course's name UNIQUE"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:842
|
||
msgid "Exercise 6 - Add a duplicate option"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:844
|
||
msgid "Since we added a constraint for the Course name uniqueness, it is not possible to use the \"duplicate\" function anymore (:menuselection:`Form --> Duplicate`)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:848
|
||
msgid "Re-implement your own \"copy\" method which allows to duplicate the Course object, changing the original name into \"Copy of [original name]\"."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:852
|
||
msgid "Advanced Views"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:857
|
||
msgid "Tree views can take supplementary attributes to further customize their behavior:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:885
|
||
#: ../../content/developer/reference/views.rst:978
|
||
#: ../../content/developer/reference/views.rst:1411
|
||
#: ../../content/developer/reference/views.rst:1532
|
||
msgid "``decoration-{$name}``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:861
|
||
#: ../../content/developer/reference/views.rst:965
|
||
#: ../../content/developer/reference/views.rst:1407
|
||
msgid "allow changing the style of a row's text based on the corresponding record's attributes."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:864
|
||
#: ../../content/developer/reference/views.rst:104
|
||
#: ../../content/developer/reference/views.rst:968
|
||
msgid "Values are Python expressions. For each record, the expression is evaluated with the record's attributes as context values and if ``true``, the corresponding style is applied to the row. Here are some of the other values available in the context:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:869
|
||
#: ../../content/developer/reference/views.rst:109
|
||
#: ../../content/developer/reference/views.rst:973
|
||
msgid "``uid``: the id of the current user,"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:870
|
||
#: ../../content/developer/reference/views.rst:110
|
||
#: ../../content/developer/reference/views.rst:974
|
||
msgid "``today``: the current local date as a string of the form ``YYYY-MM-DD``,"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:871
|
||
#: ../../content/developer/reference/views.rst:111
|
||
#: ../../content/developer/reference/views.rst:975
|
||
msgid "``now``: same as ``today`` with the addition of the current time. This value is formatted as ``YYYY-MM-DD hh:mm:ss``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:874
|
||
msgid "``{$name}`` can be ``bf`` (``font-weight: bold``), ``it`` (``font-style: italic``), or any `bootstrap contextual color <https://getbootstrap.com/docs/3.3/components/#available-variations>`_ (``danger``, ``info``, ``muted``, ``primary``, ``success`` or ``warning``)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:890
|
||
#: ../../content/developer/reference/views.rst:1391
|
||
msgid "``editable``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:888
|
||
msgid "Either ``\"top\"`` or ``\"bottom\"``. Makes the tree view editable in-place (rather than having to go through the form view), the value is the position where new rows appear."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:892
|
||
msgid "List coloring"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:894
|
||
msgid "Modify the Session tree 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."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:899
|
||
msgid "Calendars"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:901
|
||
msgid "Displays records as calendar events. Their root element is ``<calendar>`` and their most common attributes are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:907
|
||
#: ../../content/developer/reference/views.rst:410
|
||
#: ../../content/developer/reference/views.rst:962
|
||
#: ../../content/developer/reference/views.rst:1342
|
||
msgid "``color``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:905
|
||
msgid "The name of the field used for *color segmentation*. Colors are automatically distributed to events, but events in the same color segment (records which have the same value for their ``@color`` field) will be given the same color."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:909
|
||
msgid "``date_start``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:910
|
||
msgid "record's field holding the start date/time for the event"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:911
|
||
msgid "``date_stop`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:912
|
||
msgid "record's field holding the end date/time for the event"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:914
|
||
#: ../../content/developer/reference/views.rst:897
|
||
#: ../../content/developer/reference/views.rst:1017
|
||
#: ../../content/developer/reference/views.rst:1435
|
||
#: ../../content/developer/reference/views.rst:1493
|
||
#: ../../content/developer/reference/views.rst:1682
|
||
#: ../../content/developer/reference/views.rst:1727
|
||
#: ../../content/developer/reference/views.rst:1843
|
||
msgid "``string``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:914
|
||
msgid "record's field to define the label for each calendar event"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:922
|
||
msgid "Calendar view"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:924
|
||
msgid "Add a Calendar view to the *Session* model enabling the user to view the events associated to the Open Academy."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:930
|
||
msgid "Search view ``<field>`` elements can have a ``@filter_domain`` that overrides the domain generated for searching on the given field. In the given domain, ``self`` represents the value entered by the user. In the example below, it is used to search on both fields ``name`` and ``description``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:935
|
||
msgid "Search views can also contain ``<filter>`` elements, which act as toggles for predefined searches. Filters must have one of the following attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:938
|
||
#: ../../content/developer/reference/views.rst:850
|
||
#: ../../content/developer/reference/views.rst:1801
|
||
#: ../../content/developer/reference/views.rst:1878
|
||
msgid "``domain``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:939
|
||
msgid "add the given domain to the current search"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:942
|
||
#: ../../content/developer/howtos/web.rst:1707
|
||
#: ../../content/developer/reference/data.rst:72
|
||
#: ../../content/developer/reference/views.rst:852
|
||
#: ../../content/developer/reference/views.rst:1273
|
||
#: ../../content/developer/reference/views.rst:1481
|
||
#: ../../content/developer/reference/views.rst:1606
|
||
#: ../../content/developer/reference/views.rst:1803
|
||
#: ../../content/developer/reference/views.rst:1871
|
||
#: ../../content/developer/reference/views.rst:1973
|
||
msgid "``context``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:941
|
||
msgid "add some context to the current search; use the key ``group_by`` to group results on the given field name"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:961
|
||
msgid "To use a non-default search view in an action, it should be linked using the ``search_view_id`` field of the action record."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:964
|
||
msgid "The action can also set default values for search fields through its ``context`` field: context keys of the form :samp:`search_default_{field_name}` will initialize *field_name* with the provided value. Search filters must have an optional ``@name`` to have a default and behave as booleans (they can only be enabled by default)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:972
|
||
msgid "Add a button to filter the courses for which the current user is the responsible in the course search view. Make it selected by default."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:974
|
||
msgid "Add a button to group courses by responsible user."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:977
|
||
#: ../../content/developer/reference/views.rst:945
|
||
msgid "Gantt"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:981
|
||
msgid "The gantt view requires the web_gantt module which is present in :ref:`the enterprise edition <setup/install/editions>` version."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:984
|
||
msgid "Horizontal bar charts typically used to show project planning and advancement, their root element is ``<gantt>``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:995
|
||
msgid "Gantt charts"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:997
|
||
msgid "Add a Gantt Chart enabling the user to view the sessions scheduling linked to the Open Academy module. The sessions should be grouped by instructor."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1001
|
||
msgid "Graph views"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1003
|
||
msgid "Graph views allow aggregated overview and analysis of models, their root element is ``<graph>``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1007
|
||
msgid "Pivot views (element ``<pivot>``) a multidimensional table, allows the selection of filers and dimensions to get the right aggregated dataset before moving to a more graphical overview. The pivot view shares the same content definition as graph views."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1012
|
||
msgid "Graph views have 4 display modes, the default mode is selected using the ``@type`` attribute."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1019
|
||
msgid "Bar (default)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1016
|
||
msgid "a bar chart, the first dimension is used to define groups on the horizontal axis, other dimensions define aggregated bars within each group."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1019
|
||
msgid "By default bars are side-by-side, they can be stacked by using ``@stacked=\"True\"`` on the ``<graph>``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1021
|
||
msgid "Line"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1022
|
||
msgid "2-dimensional line chart"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1024
|
||
msgid "Pie"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1024
|
||
msgid "2-dimensional pie"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1026
|
||
msgid "Graph views contain ``<field>`` with a mandatory ``@type`` attribute taking the values:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1029
|
||
#: ../../content/developer/reference/views.rst:1151
|
||
#: ../../content/developer/reference/views.rst:1733
|
||
msgid "``row`` (default)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1030
|
||
msgid "the field should be aggregated by default"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1032
|
||
#: ../../content/developer/reference/views.rst:1156
|
||
#: ../../content/developer/reference/views.rst:1737
|
||
msgid "``measure``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1032
|
||
msgid "the field should be aggregated rather than grouped on"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1043
|
||
msgid "Graph views perform aggregations on database values, they do not work with non-stored computed fields."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1046
|
||
msgid "Graph view"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1048
|
||
msgid "Add a Graph view in the Session object that displays, for each course, the number of attendees under the form of a bar chart."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1052
|
||
#: ../../content/developer/reference/views.rst:1175
|
||
msgid "Kanban"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1054
|
||
msgid "Used to organize tasks, production processes, etc… their root element is ``<kanban>``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1057
|
||
msgid "A kanban view shows a set of cards possibly grouped in columns. Each card represents a record, and each column the values of an aggregation field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1060
|
||
msgid "For instance, project tasks may be organized by stage (each column is a stage), or by responsible (each column is a user), and so on."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1063
|
||
msgid "Kanban views define the structure of each card as a mix of form elements (including basic HTML) and :ref:`reference/qweb`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1066
|
||
msgid "Kanban view"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1068
|
||
msgid "Add a Kanban view that displays sessions grouped by course (columns are thus courses)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1072
|
||
msgid "Security"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1074
|
||
msgid "Access control mechanisms must be configured to achieve a coherent security policy."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1078
|
||
msgid "Group-based access control mechanisms"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1080
|
||
msgid "Groups are created as normal records on the model ``res.groups``, and granted menu access via menu definitions. However even without a menu, objects may still be accessible indirectly, so actual object-level permissions (read, write, create, unlink) must be defined for groups. They are usually inserted via CSV files inside modules. It is also possible to restrict access to specific fields on a view or object using the field's groups attribute."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1088
|
||
msgid "Access rights"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1090
|
||
msgid "Access rights are defined as records of the model ``ir.model.access``. Each access right is associated to a model, a group (or no group for global access), and a set of permissions: read, write, create, unlink. Such access rights are usually created by a CSV file named after its model: ``ir.model.access.csv``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1102
|
||
msgid "Add access control through the Odoo interface"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1104
|
||
msgid "Create a new user \"John Smith\". Then create a group \"OpenAcademy / Session Read\" with read access to the *Session* model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1107
|
||
msgid "Add access control through data files in your module"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1109
|
||
msgid "Using data files,"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1111
|
||
msgid "Create a group *OpenAcademy / Manager* with full access to all OpenAcademy models"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1113
|
||
msgid "Make *Session* and *Course* readable by all users"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1116
|
||
msgid "Record rules"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1118
|
||
msgid "A record rule restricts the access rights to a subset of records of the given model. A rule is a record of the model ``ir.rule``, and is associated to a model, a number of groups (many2many field), permissions to which the restriction applies, and a domain. The domain specifies to which records the access rights are limited."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1124
|
||
msgid "Here is an example of a rule that prevents the deletion of leads that are not in state ``cancel``. Notice that the value of the field ``groups`` must follow the same convention as the method :meth:`~odoo.models.Model.write` of the ORM."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1141
|
||
msgid "Record rule"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1143
|
||
msgid "Add a record rule for the model Course and the group \"OpenAcademy / Manager\", that restricts ``write`` and ``unlink`` accesses to the responsible of a course. If a course has no responsible, all users of the group must be able to modify it."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1151
|
||
msgid "Wizards"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1153
|
||
msgid "Wizards describe interactive sessions with the user (or dialog boxes) through dynamic forms. A wizard is simply a model that extends the class :class:`~odoo.models.TransientModel` instead of :class:`~odoo.models.Model`. The class :class:`~odoo.models.TransientModel` extends :class:`~odoo.models.Model` and reuse all its existing mechanisms, with the following particularities:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1160
|
||
msgid "Wizard records are not meant to be persistent; they are automatically deleted from the database after a certain time. This is why they are called *transient*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1163
|
||
msgid "Wizard records may refer to regular records or wizard records through relational fields(many2one or many2many), but regular records *cannot* refer to wizard records through a many2one field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1167
|
||
msgid "We want to create a wizard that allow users to create attendees for a particular session, or for a list of sessions at once."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1170
|
||
msgid "Define the wizard"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1172
|
||
msgid "Create a wizard model with a many2one relationship with the *Session* model and a many2many relationship with the *Partner* model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1176
|
||
msgid "Launching wizards"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1178
|
||
msgid "Wizards are simply :ref:`window actions <howtos/module/actions>` with a ``target`` field set to the value ``new``, which opens the view (usually :ref:`a form <howtos/module/views/form>`) in a separate dialog. The action may be triggered via a menu item, but is more generally triggered by a button."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1184
|
||
msgid "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 action. Setting this field will make the action appear on the views of the model the action is \"bound\" to."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1201
|
||
msgid "While wizards use regular views and buttons, normally clicking any button in a form would first save the form then close the dialog. Because this is often undesirable in wizards, a special attribute ``special=\"cancel\"`` is available which immediately closes the wizard without saving the form."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1206
|
||
msgid "Launch the wizard"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1208
|
||
msgid "Define a form view for the wizard."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1209
|
||
msgid "Add the action to launch it in the context of the *Session* model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1210
|
||
msgid "Define a default value for the session field in the wizard; use the context parameter ``self._context`` to retrieve the current session."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1213
|
||
msgid "Register attendees"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1215
|
||
msgid "Add buttons to the wizard, and implement the corresponding method for adding the attendees to the given session."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1218
|
||
msgid "Register attendees to multiple sessions"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1220
|
||
msgid "Modify the wizard model so that attendees can be registered to multiple sessions."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1224
|
||
msgid "Internationalization"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1226
|
||
msgid "Each module can provide its own translations within the i18n directory, by having files named LANG.po where LANG is the locale code for the language, or the language and country combination when they differ (e.g. pt.po or pt_BR.po). Translations will be loaded automatically by Odoo for all enabled languages. Developers always use English when creating a module, then export the module terms using Odoo's gettext POT export feature (:menuselection:`Settings --> Translations --> Import/Export --> Export Translation` without specifying a language), to create the module template POT file, and then derive the translated PO files. Many IDE's have plugins or modes for editing and merging PO/POT files."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1237
|
||
msgid "The Portable Object files generated by Odoo are published on `Transifex <https://www.transifex.com/odoo/public/>`__, making it easy to translate the software."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1252
|
||
msgid "By default Odoo's POT export only extracts labels inside XML files or inside field definitions in Python code, but any Python string can be translated this way by surrounding it with the function :func:`odoo._` (e.g. ``_(\"Label\")``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1257
|
||
msgid "Translate a module"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1259
|
||
msgid "Choose a second language for your Odoo installation. Translate your module using the facilities provided by Odoo."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1263
|
||
msgid "Reporting"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1266
|
||
msgid "Printed reports"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1268
|
||
msgid "Odoo uses a report engine based on :ref:`reference/qweb`, `Twitter Bootstrap`_ and Wkhtmltopdf_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1271
|
||
msgid "A report is a combination two elements:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1273
|
||
msgid "an ``ir.actions.report`` which configures various basic parameters for the report (default type, whether the report should be saved to the database after generation,…)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1294
|
||
msgid "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 ``binding_model_id`` field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1299
|
||
msgid "Here we are also using ``binding_type`` in order for the report to be in the *report* contextual menu rather than the *action* one. There is no technical difference but putting elements in the right place helps users."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1303
|
||
msgid "A standard :ref:`QWeb view <reference/views/qweb>` for the actual report:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1317
|
||
msgid "the standard rendering context provides a number of elements, the most important being:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1320
|
||
#: ../../content/developer/reference/reports.rst:70
|
||
msgid "``docs``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1321
|
||
msgid "the records for which the report is printed"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1323
|
||
#: ../../content/developer/reference/reports.rst:31
|
||
msgid "``user``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1323
|
||
msgid "the user printing the report"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1325
|
||
msgid "Because reports are standard web pages, they are available through a URL and output parameters can be manipulated through this URL, for instance the HTML version of the *Invoice* report is available through http://localhost:8069/report/html/account.report_invoice/1 (if ``account`` is installed) and the PDF version through http://localhost:8069/report/pdf/account.report_invoice/1."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1336
|
||
msgid "If it appears that your PDF report is missing the styles (i.e. the text appears but the style/layout is different from the html version), probably your wkhtmltopdf_ process cannot reach your web server to download them."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1340
|
||
msgid "If you check your server logs and see that the CSS styles are not being downloaded when generating a PDF report, most surely this is the problem."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1343
|
||
msgid "The wkhtmltopdf_ process will use the ``web.base.url`` system parameter as the *root path* to all linked files, but this parameter is automatically updated each time the Administrator is logged in. If your server resides behind some kind of proxy, that could not be reachable. You can fix this by adding one of these system parameters:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1349
|
||
msgid "``report.url``, pointing to an URL reachable from your server (probably ``http://localhost:8069`` or something similar). It will be used for this particular purpose only."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1353
|
||
msgid "``web.base.url.freeze``, when set to ``True``, will stop the automatic updates to ``web.base.url``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1356
|
||
msgid "Create a report for the Session model"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1358
|
||
msgid "For each session, it should display session's name, its start and end, and list the session's attendees."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1362
|
||
msgid "Dashboards"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1364
|
||
msgid "Define a Dashboard"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1366
|
||
msgid "Define a dashboard containing the graph view you created, the sessions calendar view and a list view of the courses (switchable to a form view). This dashboard should be available through a menuitem in the menu, and automatically displayed in the web client when the OpenAcademy main menu is selected."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1373
|
||
msgid "WebServices"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1375
|
||
msgid "The web-service module offer a common interface for all web-services :"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1377
|
||
msgid "XML-RPC"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1378
|
||
msgid "JSON-RPC"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1380
|
||
msgid "Business objects can also be accessed via the distributed object mechanism. They can all be modified via the client interface with contextual views."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1384
|
||
msgid "Odoo is accessible through XML-RPC/JSON-RPC interfaces, for which libraries exist in many languages."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1388
|
||
msgid "XML-RPC Library"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1390
|
||
msgid "The following example is a Python 3 program that interacts with an Odoo server with the library ``xmlrpc.client``::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1409
|
||
msgid "Add a new service to the client"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1411
|
||
msgid "Write a Python program able to send XML-RPC requests to a PC running Odoo (yours, or your instructor's). This program should display all the sessions, and their corresponding number of seats. It should also create a new session for one of the courses."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1447
|
||
msgid "Instead of using a hard-coded course id, the code can look up a course by name::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1458
|
||
msgid "JSON-RPC Library"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1460
|
||
msgid "The following example is a Python 3 program that interacts with an Odoo server with the standard Python libraries ``urllib.request`` and ``json``. This example assumes the **Productivity** app (``note``) is installed::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1504
|
||
msgid "Examples can be easily adapted from XML-RPC to JSON-RPC."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1508
|
||
msgid "There are a number of high-level APIs in various languages to access Odoo systems without *explicitly* going through XML-RPC or JSON-RPC, such as:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1511
|
||
msgid "https://github.com/akretion/ooor"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1512
|
||
msgid "https://github.com/OCA/odoorpc"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1513
|
||
msgid "https://github.com/nicolas-van/openerp-client-lib"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1514
|
||
msgid "http://pythonhosted.org/OdooRPC"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1515
|
||
msgid "https://github.com/abhishek-jaiswal/php-openerp-lib"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1517
|
||
msgid "it is possible to :ref:`disable the automatic creation of some fields <reference/fields/automatic/log_access>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/backend.rst:1519
|
||
msgid "writing raw SQL queries is possible, but requires care as it bypasses all Odoo authentication and security mechanisms."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:6
|
||
msgid "Multi-company Guidelines"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:10
|
||
msgid "This tutorial requires good knowledge of Odoo. Please refer to the :ref:`basic tutorial <howto/base>` first if needed."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:13
|
||
msgid "As of version 13.0, a user can be logged in multiple companies at once. This allows the user to access information from multiple companies but also to create/edit records in a multi-company environment."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:17
|
||
msgid "If not handled correctly, it may be the source of a lot of inconsistent multi-company behaviors. For instance, a user logged in both companies A and B could create a sales order in company A and add products belonging to company B to it. It is only when the user will log out from company B that access errors will occur for the sales order."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:22
|
||
msgid "To correctly manage multi-company behaviors, Odoo's ORM provides multiple features:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:24
|
||
msgid ":ref:`Company-dependent fields <howto/company/company_dependent>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:25
|
||
msgid ":ref:`Multi-company consistency <howto/company/check_company>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:26
|
||
msgid ":ref:`Default company <howto/company/default_company>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:27
|
||
msgid ":ref:`Views <howto/company/views>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:28
|
||
msgid ":ref:`Security rules <howto/company/security>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:33
|
||
msgid "Company-dependent fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:35
|
||
msgid "When a record is available from multiple companies, we must expect that different values will be assigned to a given field depending on the company from which the value is set."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:38
|
||
msgid "For the field of a same record to support several values, it must be defined with the attribute `company_dependent` set to `True`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:57
|
||
msgid "The `_compute_display_info` method is decorated with `depends_context('company')` (see :attr:`~odoo.api.depends_context`) to ensure that the computed field is recomputed depending on the current company (`self.env.company`)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:61
|
||
msgid "When a company-dependent field is read, the current company is used to retrieve its value. In other words, if a user is logged in companies A and B with A as main company and creates a record for company B, the values of company-dependent fields will be that of company A."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:65
|
||
msgid "To read the values of company-dependent fields set from another company than the current one, we need to ensure the company we are using is the correct one. This can be done with :meth:`~odoo.models.Model.with_company`, which updates the current company."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:80
|
||
msgid "Whenever you are computing/creating/... things that may behave differently in different companies, you should make sure whatever you are doing is done in the right company. It doesn't cost much to always use `with_company` to avoid problems later on."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:101
|
||
msgid "Multi-company consistency"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:103
|
||
msgid "When a record is made shareable between several companies by the mean of a `company_id` field, we must take care that it cannot be linked to the record of another company through a relational field. For instance, we do not want to have a sales order and its invoice belonging to different companies."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:107
|
||
msgid "To ensure this multi-company consistency, you must:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:109
|
||
msgid "Set the class attribute `_check_company_auto` to `True`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:110
|
||
msgid "Define relational fields with the attribute `check_company` set to `True` if their model has a `company_id` field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:113
|
||
msgid "On each :meth:`~odoo.models.Model.create` and :meth:`~odoo.models.Model.write`, automatic checks will be triggered to ensure the multi-company consistency of the record."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:127
|
||
msgid "The field `company_id` must not be defined with `check_company=True`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:132
|
||
msgid "The `check_company` feature performs a strict check ! It means that if a record has no `company_id` (i.e. the field is not required), it cannot be linked to a record whose `company_id` is set."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:138
|
||
msgid "When no domain is defined on the field and `check_company` is set to `True`, a default domain is added: `['|', '('company_id', '=', False), ('company_id', '=', company_id)]`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:144
|
||
msgid "Default company"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:146
|
||
msgid "When the field `company_id` is made required on a model, a good practice is to set a default company. It eases the setup flow for the user or even guarantees its validity when the company is hidden from the view. Indeed, the company is usually hidden if the user does not have access to multiple companies (i.e. when the user does not have the group `base.group_multi_company`)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:168
|
||
#: ../../content/developer/reference/javascript_reference.rst:1421
|
||
#: ../../content/developer/reference/views.rst:6
|
||
msgid "Views"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:170
|
||
msgid "As stated in :ref:`above <howto/company/default_company>`, the company is usually hidden from the view if the user does not have access to multiple companies. This is tested with the group `base.group_multi_company`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:197
|
||
msgid "Security rules"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:199
|
||
msgid "When working with records shared across companies or restricted to a single company, we must take care that a user does not have access to records belonging to other companies."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:202
|
||
msgid "This is achieved with security rules based on `company_ids`, which contains the current companies of the user (the companies the user checked in the multi-company widget)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:229
|
||
#: ../../content/developer/howtos/web.rst:134
|
||
#: ../../content/developer/howtos/web.rst:1875
|
||
#: ../../content/developer/howtos/website.rst:490
|
||
#: ../../content/developer/reference/actions.rst:176
|
||
#: ../../content/developer/reference/orm.rst:605
|
||
#: ../../content/developer/reference/orm.rst:607
|
||
#: ../../content/developer/reference/orm.rst:722
|
||
#: ../../content/developer/reference/orm.rst:879
|
||
#: ../../content/developer/reference/qweb.rst:340
|
||
#: ../../content/developer/reference/qweb.rst:421
|
||
#: ../../content/developer/reference/security.rst:91
|
||
#: ../../content/developer/reference/translations.rst:21
|
||
#: ../../content/developer/reference/views.rst:13
|
||
#: ../../content/developer/reference/views.rst:70
|
||
#: ../../content/developer/reference/views.rst:81
|
||
#: ../../content/developer/reference/views.rst:179
|
||
#: ../../content/developer/reference/views.rst:241
|
||
#: ../../content/developer/reference/views.rst:818
|
||
#: ../../content/developer/reference/views.rst:938
|
||
#: ../../content/developer/reference/views.rst:940
|
||
#: ../../content/developer/reference/views.rst:1221
|
||
#: ../../content/developer/reference/views.rst:1300
|
||
#: ../../content/developer/reference/views.rst:1316
|
||
#: ../../content/developer/reference/views.rst:1483
|
||
#: ../../content/developer/reference/views.rst:2125
|
||
#: ../../content/developer/webservices/iap.rst:121
|
||
#: ../../content/developer/webservices/iap.rst:225
|
||
#: ../../content/developer/webservices/iap.rst:407
|
||
#: ../../content/developer/webservices/iap.rst:409
|
||
#: ../../content/developer/webservices/iap.rst:510
|
||
#: ../../content/developer/webservices/odoo.rst:400
|
||
#: ../../content/developer/webservices/odoo.rst:996
|
||
#: ../../content/developer/webservices/odoo.rst:1187
|
||
msgid "Todo"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/company.rst:229
|
||
msgid "check_company on company_dependent fields."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/profilecode.rst:3
|
||
msgid "Profiling Odoo code"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/profilecode.rst:7
|
||
msgid "This tutorial requires :ref:`having installed Odoo <setup/install>` and :doc:`writing Odoo code <backend>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/profilecode.rst:11
|
||
msgid "Graph a method"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/profilecode.rst:13
|
||
msgid "Odoo embeds a profiler of code. This embedded profiler output can be used to generate a graph of calls triggered by the method, number of queries, percentage of time taken in the method itself as well as the time that the method took and its sub-called methods."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/profilecode.rst:25
|
||
msgid "This produces a file called /temp/prof.profile"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/profilecode.rst:27
|
||
msgid "A tool called *gprof2dot* will produce a graph with this result:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/profilecode.rst:33
|
||
msgid "A tool called *xdot* will display the resulting graph:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/profilecode.rst:40
|
||
msgid "Log a method"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/profilecode.rst:42
|
||
msgid "Another profiler can be used to log statistics on a method:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/profilecode.rst:52
|
||
msgid "The statistics will be displayed into the logs once the method to be analysed is completely reviewed."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/profilecode.rst:83
|
||
msgid "Dump stack"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/profilecode.rst:85
|
||
msgid "Sending the SIGQUIT signal to an Odoo process (only available on POSIX) makes this process output the current stack trace to log, with info level. When an odoo process seems stucked, sending this signal to the process permit to know what the process is doing, and letting the process continue his job."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/profilecode.rst:91
|
||
msgid "Tracing code execution"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/profilecode.rst:93
|
||
msgid "Instead of sending the SIGQUIT signal to an Odoo process often enough, to check where the processes are performing worse than expected, we can use the `py-spy`_ tool to do it for us."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/profilecode.rst:98
|
||
msgid "Install py-spy"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/profilecode.rst:105
|
||
msgid "Record executed code"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/profilecode.rst:107
|
||
msgid "As py-spy is installed, we now record the executed code lines. This tool will record, multiple times a second, the stacktrace of the process."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/profilecode.rst:118
|
||
msgid "where <PID> is the process ID of the odoo process you want to graph."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/profilecode.rst:120
|
||
msgid "To open profile.json you can use online tool `speedscope.app`_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/profilecode.rst:122
|
||
msgid "To open profile.svg you should use browser, because other viewer may not support interactive part."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:4
|
||
msgid "Theme Tutorial"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:8
|
||
msgid "This tutorial provides a great overview of what you can do creating an Odoo theme. It is however incomplete. We are currently working on a new detailed theme tutorial, come back here soon to unleash the true power of Odoo themes!"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:15
|
||
msgid "Odoo celebrates freedom. Freedom for the designer to go further and freedom for the user to customize everything according to their needs."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:18
|
||
msgid "Ready to create your own theme? Great. Here are some things you should know before you begin. This tutorial is a guide to creating an Odoo theme."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:24
|
||
msgid "An introduction for web designers"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:26
|
||
msgid "If you are a web designer using Odoo for the first time, you are in the right place. This introduction will outline the basics of Odoo theme creation. Odoo’s team has created a framework that’s powerful and easy to use."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:30
|
||
msgid "From common CMS to Odoo"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:34
|
||
msgid "If you always think and work in the same way, you’ll probably get the same results. If you want something completely new, then try something different."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:38
|
||
msgid "Where is my header.php file?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:40
|
||
msgid "This is usually the first question from a web designer used to working with Wordpress or Joomla and coming to Odoo for the first time."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:50
|
||
msgid "Indeed, when using common CMSs, you have to code several files (like header.php, page.php, post.php, etc.) in order to create a basic structure for your website. With those systems, this base structure acts as a design foundation that you have to update over time to ensure compatibility within your CMS. So, even after you have spent hours coding the files, you have not even started on the design yet."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:52
|
||
msgid "This **does not** apply to creating Odoo themes."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:56
|
||
msgid "We think that theme design should be simple (and powerful). When we created our Website Builder, we decided to start from scratch instead of relying on what already existed. This approach gave us the freedom to focus on the things that are really important for designers: styles, content and the logic behind them. No more struggling with technical stuff."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:59
|
||
msgid "Odoo default theme structure"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:65
|
||
msgid "Odoo comes with a default website structure. It is a very basic “theme” that provides minimal structure and layout. When you create a new theme, you are actually **extending** this. Indeed it’s always enabled in your setup and it acts exactly like the CMS’s base structure we mentioned above, except that you don’t have to create or maintain it. It will upgrade automatically within your Odoo installation and, since it is included in the Website Builder module, everything is smoothly integrated by default."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:70
|
||
msgid "As a result, you are totally free to focus on design while this structure does the job of providing integrations and functionality."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:80
|
||
msgid "**Main features:**"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:82
|
||
msgid "Basic layouts for pages, blog, eCommerce and much more"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:83
|
||
msgid "Website Builder integration"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:84
|
||
msgid "Basic Snippets"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:85
|
||
msgid "Automatic Sass compiling"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:86
|
||
msgid "Automatic Js and CSS minification and combination"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:90
|
||
msgid "**Main technologies:**"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:92
|
||
msgid "Twitter Bootstrap"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:93
|
||
msgid "jQuery"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:94
|
||
msgid "jQuery UI"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:95
|
||
msgid "underscore.js"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:98
|
||
msgid "Thinking \"modular\""
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:100
|
||
msgid "An Odoo theme is not a folder containing HTML or PHP files, it’s a modular framework written in XML. Never worked with XML files before? Don’t worry, after following the tutorial, you’ll be able to create your first theme with only basic knowledge of HTML."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:102
|
||
msgid "Using classical web design workflows, you usually code the layout of the entire page. The result of this is a “static” web page. You can update the content, of course, but your client will need you to work on making even basic changes."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:104
|
||
msgid "Creating themes for Odoo is a total change of perspective. Instead of defining the complete layout for a page, you can create blocks (snippets) and let the user choose where to “drag&drop” them, creating the page layout on their own. We call this modular design."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:107
|
||
msgid "Imagine an Odoo theme as a “list” of elements and options that you have to create or extend. As a designer, your goal is to style these elements in order to achieve a wonderful result, regardless of where the end user chooses to place them."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:110
|
||
msgid "Let’s take a tour of our “list” elements:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:117
|
||
msgid "Snippets (or building-blocks)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:119
|
||
msgid "A piece of HTML code. The user will drag&drop, modify and combine them using our built-in Website Builder interface. You can define sets of options and styles for each snippet. The user will choose from them according to their needs."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:124
|
||
msgid "Pages"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:126
|
||
msgid "These are normal web pages, except that they will be editable by the final user and that you can define an empty area that the user can “fill” by dragging snippets into it."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:137
|
||
msgid "Styles"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:139
|
||
msgid "Styles are defined using SCSS files (or you can use standard CSS files). You can define a style as **default** or **optional**. The default styles are always active in your theme, the optional styles can be enabled or disabled by the user."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:144
|
||
msgid "Functionalities"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:146
|
||
msgid "Thanks to Odoo’s modularity, everything can be personalized even more. This means there are endless possibilities for your creativity. Adding functionalities is easy and it’s simple to provide the end user with customizable options."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:150
|
||
msgid "Odoo's XML files, an overview"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:152
|
||
msgid "Any Odoo XML file starts with encoding specifications. After that, you have to write your code inside a ``<odoo>`` tag."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:165
|
||
msgid "Almost every element and option that you create has to be placed inside a ``<template>`` tag, like in this example."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:177
|
||
msgid "don't misunderstand what ``template`` means. A template tag only defines a piece of html code or options - but it does not necessarily coincide with a visual arrangement of elements."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:181
|
||
msgid "The previous code defines a title, but it will not be displayed anywhere because that *template* is not associated with any part of the **Odoo default structure**. In order to do that you can use **xpath**, **qWeb** or a combination of both."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:186
|
||
msgid "Keep reading the tutorial to learn to how properly extend it with your own code."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:190
|
||
msgid "Create a theme module"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:192
|
||
msgid "Odoo’s themes are packaged like modules. Even if you are designing a very simple website for your company or client, you need to package the theme like an Odoo module."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:196
|
||
msgid "``main folder``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:195
|
||
msgid "Create a folder and name it like this: ``theme_`` followed by your theme's name."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:201
|
||
msgid "``__manifest__.py``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:199
|
||
msgid "Create an empty document and save it to your folder as ``__manifest__.py``. This will contain the configuration info for your theme."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:205
|
||
msgid "``__init__.py``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:204
|
||
msgid "Create another empty file and name it ``__init__.py``. It's a mandatory system file. Create and leave it blank."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:211
|
||
msgid "``views`` and ``static`` folders"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:208
|
||
msgid "Create them in the main folder. In ``views`` you'll place your xml files that define your snippets, your pages and your options. ``static`` folder is the right place for your style , images and custom js code."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:215
|
||
msgid "Use two underscore characters at the beginning and two at the end of odoo and init file names."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:218
|
||
msgid "The final result should be like this:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:223
|
||
msgid "Edit ``__manifest__.py``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:225
|
||
msgid "Open the ``__manifest__.py`` you created and copy/paste the following:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:241
|
||
msgid "Replace the first four property’s values with anything you like. These values will be used to identify your new theme in Odoo’s backend."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:244
|
||
msgid "``category`` defines your module category (always “Theme”) and, after a slash, the subcategory. You can use one subcategory from the Odoo Apps categories list. (https://www.odoo.com/apps/themes)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:246
|
||
msgid "``depends`` specifies the modules needed by our theme to work properly. For our tutorial theme, we only need website and website_theme_install to install/update. If you need blogging or eCommerce features as well, you have to add those modules too. If you plan to offer your theme to the majority of users, it is however recommended that you only depend on website and website_theme_install for the base of your theme. You can then create a second theme, which is an extension of the first one and another Odoo feature like the eCommerce."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:254
|
||
msgid "The ``data`` property will contain the xml files list. Right now it’s empty, but we will add any new files created."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:258
|
||
msgid "Installing your theme"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:260
|
||
msgid "To install your theme, you just place your theme folder inside addons in your Odoo installation."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:262
|
||
msgid "After that, navigate to the Odoo **Website** module, go to :menuselection:`Configuration --> Settings`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:265
|
||
msgid "Under **Website** section click the **Pick a Theme** button, then hover over your theme and click **Use this theme**."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:269
|
||
#: ../../content/developer/howtos/themes.rst:523
|
||
#: ../../content/developer/howtos/themes.rst:697
|
||
#: ../../content/developer/howtos/themes.rst:982
|
||
msgid "Update your theme"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:271
|
||
msgid "Since XML files are only loaded when you install the theme, you will have to force reloading every time you make changes on an xml file."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:273
|
||
msgid "To do that, click on the Upgrade button in the theme selection screen."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:278
|
||
msgid "Structure of an Odoo page"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:280
|
||
msgid "An Odoo page is the visual result of a combination of 2 kind of elements, **cross-pages** and **unique**. By default, Odoo provides you with a **Header** and a **Footer** (cross-pages) and a unique main element that contains the content that makes your page unique."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:285
|
||
msgid "Cross-pages elements will be the same on every page. Unique elements are related to a specific page only."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:289
|
||
msgid "To inspect the default layout, simply create a new page using the Website Builder. Click on :menuselection:`New --> New Page` and add a page name. Inspect the page using your browser."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:303
|
||
msgid "Add Styles"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:306
|
||
#: ../../content/developer/reference/mobile.rst:9
|
||
#: ../../content/developer/webservices/upgrade.rst:10
|
||
msgid "Introduction"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:308
|
||
msgid "The most important feature or your theme should be the style it provides. Odoo includes Bootstrap by default. This means that you can take advantage of all Bootstrap styles and layout functionalities out of the box."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:311
|
||
msgid "Of course Bootstrap is not enough if you want to provide a unique design. The following steps will guide you through how to add custom styles to your theme. The final result won't be pretty, but will provide you with enough information to build upon on your own."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:314
|
||
msgid "Let’s start by creating an empty file called **style.scss** and place it in a folder called **scss** in your static folder. Let's add an example rule which adds a top border on the footer. Copy and paste it, then save the file."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:323
|
||
msgid "Our file is ready but it is not included in our theme yet."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:325
|
||
msgid "Let’s navigate to the view folder and create an XML file called *assets.xml*. Add the default Odoo xml markup as seen before then copy/paste the following code between the Odoo tags. Remember to replace ``theme_tutorial`` with your theme’s main folder name."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:338
|
||
msgid "We just created a template specifying our scss file. As you can see, our template has a special attribute called ``inherit_id``. This attribute tells Odoo that our template is referring to another one in order to operate."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:343
|
||
msgid "In this case, we are referring to ``assets_frontend`` template, located in the ``website`` module. ``assets_frontend`` specifies the list of assets loaded by the website builder and our goal is to add our scss file to this list."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:348
|
||
msgid "This can be achieved using xpath with the attributes ``expr=\"link[last()]\"`` and ``position=\"after\"``, which means \"*take my style file and place it after the last link in the list of assets*\"."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:353
|
||
msgid "Placing it after the last one, we ensure that our file will be loaded at the end and takes priority."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:356
|
||
msgid "Finally add **assets.xml** in your **__manifest__.py** file in the data section."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:358
|
||
msgid "Update your theme."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:363
|
||
msgid "Our scss file is now included in our theme, it will be automatically compiled, minified and combined with all Odoo’s assets."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:365
|
||
msgid "You can now see the beautiful footer border on the website."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:369
|
||
msgid "Advanced tips for styling"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:371
|
||
msgid "In the introduction, we saw how to add a basic file of CSS rules into the system to extend the website. This is actually the last step you should need to add style to your theme."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:375
|
||
msgid "The Odoo website builder already allows the user to create pages by adding a large variety of default well-designed blocks. It also allows a large set of customization possibilities. What may not be straightforward for the user is to combine all of those options to make something really beautiful. This is where your theme can shine. First try to construct the spirit of your theme by enabling a nice set of Odoo default options. This also allows you to ensure two things:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:383
|
||
msgid "You do not re-invent something which already exists. If Odoo provides an option to have a border on the footer, don't recode it yourself. Enable it, then extend it if needed."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:387
|
||
msgid "You ensure that the user can still use all of Odoo features with your theme. Again, if Odoo provides an option to have a border on the footer and that you recode it yourself, you may break the default option or make it useless, making the user have a bad experience. Your option might also not work as well with all the other Odoo features relying on it."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:393
|
||
msgid "So here are the steps to create a robust and consistent style for your theme:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:395
|
||
msgid "\\(1) Set the values for Odoo-provided SCSS variables"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:397
|
||
msgid "Odoo declares many CSS rules, most being entirely customizable by overridding the related SCSS variables. First, create a new file called primary_variables.scss and add it the same way as the style.scss file. The only difference it that you won't add it in the ``assets_frontend`` template but in the ``_assets_primary_variables`` template."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:414
|
||
msgid "That file must only contain definition and overrides of SCSS variables and mixins."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:417
|
||
msgid "Add those:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:438
|
||
msgid "This defines two color palettes for the user to choose from. Odoo relies on five named colors to be used by the website builder. By defining those in your theme, you ensure a consistent colored Odoo theme. Starting with Odoo 14.0, a lot more variable are there for you to customize."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:445
|
||
msgid "All variables defined through those \"palettes\" SCSS maps can later be customized by the users themselves."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:448
|
||
msgid "\\(2) Set the values for Bootstrap variables that Odoo do not surcharge"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:450
|
||
msgid "If Odoo does not provide the variable you are looking for, then try to find a Bootstrap variable which allows it. Indeed all Odoo layouts respect Bootstrap structures and use Bootstrap components or extensions of them. So if you customize a bootstrap variable, you add a generic style for the whole user website."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:456
|
||
msgid "Bootstrap values **must** not be overridden in the primary_variables.scss file but in another dedicated file, extending the ``_assets_frontend_helpers`` template."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:467
|
||
msgid "With for example:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:475
|
||
msgid "Make sure to not override Bootstrap variables which depend on Odoo variables of step (1). Otherwise, you might break the possibility for the user to customize them using the Odoo website builder."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:479
|
||
msgid "\\(3) Add your own CSS rules as seen in the introduction"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:481
|
||
msgid "You may also want to design your snippet first, as we will see in a later section of this tutorial."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:486
|
||
msgid "Extend Odoo Layout"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:488
|
||
msgid "By default, Odoo header contains a responsive navigation menu and the company’s logo. You can easily add new elements or style the existing one."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:490
|
||
msgid "To do so, create a **layout.xml** file in your **views** folder and add the default Odoo xml markup."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:492
|
||
msgid "Then copy-pasting the following code."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:508
|
||
msgid "This xpath will add a welcome message just before the page content. You can do a lot more of thing with xpath and qweb, check the related doc for more details."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:513
|
||
msgid "Be careful replacing default elements attributes. As your theme will extend the default one, your changes will take priority in any future Odoo’s update."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:516
|
||
msgid "The last step is to add layout.xml to the list of xml files used by the theme. To do that, edit your ``__manifest__.py`` file like this"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:527
|
||
msgid "Great! We successfully added an id to the header and an element after the navigation menu. These changes will be applied to each page of the website."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:535
|
||
msgid "Create a specific page layout"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:537
|
||
msgid "Imagine that we want to create a specific layout for a Services page. For this page, we need to add a list of services to the top and give the client the possibility of setting the rest of the page’s layout using snippets."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:540
|
||
msgid "Inside your *views* folder, create a **pages.xml** file and add the default Odoo markup. Inside ``<odoo>``, instead of defining a ``<template>``, we will create a *page* object."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:570
|
||
msgid "As you can see, pages come with many additional properties like the *name* or the *url* where it is reachable."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:573
|
||
msgid "We successfully created a new page layout, but we haven't told the system **how to use it**. To do that, we can use **QWeb**. Wrap the html code into a ``<t>`` tag, like in this example."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:604
|
||
msgid "Using ``<t t-call=\"website.layout\">`` we will use the Odoo default page layout with our code."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:607
|
||
msgid "As you can see, we wrapped our code into two ``<div>``, one with ID ``wrap`` and the other one with class ``container``. This is to provide a minimal layout."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:609
|
||
msgid "The next step is to add an empty area that the user can fill with snippets. To achieve this, just create a ``div`` with ``oe_structure`` class just before closing the ``div#wrap`` element."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:649
|
||
msgid "You can create as many snippet areas as you like and place them anywhere in your pages."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:651
|
||
msgid "It is worth mentioning there is an alternative to create pages using the ``<template>`` directive we saw before."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:686
|
||
msgid "This would allow your page content to be further customized using ``<xpath>``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:688
|
||
msgid "Our page is almost ready. Now all we have to do is add **pages.xml** in our **__manifest__.py** file"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:701
|
||
msgid "Great, our Services page is ready and you’ll be able to access it by navigating to ``<yourwebsite>/services`` (the URL we chose above)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:703
|
||
msgid "You will notice that it's possible to drag/drop snippets underneath the *Our Services* list."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:709
|
||
msgid "Now let's go back to our *pages.xml* and, after our page template, copy/paste the following code."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:721
|
||
msgid "This code will add a link to the main menu, referring to the page we created."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:726
|
||
msgid "The **sequence** attribute defines the link’s position in the top menu. In our example, we set the value to ``99`` in order to place it last. I you want to place it in a particular position, you have to replace the value according to your needs."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:729
|
||
msgid "As you can see inspecting the *data.xml* file in the ``website`` module, the **Home** link is set to ``10`` and the **Contact** us one is set to ``60`` by default. If, for example, you want to place your link in the **middle**, you can set your link’s sequence value to ``40``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:733
|
||
msgid "Create Snippets"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:735
|
||
msgid "Since snippets are how users design and layout pages, they are the most important XML elements of your design. Let’s create a snippet for our Service page. The snippet will display three testimonials and it will be editable by the end user using the Website Builder UI. Navigate to the view folder and create an XML file called **snippets.xml**. Add the default Odoo xml markup and copy/paste the following code. The template contains the HTML markup that will be displayed by the snippet."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:767
|
||
msgid "As you can see, we used Bootstrap default classes for our three columns. It’s not just about layout, these classes **will be triggered by the Website Builder to make them resizable by the user**."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:769
|
||
msgid "The previous code will create the snippet’s content, but we still need to place it into the editor bar, so the user will be able to drag&drop it into the page. Copy/paste this template in your **snippets.xml** file."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:782
|
||
msgid "Using xpath, we are targeting a particular element with id ``snippet_structure``. This means that the snippet will appear in the Structure tab. If you want to change the destination tab, you have just to replace the ``id`` value in the xpath expression."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:794
|
||
msgid "Tab Name"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:794
|
||
msgid "Xpath expression"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:796
|
||
#: ../../content/developer/reference/data.rst:14
|
||
msgid "Structure"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:796
|
||
msgid "``//div[@id='snippet_structure']``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:797
|
||
msgid "Content"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:797
|
||
msgid "``//div[@id='snippet_content']``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:798
|
||
msgid "Feature"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:798
|
||
msgid "``//div[@id='snippet_feature']``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:799
|
||
msgid "Effect"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:799
|
||
msgid "``//div[@id='snippet_effect']``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:802
|
||
msgid "The ``<t>`` tag will call our snippet's template and will assign a thumbnail placed in the img folder. You can now drag your snippet from the snippet bar, drop it in your page and see the result."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:809
|
||
msgid "Snippet options"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:811
|
||
msgid "Options allow publishers to edit a snippet’s appearance using the Website Builder’s UI. Using Website Builder functionalities, you can create snippet options easily and automatically add them to the UI."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:815
|
||
msgid "Options group properties"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:817
|
||
msgid "Options are wrapped in groups. Groups can have properties that define how the included options will interact with the user interface."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:819
|
||
msgid "``data-selector=\"[css selector(s)]\"``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:820
|
||
msgid "Bind all the options included into the group to a particular element."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:821
|
||
msgid "``data-js=\" custom method name \"``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:822
|
||
msgid "Is used to bind custom Javascript methods."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:823
|
||
msgid "``data-drop-in=\"[css selector(s)]\"``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:824
|
||
msgid "Defines the list of elements where the snippet can be dropped into."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:826
|
||
msgid "``data-drop-near=\"[css selector(s)]\"``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:826
|
||
msgid "Defines the list of elements that the snippet can be dropped beside."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:829
|
||
msgid "Default option methods"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:831
|
||
msgid "Options apply standard CSS classes to the snippet. Depending on the method that you choose, the UI will behave differently."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:834
|
||
msgid "``data-select-class=\"[class name]\"``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:834
|
||
msgid "More data-select-class in the same group defines a list of classes that the user can choose to apply. Only one option can be enabled at a time."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:837
|
||
msgid "``data-toggle-class=\"[class name]\"``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:837
|
||
msgid "The data-toggle-class is used to apply one or more CSS classes from the list to a snippet. Multiple selections can be applied at once."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:839
|
||
msgid "Let's demonstrate how default options work with a basic example."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:841
|
||
msgid "We start by adding a new file in our views folder - name it **options.xml** and add the default Odoo XML markup. Create a new template copy/pasting the following"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:863
|
||
msgid "The previous template will inherit the default **snippet_options template** adding our options after the **background** options (xpath expr attribute). To place your options in a particular order, inspect the **snippet_options template** from the **website module** and add your options before/after the desired position."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:866
|
||
msgid "As you can see, we wrapped all our options inside a DIV tag that will group our options and that will target them to the right selector (``data-selector=\".s_testimonial\"``)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:870
|
||
msgid "To define our options we applied ``data-select-class`` attributes to the ``li`` elements. When the user selects an option, the class contained in the attribute will automatically be applied to the element."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:874
|
||
msgid "Since ``selectClass`` method avoids multiple selections, the last \"empty\" option will reset the snippet to default."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:877
|
||
msgid "Add **options.xml** to ``__manifest__.py`` and update your theme."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:881
|
||
msgid "Dropping our snippet onto the page, you will notice that our new options are automatically added to the customize menu. Inspecting the page, you will also notice that the class will be applied to the element when selecting an option."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:885
|
||
msgid "Let’s create some css rules in order to provide a visual feedback for our options. Open our **style.scss** file and add the following"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:907
|
||
msgid "Great! We successfully created options for our snippet."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:909
|
||
msgid "Any time the publisher clicks on an option, the system will add the class specified in the data-select-class attribute."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:911
|
||
msgid "By replacing ``data-select-class`` with ``data-toggle-class`` you will be able to select more classes at the same time."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:916
|
||
msgid "Javascript Options"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:918
|
||
msgid "``data-select-class`` and ``data-toggle-class`` are great if you need to perform simple class change operations. But what if your snippet’s customization needs something more?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:921
|
||
msgid "As we said before, ``data-js`` propriety can be assigned to an options group in order to define a custom method. Let’s create one for our *testimonials snippet* by adding a ``data-js`` attribute to the option’s group div that we created earlier."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:929
|
||
msgid "Done. From now on, the Website Builder will look for a ``s_testimonial_options`` JS option each time the publisher enters in edit mode."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:933
|
||
msgid "Let's go one step further by creating a javascript file, name it **tutorial_editor.js** and place it into the **static** folder. Copy/paste the following code"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:943
|
||
msgid "Great, we successfully created our javascript editor file. This file will contain all the javascript functions used by our snippets in edit mode. Let’s create a new function for our testimonial snippet using the ``s_testimonial_options`` name that we used before."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:956
|
||
msgid "As you will notice, we used a method called ``onFocus`` to trigger our function. The Website Builder provides several events you can use to trigger your custom functions."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:959
|
||
msgid "Event"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:959
|
||
#: ../../content/developer/webservices/extract_api.rst:42
|
||
#: ../../content/developer/webservices/extract_api.rst:152
|
||
#: ../../content/developer/webservices/extract_api.rst:382
|
||
msgid "Description"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:961
|
||
msgid "``start``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:961
|
||
msgid "Fires when the publisher selects the snippet for the first time in an editing session or when the snippet is drag-dropped into the page"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:962
|
||
msgid "``onFocus``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:962
|
||
msgid "Fires each time the snippet is selected by the user or when the snippet is drag-dropped into the page."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:963
|
||
msgid "``onBlur``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:963
|
||
msgid "This event occurs when a snippet loses focus."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:964
|
||
msgid "``onClone``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:964
|
||
msgid "Fires just after a snippet is duplicated."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:965
|
||
msgid "``onRemove``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:965
|
||
msgid "It occurs just before that the snippet is removed."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:966
|
||
msgid "``onBuilt``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:966
|
||
msgid "Fires just after that the snippet is drag and dropped into a drop zone. When this event is triggered, the content is already inserted in the page."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:967
|
||
msgid "``cleanForSave``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:967
|
||
msgid "It trigger before the publisher saves the page."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:970
|
||
msgid "Let’s add our new javascript files to the editor assets list. Go back to **assets.xml** and create a new template like the previous one. This time we have to inherit ``assets_editor`` instead of ``assets_frontend``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:987
|
||
msgid "Let’s test our new javascript function. Enter in Edit mode and drop into the page. You should now see the javascript alert that we bound on the ``onFocus`` event. If you close it, then click outside of your snippet and then click in it again, the event will trigger again."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:997
|
||
msgid "Editing Reference Guide"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:999
|
||
msgid "Basically all the elements in a page can be edited by the publisher. Besides that, some element types and css classes will trigger special Website Builder functionalities when edited."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1003
|
||
msgid "Layout"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1006
|
||
msgid "``<section />``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1006
|
||
msgid "Any section element can be edited like a block of content. The publisher can move or duplicate it. It’s also possible to set a background image or color. Section is the standard main container of any snippet."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1009
|
||
msgid "``.row > .col-lg-*``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1009
|
||
msgid "Any large bootstrap columns directly descending from a .row element (respecting Bootstrap structure), will be resizable by the publisher."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1012
|
||
msgid "``contenteditable=\"False\"``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1012
|
||
msgid "This attribute will prevent editing to the element and all its children."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1015
|
||
msgid "``contenteditable=\"True\"``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1015
|
||
msgid "Apply it to an element inside a contenteditable=\"False\" element in order to create an exception and make the element and its children editable."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1018
|
||
msgid "``<a href=”#” />``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1018
|
||
msgid "In Edit Mode, any link can be edited and styled. Using the “Link Modal” it’s also possible to replace it with a button."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1021
|
||
msgid "Media"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1024
|
||
msgid "``<span class=”fa” />``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1024
|
||
msgid "Pictogram elements. Editing this element will open the Pictogram library to replace the icon. It’s also possible to transform the elements using CSS."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1027
|
||
msgid "``<img />``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1027
|
||
msgid "Once clicked, the Image Library will open and you can replace images. Transformation is also possible for this kind of element."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1037
|
||
msgid "This html structure will create an ``<iframe>`` element editable by the publisher."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1041
|
||
msgid "SEO best practice"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1044
|
||
msgid "Facilitate content insertion"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1046
|
||
msgid "Modern search engine algorithms increasingly focus on content, which means there is less focus on **keyword saturation** and more focus on whether or not the content is **actually relevant to the keywords**."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1048
|
||
msgid "As content is so important for SEO, you should concentrate on giving publishers the tools to easily insert it. It is important that your snippets are “content-responsive”, meaning that they should fit the publisher’s content regardless of size."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1050
|
||
msgid "Let’s have a look to this example of a classic two column snippet, implemented in two different ways."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1060
|
||
msgid "**Bad**"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1062
|
||
msgid "Using fixed image, the publisher will be forced to limit the text in order to follow the layout."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1072
|
||
msgid "**Good**"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1074
|
||
msgid "Using background images that fit the column height, the publisher will be free to add the content regardless of the image’s height."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1079
|
||
msgid "Page segmentation"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1081
|
||
msgid "Basically, page segmentation means that a page is divided into several separate parts and these parts are treated as separate entries by search engines. When you design pages or snippets, you should be sure to use the right tags in order to facilitate search engine indexing."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1085
|
||
msgid "``<article>``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1085
|
||
msgid "Specifies an independent block of content. Within it should be a piece of self-contained content that should make sense on its own. You can nest ``<article>`` elements within one another. In this case, it’s implied that the nested elements are related to the outer ``<article>`` element."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1088
|
||
msgid "``<header>``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1088
|
||
msgid "Indicates the header section of a self-contained block of content (an ``<article>``)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1091
|
||
msgid "``<section>``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1091
|
||
msgid "Is the snippet default tag and it specifies a subsection of a block of content. It can be used to split ``<article>`` content into several parts. It’s advisable to use a heading element (``<h1>`` – ``<h6>``) to define the section’s topic."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1101
|
||
msgid "``<hgroup>``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1094
|
||
msgid "Is used to wrap a section of headings (``<h1>`` - ``<h6>``). A great example would be an article with both a headline and sub-headline at the top:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1104
|
||
msgid "Describe your page"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1107
|
||
msgid "Define keywords"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1108
|
||
msgid "You should use appropriate, relevant keywords and synonyms for those keywords. You can define them for each page using the built-in “Promote” function found in the bar at the top."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1111
|
||
msgid "Define a title and a description"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1113
|
||
msgid "Define them using the “Promote” function. Keep your page titles short and include the main keyword phrase for the page. Good titles evoke an emotional response, ask a question or promise something."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/themes.rst:1116
|
||
msgid "Descriptions, while not important to search engine rankings, are extremely important in gaining user click-through. These are an opportunity to advertise content and to let people searching know exactly whether the given page contains the information they're looking for. It is important that titles and descriptions on each page are unique."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:4
|
||
msgid "Customizing the web client"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:6
|
||
msgid "Note: this section is really really out of date. It will be updated someday, but meanwhile, this tutorial will probably be frustrating to follow, since it was written a long time ago."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:15
|
||
msgid "This guide is about creating modules for Odoo's web client."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:17
|
||
msgid "To create websites with Odoo, see :doc:`website`; to add business capabilities or extend existing business systems of Odoo, see :doc:`backend`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:22
|
||
msgid "This guide assumes knowledge of:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:24
|
||
msgid "Javascript basics and good practices"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:25
|
||
msgid "jQuery_"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:26
|
||
msgid "`Underscore.js`_"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:28
|
||
msgid "It also requires :ref:`an installed Odoo <setup/install>`, and Git_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:32
|
||
msgid "A Simple Module"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:34
|
||
msgid "Let's start with a simple Odoo module holding basic web component configuration and letting us test the web framework."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:37
|
||
msgid "The example module is available online and can be downloaded using the following command:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:44
|
||
msgid "This will create a ``petstore`` folder wherever you executed the command. You then need to add that folder to Odoo's :option:`addons path <odoo-bin --addons-path>`, create a new database and install the ``oepetstore`` module."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:49
|
||
msgid "If you browse the ``petstore`` folder, you should see the following content:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:75
|
||
msgid "The module already holds various server customizations. We'll come back to these later, for now let's focus on the web-related content, in the ``static`` folder."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:79
|
||
msgid "Files used in the \"web\" side of an Odoo module must be placed in a ``static`` folder so they are available to a web browser, files outside that folder can not be fetched by browsers. The ``src/css``, ``src/js`` and ``src/xml`` sub-folders are conventional and not strictly necessary."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:84
|
||
msgid "``oepetstore/static/css/petstore.css``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:85
|
||
msgid "Currently empty, will hold the CSS_ for pet store content"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:86
|
||
msgid "``oepetstore/static/xml/petstore.xml``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:87
|
||
msgid "Mostly empty, will hold :ref:`reference/qweb` templates"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:106
|
||
msgid "``oepetstore/static/js/petstore.js``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:89
|
||
msgid "The most important (and interesting) part, contains the logic of the application (or at least its web-browser side) as javascript. It should currently look like::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:108
|
||
msgid "Which only prints a small message in the browser's console."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:110
|
||
msgid "The files in the ``static`` folder, need to be defined within the module in order for them to be loaded correctly. Everything in ``src/xml`` is defined in ``__manifest__.py`` while the contents of ``src/css`` and ``src/js`` are defined in ``petstore.xml``, or a similar file."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:114
|
||
msgid "All JavaScript files are concatenated and :term:`minified` to improve application load time."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:117
|
||
msgid "One of the drawback is debugging becomes more difficult as individual files disappear and the code is made significantly less readable. It is possible to disable this process by enabling the \"developer mode\": log into your Odoo instance (user *admin* password *admin* by default) open the user menu (in the top-right corner of the Odoo screen) and select :guilabel:`About Odoo` then :guilabel:`Activate the developer mode`:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:131
|
||
msgid "This will reload the web client with optimizations disabled, making development and debugging significantly more comfortable."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:134
|
||
msgid "qweb files hooked via __manifest__.py, but js and CSS use bundles"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:137
|
||
msgid "Odoo JavaScript Module"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:139
|
||
msgid "Javascript doesn't have built-in modules. As a result variables defined in different files are all mashed together and may conflict. This has given rise to various module patterns used to build clean namespaces and limit risks of naming conflicts."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:144
|
||
msgid "The Odoo framework uses one such pattern to define modules within web addons, in order to both namespace code and correctly order its loading."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:147
|
||
msgid "``oepetstore/static/js/petstore.js`` contains a module declaration::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:153
|
||
msgid "In Odoo web, modules are declared as functions set on the global ``odoo`` variable. The function's name must be the same as the addon (in this case ``oepetstore``) so the framework can find it, and automatically initialize it."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:157
|
||
msgid "When the web client loads your module it will call the root function and provide two parameters:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:160
|
||
msgid "the first parameter is the current instance of the Odoo web client, it gives access to various capabilities defined by the Odoo (translations, network services) as well as objects defined by the core or by other modules."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:164
|
||
msgid "the second parameter is your own local namespace automatically created by the web client. Objects and variables which should be accessible from outside your module (either because the Odoo web client needs to call them or because others may want to customize them) should be set inside that namespace."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:171
|
||
msgid "Classes"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:173
|
||
msgid "Much as modules, and contrary to most object-oriented languages, javascript does not build in *classes*\\ [#classes]_ although it provides roughly equivalent (if lower-level and more verbose) mechanisms."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:177
|
||
msgid "For simplicity and developer-friendliness Odoo web provides a class system based on John Resig's `Simple JavaScript Inheritance`_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:180
|
||
msgid "New classes are defined by calling the :func:`~odoo.web.Class.extend` method of :class:`odoo.web.Class`::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:189
|
||
msgid "The :func:`~odoo.web.Class.extend` method takes a dictionary describing the new class's content (methods and static attributes). In this case, it will only have a ``say_hello`` method which takes no parameters."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:193
|
||
msgid "Classes are instantiated using the ``new`` operator::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:199
|
||
msgid "And attributes of the instance can be accessed via ``this``::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:212
|
||
msgid "Classes can provide an initializer to perform the initial setup of the instance, by defining an ``init()`` method. The initializer receives the parameters passed when using the ``new`` operator::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:229
|
||
msgid "It is also possible to create subclasses from existing (used-defined) classes by calling :func:`~odoo.web.Class.extend` on the parent class, as is done to subclass :class:`~odoo.web.Class`::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:243
|
||
msgid "When overriding a method using inheritance, you can use ``this._super()`` to call the original method::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:259
|
||
msgid "``_super`` is not a standard method, it is set on-the-fly to the next method in the current inheritance chain, if any. It is only defined during the *synchronous* part of a method call, for use in asynchronous handlers (after network calls or in ``setTimeout`` callbacks) a reference to its value should be retained, it should not be accessed via ``this``::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:282
|
||
msgid "Widgets Basics"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:284
|
||
msgid "The Odoo web client bundles jQuery_ for easy DOM manipulation. It is useful and provides a better API than standard `W3C DOM`_\\ [#dombugs]_, but insufficient to structure complex applications leading to difficult maintenance."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:289
|
||
msgid "Much like object-oriented desktop UI toolkits (e.g. Qt_, Cocoa_ or GTK_), Odoo Web makes specific components responsible for sections of a page. In Odoo web, the base for such components is the :class:`~odoo.Widget` class, a component specialized in handling a page section and displaying information for the user."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:296
|
||
msgid "Your First Widget"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:298
|
||
msgid "The initial demonstration module already provides a basic widget::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:306
|
||
msgid "It extends :class:`~odoo.Widget` and overrides the standard method :func:`~odoo.Widget.start`, which — much like the previous ``MyClass`` — does little for now."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:310
|
||
msgid "This line at the end of the file::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:315
|
||
msgid "registers our basic widget as a client action. Client actions will be explained later, for now this is just what allows our widget to be called and displayed when we select the :menuselection:`Pet Store --> Pet Store --> Home Page` menu."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:322
|
||
msgid "because the widget will be called from outside our module, the web client needs its \"fully qualified\" name, not the local version."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:326
|
||
msgid "Display Content"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:328
|
||
msgid "Widgets have a number of methods and features, but the basics are simple:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:330
|
||
msgid "set up a widget"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:331
|
||
msgid "format the widget's data"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:332
|
||
msgid "display the widget"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:334
|
||
msgid "The ``HomePage`` widget already has a :func:`~odoo.Widget.start` method. That method is part of the normal widget lifecycle and automatically called once the widget is inserted in the page. We can use it to display some content."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:339
|
||
msgid "All widgets have a :attr:`~odoo.Widget.$el` which represents the section of page they're in charge of (as a jQuery_ object). Widget content should be inserted there. By default, :attr:`~odoo.Widget.$el` is an empty ``<div>`` element."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:344
|
||
msgid "A ``<div>`` element is usually invisible to the user if it has no content (or without specific styles giving it a size) which is why nothing is displayed on the page when ``HomePage`` is launched."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:348
|
||
msgid "Let's add some content to the widget's root element, using jQuery::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:356
|
||
msgid "That message will now appear when you open :menuselection:`Pet Store --> Pet Store --> Home Page`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:361
|
||
msgid "to refresh the javascript code loaded in Odoo Web, you will need to reload the page. There is no need to restart the Odoo server."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:364
|
||
msgid "The ``HomePage`` widget is used by Odoo Web and managed automatically. To learn how to use a widget \"from scratch\" let's create a new one::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:373
|
||
msgid "We can now add our ``GreetingsWidget`` to the ``HomePage`` by using the ``GreetingsWidget``'s :func:`~odoo.Widget.appendTo` method::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:384
|
||
msgid "``HomePage`` first adds its own content to its DOM root"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:385
|
||
msgid "``HomePage`` then instantiates ``GreetingsWidget``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:386
|
||
msgid "Finally it tells ``GreetingsWidget`` where to insert itself, delegating part of its :attr:`~odoo.Widget.$el` to the ``GreetingsWidget``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:389
|
||
msgid "When the :func:`~odoo.Widget.appendTo` method is called, it asks the widget to insert itself at the specified position and to display its content. The :func:`~odoo.Widget.start` method will be called during the call to :func:`~odoo.Widget.appendTo`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:394
|
||
msgid "To see what happens under the displayed interface, we will use the browser's DOM Explorer. But first let's alter our widgets slightly so we can more easily find where they are, by :attr:`adding a class to their root elements <odoo.Widget.className>`::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:408
|
||
msgid "If you can find the relevant section of the DOM (right-click on the text then :guilabel:`Inspect Element`), it should look like this:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:420
|
||
msgid "Which clearly shows the two ``<div>`` elements automatically created by :class:`~odoo.Widget`, because we added some classes on them."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:423
|
||
msgid "We can also see the two message-holding divs we added ourselves"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:425
|
||
msgid "Finally, note the ``<div class=\"oe_petstore_greetings\">`` element which represents the ``GreetingsWidget`` instance is *inside* the ``<div class=\"oe_petstore_homepage\">`` which represents the ``HomePage`` instance, since we appended"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:431
|
||
msgid "Widget Parents and Children"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:433
|
||
msgid "In the previous part, we instantiated a widget using this syntax::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:437
|
||
msgid "The first argument is ``this``, which in that case was a ``HomePage`` instance. This tells the widget being created which other widget is its *parent*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:441
|
||
msgid "As we've seen, widgets are usually inserted in the DOM by another widget and *inside* that other widget's root element. This means most widgets are \"part\" of another widget, and exist on behalf of it. We call the container the *parent*, and the contained widget the *child*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:446
|
||
msgid "Due to multiple technical and conceptual reasons, it is necessary for a widget to know who is its parent and who are its children."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:457
|
||
msgid ":func:`~odoo.Widget.getParent`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:450
|
||
msgid "can be used to get the parent of a widget::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:469
|
||
msgid ":func:`~odoo.Widget.getChildren`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:460
|
||
msgid "can be used to get a list of its children::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:471
|
||
msgid "When overriding the :func:`~odoo.Widget.init` method of a widget it is *of the utmost importance* to pass the parent to the ``this._super()`` call, otherwise the relation will not be set up correctly::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:482
|
||
msgid "Finally, if a widget does not have a parent (e.g. because it's the root widget of the application), ``null`` can be provided as parent::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:488
|
||
msgid "Destroying Widgets"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:490
|
||
msgid "If you can display content to your users, you should also be able to erase it. This is done via the :func:`~odoo.Widget.destroy` method::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:495
|
||
msgid "When a widget is destroyed it will first call :func:`~odoo.Widget.destroy` on all its children. Then it erases itself from the DOM. If you have set up permanent structures in :func:`~odoo.Widget.init` or :func:`~odoo.Widget.start` which must be explicitly cleaned up (because the garbage collector will not handle them), you can override :func:`~odoo.Widget.destroy`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:504
|
||
msgid "when overriding :func:`~odoo.Widget.destroy`, ``_super()`` *must always* be called otherwise the widget and its children are not correctly cleaned up leaving possible memory leaks and \"phantom events\", even if no error is displayed"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:510
|
||
msgid "The QWeb Template Engine"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:512
|
||
msgid "In the previous section we added content to our widgets by directly manipulating (and adding to) their DOM::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:517
|
||
msgid "This allows generating and displaying any type of content, but gets unwieldy when generating significant amounts of DOM (lots of duplication, quoting issues, ...)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:521
|
||
msgid "As many other environments, Odoo's solution is to use a `template engine`_. Odoo's template engine is called :ref:`reference/qweb`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:524
|
||
msgid "QWeb is an XML-based templating language, similar to `Genshi <http://en.wikipedia.org/wiki/Genshi_(templating_language)>`_, `Thymeleaf <http://en.wikipedia.org/wiki/Thymeleaf>`_ or `Facelets <http://en.wikipedia.org/wiki/Facelets>`_. It has the following characteristics:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:530
|
||
msgid "It's implemented fully in JavaScript and rendered in the browser"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:531
|
||
msgid "Each template file (XML files) contains multiple templates"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:532
|
||
msgid "It has special support in Odoo Web's :class:`~odoo.Widget`, though it can be used outside of Odoo's web client (and it's possible to use :class:`~odoo.Widget` without relying on QWeb)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:538
|
||
msgid "The rationale behind using QWeb instead of existing javascript template engines is the extensibility of pre-existing (third-party) templates, much like Odoo :ref:`views <reference/views>`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:542
|
||
msgid "Most javascript template engines are text-based which precludes easy structural extensibility where an XML-based templating engine can be generically altered using e.g. XPath or CSS and a tree-alteration DSL (or even just XSLT). This flexibility and extensibility is a core characteristic of Odoo, and losing it was considered unacceptable."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:549
|
||
msgid "Using QWeb"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:551
|
||
msgid "First let's define a simple QWeb template in the almost-empty ``oepetstore/static/src/xml/petstore.xml`` file:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:563
|
||
msgid "Now we can use this template inside of the ``HomePage`` widget. Using the ``QWeb`` loader variable defined at the top of the page, we can call to the template defined in the XML file::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:573
|
||
msgid ":func:`QWeb.render` looks for the specified template, renders it to a string and returns the result."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:576
|
||
msgid "However, because :class:`~odoo.Widget` has special integration for QWeb the template can be set directly on the widget via its :attr:`~odoo.Widget.template` attribute::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:587
|
||
msgid "Although the result looks similar, there are two differences between these usages:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:590
|
||
msgid "with the second version, the template is rendered right before :func:`~odoo.Widget.start` is called"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:592
|
||
msgid "in the first version the template's content is added to the widget's root element, whereas in the second version the template's root element is directly *set as* the widget's root element. Which is why the \"greetings\" sub-widget also gets a red background"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:599
|
||
msgid "templates should have a single non-``t`` root element, especially if they're set as a widget's :attr:`~odoo.Widget.template`. If there are multiple \"root elements\", results are undefined (usually only the first root element will be used and the others will be ignored)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:605
|
||
msgid "QWeb Context"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:607
|
||
msgid "QWeb templates can be given data and can contain basic display logic."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:609
|
||
msgid "For explicit calls to :func:`QWeb.render`, the template data is passed as second parameter::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:614
|
||
msgid "with the template modified to:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:622
|
||
msgid "will result in:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:628
|
||
msgid "When using :class:`~odoo.Widget`'s integration it is not possible to provide additional data to the template. The template will be given a single ``widget`` context variable, referencing the widget being rendered right before :func:`~odoo.Widget.start` is called (the widget's state will essentially be that set up by :func:`~odoo.Widget.init`):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:652
|
||
msgid "Result:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:659
|
||
msgid "Template Declaration"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:661
|
||
msgid "We've seen how to *render* QWeb templates, let's now see the syntax of the templates themselves."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:664
|
||
msgid "A QWeb template is composed of regular XML mixed with QWeb *directives*. A QWeb directive is declared with XML attributes starting with ``t-``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:667
|
||
msgid "The most basic directive is ``t-name``, used to declare new templates in a template file:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:678
|
||
msgid "``t-name`` takes the name of the template being defined, and declares that it can be called using :func:`QWeb.render`. It can only be used at the top-level of a template file."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:683
|
||
msgid "Escaping"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:685
|
||
msgid "The ``t-esc`` directive can be used to output text:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:691
|
||
msgid "It takes a Javascript expression which is evaluated, the result of the expression is then HTML-escaped and inserted in the document. Since it's an expression it's possible to provide just a variable name as above, or a more complex expression like a computation:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:700
|
||
msgid "or method calls:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:707
|
||
msgid "Outputting HTML"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:709
|
||
msgid "To inject HTML in the page being rendered, use ``t-raw``. Like ``t-esc`` it takes an arbitrary Javascript expression as parameter, but it does not perform an HTML-escape step."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:719
|
||
msgid "``t-raw`` *must not* be used on any data which may contain non-escaped user-provided content as this leads to `cross-site scripting`_ vulnerabilities"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:724
|
||
#: ../../content/developer/reference/qweb.rst:66
|
||
msgid "Conditionals"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:726
|
||
msgid "QWeb can have conditional blocks using ``t-if``. The directive takes an arbitrary expression, if the expression is falsy (``false``, ``null``, ``0`` or an empty string) the whole block is suppressed, otherwise it is displayed."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:743
|
||
msgid "QWeb doesn't have an \"else\" structure, use a second ``t-if`` with the original condition inverted. You may want to store the condition in a local variable if it's a complex or expensive expression."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:748
|
||
msgid "Iteration"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:750
|
||
msgid "To iterate on a list, use ``t-foreach`` and ``t-as``. ``t-foreach`` takes an expression returning a list to iterate on ``t-as`` takes a variable name to bind to each item during iteration."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:764
|
||
msgid "``t-foreach`` can also be used with numbers and objects (dictionaries)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:768
|
||
msgid "Defining attributes"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:770
|
||
msgid "QWeb provides two related directives to define computed attributes: :samp:`t-att-{name}` and :samp:`t-attf-{name}`. In either case, *name* is the name of the attribute to create (e.g. ``t-att-id`` defines the attribute ``id`` after rendering)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:775
|
||
msgid "``t-att-`` takes a javascript expression whose result is set as the attribute's value, it is most useful if all of the attribute's value is computed:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:786
|
||
msgid "``t-attf-`` takes a *format string*. A format string is literal text with interpolation blocks inside, an interpolation block is a javascript expression between ``{{`` and ``}}``, which will be replaced by the result of the expression. It is most useful for attributes which are partially literal and partially computed such as a class:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:799
|
||
msgid "Calling other templates"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:801
|
||
msgid "Templates can be split into sub-templates (for simplicity, maintainability, reusability or to avoid excessive markup nesting)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:804
|
||
msgid "This is done using the ``t-call`` directive, which takes the name of the template to render:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:818
|
||
msgid "rendering the ``A`` template will result in:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:826
|
||
msgid "Sub-templates inherit the rendering context of their caller."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:829
|
||
msgid "To Learn More About QWeb"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:831
|
||
msgid "For a QWeb reference, see :ref:`reference/qweb`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:834
|
||
#: ../../content/developer/howtos/web.rst:1100
|
||
msgid "Exercise"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:836
|
||
msgid "Usage of QWeb in Widgets"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:838
|
||
msgid "Create a widget whose constructor takes two parameters aside from ``parent``: ``product_names`` and ``color``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:841
|
||
msgid "``product_names`` should an array of strings, each one the name of a product"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:843
|
||
msgid "``color`` is a string containing a color in CSS color format (ie: ``#000000`` for black)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:846
|
||
msgid "The widget should display the given product names one under the other, each one in a separate box with a background color with the value of ``color`` and a border. You should use QWeb to render the HTML. Any necessary CSS should be in ``oepetstore/static/src/css/petstore.css``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:851
|
||
msgid "Use the widget in ``HomePage`` with half a dozen products."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:915
|
||
msgid "Widget Helpers"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:918
|
||
msgid "``Widget``'s jQuery Selector"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:920
|
||
msgid "Selecting DOM elements within a widget can be performed by calling the ``find()`` method on the widget's DOM root::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:925
|
||
msgid "But because it's a common operation, :class:`~odoo.Widget` provides an equivalent shortcut through the :func:`~odoo.Widget.$` method::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:936
|
||
msgid "The global jQuery function ``$()`` should *never* be used unless it is absolutely necessary: selection on a widget's root are scoped to the widget and local to it, but selections with ``$()`` are global to the page/application and may match parts of other widgets and views, leading to odd or dangerous side-effects. Since a widget should generally act only on the DOM section it owns, there is no cause for global selection."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:944
|
||
msgid "Easier DOM Events Binding"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:946
|
||
msgid "We have previously bound DOM events using normal jQuery event handlers (e.g. ``.click()`` or ``.change()``) on widget elements::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:961
|
||
msgid "While this works it has a few issues:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:963
|
||
msgid "it is rather verbose"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:964
|
||
msgid "it does not support replacing the widget's root element at runtime as the binding is only performed when ``start()`` is run (during widget initialization)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:967
|
||
msgid "it requires dealing with ``this``-binding issues"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:969
|
||
msgid "Widgets thus provide a shortcut to DOM event binding via :attr:`~odoo.Widget.events`::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:981
|
||
msgid ":attr:`~odoo.Widget.events` is an object (mapping) of an event to the function or method to call when the event is triggered:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:984
|
||
msgid "the key is an event name, possibly refined with a CSS selector in which case only if the event happens on a selected sub-element will the function or method run: ``click`` will handle all clicks within the widget, but ``click .my_button`` will only handle clicks in elements bearing the ``my_button`` class"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:989
|
||
msgid "the value is the action to perform when the event is triggered"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:991
|
||
msgid "It can be either a function::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:997
|
||
msgid "or the name of a method on the object (see example above)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:999
|
||
msgid "In either case, the ``this`` is the widget instance and the handler is given a single parameter, the `jQuery event object`_ for the event."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1003
|
||
msgid "Widget Events and Properties"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1006
|
||
msgid "Events"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1008
|
||
msgid "Widgets provide an event system (separate from the DOM/jQuery event system described above): a widget can fire events on itself, and other widgets (or itself) can bind themselves and listen for these events::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1028
|
||
msgid "This widget acts as a facade, transforming user input (through DOM events) into a documentable internal event to which parent widgets can bind themselves."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1032
|
||
msgid ":func:`~odoo.Widget.trigger` takes the name of the event to trigger as its first (mandatory) argument, any further arguments are treated as event data and passed directly to listeners."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1036
|
||
msgid "We can then set up a parent event instantiating our generic widget and listening to the ``user_chose`` event using :func:`~odoo.Widget.on`::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1054
|
||
msgid ":func:`~odoo.Widget.on` binds a function to be called when the event identified by ``event_name`` is. The ``func`` argument is the function to call and ``object`` is the object to which that function is related if it is a method. The bound function will be called with the additional arguments of :func:`~odoo.Widget.trigger` if it has any. Example::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1073
|
||
msgid "Triggering events on an other widget is generally a bad idea. The main exception to that rule is ``odoo.web.bus`` which exists specifically to broadcasts evens in which any widget could be interested throughout the Odoo web application."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1079
|
||
msgid "Properties"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1081
|
||
msgid "Properties are very similar to normal object attributes in that they allow storing data on a widget instance, however they have the additional feature that they trigger events when set::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1094
|
||
msgid ":func:`~odoo.Widget.set` sets the value of a property and triggers :samp:`change:{propname}` (where *propname* is the property name passed as first parameter to :func:`~odoo.Widget.set`) and ``change``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1097
|
||
msgid ":func:`~odoo.Widget.get` retrieves the value of a property."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1102
|
||
msgid "Widget Properties and Events"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1104
|
||
msgid "Create a widget ``ColorInputWidget`` that will display 3 ``<input type=\"text\">``. Each of these ``<input>`` is dedicated to type a hexadecimal number from 00 to FF. When any of these ``<input>`` is modified by the user the widget must query the content of the three ``<input>``, concatenate their values to have a complete CSS color code (ie: ``#00FF00``) and put the result in a property named ``color``. Please note the jQuery ``change()`` event that you can bind on any HTML ``<input>`` element and the ``val()`` method that can query the current value of that ``<input>`` could be useful to you for this exercise."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1114
|
||
msgid "Then, modify the ``HomePage`` widget to instantiate ``ColorInputWidget`` and display it. The ``HomePage`` widget should also display an empty rectangle. That rectangle must always, at any moment, have the same background color as the color in the ``color`` property of the ``ColorInputWidget`` instance."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1120
|
||
msgid "Use QWeb to generate all HTML."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1193
|
||
msgid "Modify existing widgets and classes"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1195
|
||
msgid "The class system of the Odoo web framework allows direct modification of existing classes using the :func:`~odoo.web.Class.include` method::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1213
|
||
msgid "This system is similar to the inheritance mechanism, except it will alter the target class in-place instead of creating a new class."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1216
|
||
msgid "In that case, ``this._super()`` will call the original implementation of a method being replaced/redefined. If the class already had sub-classes, all calls to ``this._super()`` in sub-classes will call the new implementations defined in the call to :func:`~odoo.web.Class.include`. This will also work if some instances of the class (or of any of its sub-classes) were created prior to the call to :func:`~odoo.Widget.include`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1224
|
||
msgid "Translations"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1226
|
||
msgid "The process to translate text in Python and JavaScript code is very similar. You could have noticed these lines at the beginning of the ``petstore.js`` file::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1233
|
||
msgid "These lines are simply used to import the translation functions in the current JavaScript module. They are used thus::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1238
|
||
msgid "In Odoo, translations files are automatically generated by scanning the source code. All piece of code that calls a certain function are detected and their content is added to a translation file that will then be sent to the translators. In Python, the function is ``_()``. In JavaScript the function is :func:`~odoo.web._t` (and also :func:`~odoo.web._lt`)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1244
|
||
msgid "``_t()`` will return the translation defined for the text it is given. If no translation is defined for that text, it will return the original text as-is."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1249
|
||
msgid "To inject user-provided values in translatable strings, it is recommended to use `_.str.sprintf <http://gabceb.github.io/underscore.string.site/#sprintf>`_ with named arguments *after* the translation::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1259
|
||
msgid "This makes translatable strings more readable to translators, and gives them more flexibility to reorder or ignore parameters."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1262
|
||
msgid ":func:`~odoo.web._lt` (\"lazy translate\") is similar but somewhat more complex: instead of translating its parameter immediately, it returns an object which, when converted to a string, will perform the translation."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1266
|
||
msgid "It is used to define translatable terms before the translations system is initialized, for class attributes for instance (as modules are loaded before the user's language is configured and translations are downloaded)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1271
|
||
msgid "Communication with the Odoo Server"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1274
|
||
msgid "Contacting Models"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1276
|
||
msgid "Most operations with Odoo involve communicating with *models* implementing business concern, these models will then (potentially) interact with some storage engine (usually PostgreSQL_)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1280
|
||
msgid "Although jQuery_ provides a `$.ajax`_ function for network interactions, communicating with Odoo requires additional metadata whose setup before every call would be verbose and error-prone. As a result, Odoo web provides higher-level communication primitives."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1285
|
||
msgid "To demonstrate this, the file ``petstore.py`` already contains a small model with a sample method:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1300
|
||
msgid "This declares a model with two fields, and a method ``my_method()`` which returns a literal dictionary."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1303
|
||
msgid "Here is a sample widget that calls ``my_method()`` and displays the result::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1316
|
||
msgid "The class used to call Odoo models is :class:`odoo.Model`. It is instantiated with the Odoo model's name as first parameter (``oepetstore.message_of_the_day`` here)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1320
|
||
msgid ":func:`~odoo.web.Model.call` can be used to call any (public) method of an Odoo model. It takes the following positional arguments:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1323
|
||
#: ../../content/developer/reference/actions.rst:19
|
||
#: ../../content/developer/reference/actions.rst:416
|
||
#: ../../content/developer/reference/data.rst:221
|
||
#: ../../content/developer/reference/views.rst:1456
|
||
#: ../../content/developer/reference/views.rst:1490
|
||
#: ../../content/developer/reference/views.rst:1570
|
||
#: ../../content/developer/reference/views.rst:1680
|
||
#: ../../content/developer/reference/views.rst:1841
|
||
#: ../../content/developer/reference/views.rst:1977
|
||
#: ../../content/developer/webservices/odoo.rst:1014
|
||
#: ../../content/developer/webservices/odoo.rst:1163
|
||
msgid "``name``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1324
|
||
msgid "The name of the method to call, ``my_method`` here"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1340
|
||
#: ../../content/developer/reference/views.rst:1458
|
||
msgid "``args``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1326
|
||
msgid "an array of `positional arguments`_ to provide to the method. Because the example has no positional argument to provide, the ``args`` parameter is not provided."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1330
|
||
msgid "Here is an other example with positional arguments:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1354
|
||
msgid "``kwargs``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1343
|
||
msgid "a mapping of `keyword arguments`_ to pass. The example provides a single named argument ``context``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1356
|
||
msgid ":func:`~odoo.Widget.call` returns a deferred resolved with the value returned by the model's method as first argument."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1360
|
||
msgid "CompoundContext"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1362
|
||
msgid "The previous section used a ``context`` argument which was not explained in the method call::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1367
|
||
msgid "The context is like a \"magic\" argument that the web client will always give to the server when calling a method. The context is a dictionary containing multiple keys. One of the most important key is the language of the user, used by the server to translate all the messages of the application. Another one is the time zone of the user, used to compute correctly dates and times if Odoo is used by people in different countries."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1374
|
||
msgid "The ``argument`` is necessary in all methods, otherwise bad things could happen (such as the application not being translated correctly). That's why, when you call a model's method, you should always provide that argument. The solution to achieve that is to use :class:`odoo.web.CompoundContext`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1379
|
||
msgid ":class:`~odoo.web.CompoundContext` is a class used to pass the user's context (with language, time zone, etc...) to the server as well as adding new keys to the context (some models' methods use arbitrary keys added to the context). It is created by giving to its constructor any number of dictionaries or other :class:`~odoo.web.CompoundContext` instances. It will merge all those contexts before sending them to the server."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1397
|
||
msgid "You can see the dictionary in the argument ``context`` contains some keys that are related to the configuration of the current user in Odoo plus the ``new_key`` key that was added when instantiating :class:`~odoo.web.CompoundContext`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1403
|
||
msgid "Queries"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1405
|
||
msgid "While :func:`~odoo.Model.call` is sufficient for any interaction with Odoo models, Odoo Web provides a helper for simpler and clearer querying of models (fetching of records based on various conditions): :func:`~odoo.Model.query` which acts as a shortcut for the common combination of :py:meth:`~odoo.models.Model.search` and ::py:meth:`~odoo.models.Model.read`. It provides a clearer syntax to search and read models::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1420
|
||
msgid "versus::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1430
|
||
msgid ":func:`~odoo.web.Model.query` takes an optional list of fields as parameter (if no field is provided, all fields of the model are fetched). It returns a :class:`odoo.web.Query` which can be further customized before being executed"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1434
|
||
msgid ":class:`~odoo.web.Query` represents the query being built. It is immutable, methods to customize the query actually return a modified copy, so it's possible to use the original and the new version side-by-side. See :class:`~odoo.web.Query` for its customization options."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1439
|
||
msgid "When the query is set up as desired, simply call :func:`~odoo.web.Query.all` to execute it and return a deferred to its result. The result is the same as :py:meth:`~odoo.models.Model.read`'s, an array of dictionaries where each dictionary is a requested record, with each requested field a dictionary key."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1446
|
||
msgid "Exercises"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1448
|
||
msgid "Message of the Day"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1450
|
||
msgid "Create a ``MessageOfTheDay`` widget displaying the last record of the ``oepetstore.message_of_the_day`` model. The widget should fetch its record as soon as it is displayed."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1454
|
||
msgid "Display the widget in the Pet Store home page."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1514
|
||
msgid "Pet Toys List"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1516
|
||
msgid "Create a ``PetToysList`` widget displaying 5 toys (using their name and their images)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1519
|
||
msgid "The pet toys are not stored in a new model, instead they're stored in ``product.product`` using a special category *Pet Toys*. You can see the pre-generated toys and add new ones by going to :menuselection:`Pet Store --> Pet Store --> Pet Toys`. You will probably need to explore ``product.product`` to create the right domain to select just pet toys."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1526
|
||
msgid "In Odoo, images are generally stored in regular fields encoded as base64_, HTML supports displaying images straight from base64 with :samp:`<img src=\"data:{mime_type};base64,{base64_image_data}\"/>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1530
|
||
msgid "The ``PetToysList`` widget should be displayed on the home page on the right of the ``MessageOfTheDay`` widget. You will need to make some layout with CSS to achieve this."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1650
|
||
msgid "Existing web components"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1653
|
||
msgid "The Action Manager"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1655
|
||
msgid "In Odoo, many operations start from an :ref:`action <reference/actions>`: opening a menu item (to a view), printing a report, ..."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1658
|
||
msgid "Actions are pieces of data describing how a client should react to the activation of a piece of content. Actions can be stored (and read through a model) or they can be generated on-the fly (locally to the client by javascript code, or remotely by a method of a model)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1663
|
||
msgid "In Odoo Web, the component responsible for handling and reacting to these actions is the *Action Manager*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1667
|
||
msgid "Using the Action Manager"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1669
|
||
msgid "The action manager can be invoked explicitly from javascript code by creating a dictionary describing :ref:`an action <reference/actions>` of the right type, and calling an action manager instance with it."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1673
|
||
msgid ":func:`~odoo.Widget.do_action` is a shortcut of :class:`~odoo.Widget` looking up the \"current\" action manager and executing the action::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1689
|
||
msgid "The most common action ``type`` is ``ir.actions.act_window`` which provides views to a model (displays a model in various manners), its most common attributes are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1693
|
||
#: ../../content/developer/reference/actions.rst:74
|
||
msgid "``res_model``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1694
|
||
msgid "The model to display in views"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1695
|
||
#: ../../content/developer/reference/actions.rst:86
|
||
msgid "``res_id`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1696
|
||
msgid "For form views, a preselected record in ``res_model``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1701
|
||
#: ../../content/developer/reference/actions.rst:83
|
||
msgid "``views``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1698
|
||
msgid "Lists the views available through the action. A list of ``[view_id, view_type]``, ``view_id`` can either be the database identifier of a view of the right type, or ``false`` to use the view by default for the specified type. View types can not be present multiple times. The action will open the first view of the list by default."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1704
|
||
#: ../../content/developer/reference/actions.rst:197
|
||
#: ../../content/developer/webservices/upgrade.rst:537
|
||
msgid "``target``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1704
|
||
msgid "Either ``current`` (the default) which replaces the \"content\" section of the web client by the action, or ``new`` to open the action in a dialog box."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1707
|
||
msgid "Additional context data to use within the action."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1709
|
||
msgid "Jump to Product"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1711
|
||
msgid "Modify the ``PetToysList`` component so clicking on a toy replaces the homepage by the toy's form view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1758
|
||
msgid "Client Actions"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1760
|
||
msgid "Throughout this guide, we used a simple ``HomePage`` widget which the web client automatically starts when we select the right menu item. But how did the Odoo web know to start this widget? Because the widget is registered as a *client action*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1765
|
||
msgid "A client action is (as its name implies) an action type defined almost entirely in the client, in javascript for Odoo web. The server simply sends an action tag (an arbitrary name), and optionally adds a few parameters, but beyond that *everything* is handled by custom client code."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1770
|
||
msgid "Our widget is registered as the handler for the client action through this::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1775
|
||
msgid "``instance.web.client_actions`` is a :class:`~odoo.web.Registry` in which the action manager looks up client action handlers when it needs to execute one. The first parameter of :class:`~odoo.web.Registry.add` is the name (tag) of the client action, and the second parameter is the path to the widget from the Odoo web client root."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1781
|
||
msgid "When a client action must be executed, the action manager looks up its tag in the registry, walks the specified path and displays the widget it finds at the end."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1785
|
||
msgid "a client action handler can also be a regular function, in whch case it'll be called and its result (if any) will be interpreted as the next action to execute."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1789
|
||
msgid "On the server side, we had simply defined an ``ir.actions.client`` action:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1797
|
||
msgid "and a menu opening the action:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1805
|
||
msgid "Architecture of the Views"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1807
|
||
msgid "Much of Odoo web's usefulness (and complexity) resides in views. Each view type is a way of displaying a model in the client."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1811
|
||
msgid "The View Manager"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1813
|
||
msgid "When an ``ActionManager`` instance receive an action of type ``ir.actions.act_window``, it delegates the synchronization and handling of the views themselves to a *view manager*, which will then set up one or multiple views depending on the original action's requirements:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1823
|
||
msgid "The Views"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1825
|
||
msgid "Most :ref:`Odoo views <reference/views>` are implemented through a subclass of :class:`odoo.web.View` which provides a bit of generic basic structure for handling events and displaying model information."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1829
|
||
msgid "The *search view* is considered a view type by the main Odoo framework, but handled separately by the web client (as it's a more permanent fixture and can interact with other views, which regular views don't do)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1833
|
||
msgid "A view is responsible for loading its own description XML (using :py:class:`~odoo.models.Model.fields_view_get`) and any other data source it needs. To that purpose, views are provided with an optional view identifier set as the :attr:`~odoo.web.View.view_id` attribute."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1838
|
||
msgid "Views are also provided with a :class:`~odoo.web.DataSet` instance which holds most necessary model information (the model name and possibly various record ids)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1842
|
||
msgid "Views may also want to handle search queries by overriding :func:`~odoo.web.View.do_search`, and updating their :class:`~odoo.web.DataSet` as necessary."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1847
|
||
msgid "The Form View Fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1849
|
||
msgid "A common need is the extension of the web form view to add new ways of displaying fields."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1852
|
||
msgid "All built-in fields have a default display implementation, a new form widget may be necessary to correctly interact with a new field type (e.g. a :term:`GIS` field) or to provide new representations and ways to interact with existing field types (e.g. validate :py:class:`~odoo.fields.Char` fields which should contain email addresses and display them as email links)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1859
|
||
msgid "To explicitly specify which form widget should be used to display a field, simply use the ``widget`` attribute in the view's XML description:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1868
|
||
msgid "the same widget is used in both \"view\" (read-only) and \"edit\" modes of a form view, it's not possible to use a widget in one and an other widget in the other"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1871
|
||
msgid "and a given field (name) can not be used multiple times in the same form"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1872
|
||
msgid "a widget may ignore the current mode of the form view and remain the same in both view and edit modes"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1875
|
||
msgid "most of this should probably move to an advanced form view guide"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1877
|
||
msgid "Fields are instantiated by the form view after it has read its XML description and constructed the corresponding HTML representing that description. After that, the form view will communicate with the field objects using some methods. These methods are defined by the ``FieldInterface`` interface. Almost all fields inherit the ``AbstractField`` abstract class. That class defines some default mechanisms that need to be implemented by most fields."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1885
|
||
msgid "Here are some of the responsibilities of a field class:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1887
|
||
msgid "The field class must display and allow the user to edit the value of the field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1888
|
||
msgid "It must correctly implement the 3 field attributes available in all fields of Odoo. The ``AbstractField`` class already implements an algorithm that dynamically calculates the value of these attributes (they can change at any moment because their value change according to the value of other fields). Their values are stored in *Widget Properties* (the widget properties were explained earlier in this guide). It is the responsibility of each field class to check these widget properties and dynamically adapt depending of their values. Here is a description of each of these attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1898
|
||
msgid "``required``: The field must have a value before saving. If ``required`` is ``true`` and the field doesn't have a value, the method ``is_valid()`` of the field must return ``false``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1901
|
||
msgid "``invisible``: When this is ``true``, the field must be invisible. The ``AbstractField`` class already has a basic implementation of this behavior that fits most fields."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1904
|
||
msgid "``readonly``: When ``true``, the field must not be editable by the user. Most fields in Odoo have a completely different behavior depending on the value of ``readonly``. As example, the ``FieldChar`` displays an HTML ``<input>`` when it is editable and simply displays the text when it is read-only. This also means it has much more code it would need to implement only one behavior, but this is necessary to ensure a good user experience."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1912
|
||
msgid "Fields have two methods, ``set_value()`` and ``get_value()``, which are called by the form view to give it the value to display and get back the new value entered by the user. These methods must be able to handle the value as given by the Odoo server when a ``read()`` is performed on a model and give back a valid value for a ``write()``. Remember that the JavaScript/Python data types used to represent the values given by ``read()`` and given to ``write()`` is not necessarily the same in Odoo. As example, when you read a many2one, it is always a tuple whose first value is the id of the pointed record and the second one is the name get (ie: ``(15, \"Agrolait\")``). But when you write a many2one it must be a single integer, not a tuple anymore. ``AbstractField`` has a default implementation of these methods that works well for simple data type and set a widget property named ``value``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1926
|
||
msgid "Please note that, to better understand how to implement fields, you are strongly encouraged to look at the definition of the ``FieldInterface`` interface and the ``AbstractField`` class directly in the code of the Odoo web client."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1932
|
||
msgid "Creating a New Type of Field"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1934
|
||
msgid "In this part we will explain how to create a new type of field. The example here will be to re-implement the ``FieldChar`` class and progressively explain each part."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1939
|
||
msgid "Simple Read-Only Field"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1941
|
||
msgid "Here is a first implementation that will only display text. The user will not be able to modify the content of the field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1958
|
||
msgid "In this example, we declare a class named ``FieldChar2`` inheriting from ``AbstractField``. We also register this class in the registry ``instance.web.form.widgets`` under the key ``char2``. That will allow us to use this new field in any form view by specifying ``widget=\"char2\"`` in the ``<field/>`` tag in the XML declaration of the view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1964
|
||
msgid "In this example, we define a single method: ``render_value()``. All it does is display the widget property ``value``. Those are two tools defined by the ``AbstractField`` class. As explained before, the form view will call the method ``set_value()`` of the field to set the value to display. This method already has a default implementation in ``AbstractField`` which simply sets the widget property ``value``. ``AbstractField`` also watch the ``change:value`` event on itself and calls the ``render_value()`` when it occurs. So, ``render_value()`` is a convenience method to implement in child classes to perform some operation each time the value of the field changes."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1974
|
||
msgid "In the ``init()`` method, we also define the default value of the field if none is specified by the form view (here we assume the default value of a ``char`` field should be an empty string)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1979
|
||
msgid "Read-Write Field"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1981
|
||
msgid "Read-only fields, which only display content and don't allow the user to modify it can be useful, but most fields in Odoo also allow editing. This makes the field classes more complicated, mostly because fields are supposed to handle both editable and non-editable mode, those modes are often completely different (for design and usability purpose) and the fields must be able to switch between modes at any moment."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:1988
|
||
msgid "To know in which mode the current field should be, the ``AbstractField`` class sets a widget property named ``effective_readonly``. The field should watch for changes in that widget property and display the correct mode accordingly. Example::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2036
|
||
msgid "In the ``start()`` method (which is called immediately after a widget has been appended to the DOM), we bind on the event ``change:effective_readonly``. That allows us to redisplay the field each time the widget property ``effective_readonly`` changes. This event handler will call ``display_field()``, which is also called directly in ``start()``. This ``display_field()`` was created specifically for this field, it's not a method defined in ``AbstractField`` or any other class. We can use this method to display the content of the field depending on the current mode."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2045
|
||
msgid "From now on the conception of this field is typical, except there is a lot of verifications to know the state of the ``effective_readonly`` property:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2048
|
||
msgid "In the QWeb template used to display the content of the widget, it displays an ``<input type=\"text\" />`` if we are in read-write mode and nothing in particular in read-only mode."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2051
|
||
msgid "In the ``display_field()`` method, we have to bind on the ``change`` event of the ``<input type=\"text\" />`` to know when the user has changed the value. When it happens, we call the ``internal_set_value()`` method with the new value of the field. This is a convenience method provided by the ``AbstractField`` class. That method will set a new value in the ``value`` property but will not trigger a call to ``render_value()`` (which is not necessary since the ``<input type=\"text\" />`` already contains the correct value)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2059
|
||
msgid "In ``render_value()``, we use a completely different code to display the value of the field depending if we are in read-only or in read-write mode."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2062
|
||
msgid "Create a Color Field"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2064
|
||
msgid "Create a ``FieldColor`` class. The value of this field should be a string containing a color code like those used in CSS (example: ``#FF0000`` for red). In read-only mode, this color field should display a little block whose color corresponds to the value of the field. In read-write mode, you should display an ``<input type=\"color\" />``. That type of ``<input />`` is an HTML5 component that doesn't work in all browsers but works well in Google Chrome. So it's OK to use as an exercise."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2072
|
||
msgid "You can use that widget in the form view of the ``message_of_the_day`` model for its field named ``color``. As a bonus, you can change the ``MessageOfTheDay`` widget created in the previous part of this guide to display the message of the day with the background color indicated in the ``color`` field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2137
|
||
msgid "The Form View Custom Widgets"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2139
|
||
msgid "Form fields are used to edit a single field, and are intrinsically linked to a field. Because this may be limiting, it is also possible to create *form widgets* which are not so restricted and have less ties to a specific lifecycle."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2144
|
||
msgid "Custom form widgets can be added to a form view through the ``widget`` tag:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2150
|
||
msgid "This type of widget will simply be created by the form view during the creation of the HTML according to the XML definition. They have properties in common with the fields (like the ``effective_readonly`` property) but they are not assigned a precise field. And so they don't have methods like ``get_value()`` and ``set_value()``. They must inherit from the ``FormWidget`` abstract class."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2157
|
||
msgid "Form widgets can interact with form fields by listening for their changes and fetching or altering their values. They can access form fields through their :attr:`~odoo.web.form.FormWidget.field_manager` attribute::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2177
|
||
msgid ":attr:`~odoo.web.form.FormWidget` is generally the :class:`~odoo.web.form.FormView` itself, but features used from it should be limited to those defined by :class:`~odoo.web.form.FieldManagerMixin`, the most useful being:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2182
|
||
msgid ":func:`~odoo.web.form.FieldManagerMixin.get_field_value(field_name)` which returns the value of a field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2184
|
||
msgid ":func:`~odoo.web.form.FieldManagerMixin.set_values(values)` sets multiple field values, takes a mapping of ``{field_name: value_to_set}``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2186
|
||
msgid "An event :samp:`field_changed:{field_name}` is triggered any time the value of the field called ``field_name`` is changed"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2189
|
||
msgid "Show Coordinates on Google Map"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2191
|
||
msgid "Add two fields to ``product.product`` storing a latitude and a longitude, then create a new form widget to display the latitude and longitude of a product's origin on a map"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2195
|
||
msgid "To display the map, use Google Map's embedding:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2202
|
||
msgid "where ``XXX`` should be replaced by the latitude and ``YYY`` by the longitude."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2205
|
||
msgid "Display the two position fields and a map widget using them in a new notebook page of the product's form view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2237
|
||
msgid "Get the Current Coordinate"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2239
|
||
msgid "Add a button resetting the product's coordinates to the location of the user, you can get these coordinates using the `javascript geolocation API`_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2243
|
||
msgid "Now we would like to display an additional button to automatically set the coordinates to the location of the current user."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2246
|
||
msgid "To get the coordinates of the user, an easy way is to use the geolocation JavaScript API. `See the online documentation to know how to use it`_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2251
|
||
msgid "Please also note that the user should not be able to click on that button when the form view is in read-only mode. So, this custom widget should handle correctly the ``effective_readonly`` property just like any field. One way to do this would be to make the button disappear when ``effective_readonly`` is true."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2302
|
||
msgid "as a separate concept from instances. In many languages classes are full-fledged objects and themselves instance (of metaclasses) but there remains two fairly separate hierarchies between classes and instances"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/web.rst:2306
|
||
msgid "as well as papering over cross-browser differences, although this has become less necessary over time"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:3
|
||
msgid "Building a Website"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:7
|
||
msgid "This guide assumes `basic knowledge of Python <http://docs.python.org/2/tutorial/>`_"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:9
|
||
msgid "This guide assumes :ref:`an installed Odoo <setup/install>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:12
|
||
msgid "Creating a basic module"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:14
|
||
msgid "In Odoo, tasks are performed by creating modules."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:16
|
||
msgid "Modules customize the behavior of an Odoo installation, either by adding new behaviors or by altering existing ones (including behaviors added by other modules)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:20
|
||
msgid ":ref:`Odoo's scaffolding <reference/cmdline/scaffold>` can setup a basic module. To quickly get started simply invoke:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:27
|
||
msgid "This will automatically create a ``my-modules`` *module directory* with an ``academy`` module inside. The directory can be an existing module directory if you want, but the module name must be unique within the directory."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:32
|
||
msgid "A demonstration module"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:34
|
||
msgid "We have a \"complete\" module ready for installation."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:36
|
||
msgid "Although it does absolutely nothing we can install it:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:38
|
||
msgid "start the Odoo server"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:44
|
||
msgid "go to http://localhost:8069"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:45
|
||
msgid "create a new database including demonstration data"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:46
|
||
msgid "to go :menuselection:`Settings --> Modules --> Modules`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:47
|
||
msgid "in the top-right corner remove the *Installed* filter and search for *academy*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:49
|
||
msgid "click the :guilabel:`Install` button for the *Academy* module"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:52
|
||
msgid "To the browser"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:54
|
||
msgid ":ref:`Controllers <reference/controllers>` interpret browser requests and send data back."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:57
|
||
msgid "Add a simple controller and ensure it is imported by ``__init__.py`` (so Odoo can find it):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:60
|
||
#: ../../content/developer/howtos/website.rst:96
|
||
#: ../../content/developer/howtos/website.rst:243
|
||
#: ../../content/developer/howtos/website.rst:301
|
||
#: ../../content/developer/howtos/website.rst:369
|
||
#: ../../content/developer/howtos/website.rst:384
|
||
#: ../../content/developer/howtos/website.rst:401
|
||
msgid "``academy/controllers.py``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:72
|
||
msgid "Shut down your server (:kbd:`^C`) then restart it:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:78
|
||
msgid "and open a page to http://localhost:8069/academy/academy/, you should see your \"page\" appear:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:84
|
||
msgid "Templates"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:86
|
||
msgid "Generating HTML in Python isn't very pleasant."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:88
|
||
msgid "The usual solution is templates_, pseudo-documents with placeholders and display logic. Odoo allows any Python templating system, but provides its own :ref:`QWeb <reference/qweb>` templating system which integrates with other features."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:93
|
||
msgid "Create a template and ensure the template file is registered in the ``__manifest__.py`` manifest, and alter the controller to use our template:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:107
|
||
#: ../../content/developer/howtos/website.rst:255
|
||
#: ../../content/developer/howtos/website.rst:313
|
||
#: ../../content/developer/howtos/website.rst:410
|
||
#: ../../content/developer/howtos/website.rst:429
|
||
#: ../../content/developer/howtos/website.rst:470
|
||
#: ../../content/developer/howtos/website.rst:497
|
||
#: ../../content/developer/howtos/website.rst:518
|
||
#: ../../content/developer/howtos/website.rst:532
|
||
#: ../../content/developer/howtos/website.rst:545
|
||
#: ../../content/developer/howtos/website.rst:969
|
||
#: ../../content/developer/howtos/website.rst:992
|
||
msgid "``academy/templates.xml``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:121
|
||
msgid "The templates iterates (``t-foreach``) on all the teachers (passed through the *template context*), and prints each teacher in its own paragraph."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:124
|
||
msgid "Finally restart Odoo and update the module's data (to install the template) by going to :menuselection:`Settings --> Modules --> Modules --> Academy` and clicking :guilabel:`Upgrade`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:130
|
||
msgid "Alternatively, Odoo can be restarted :option:`and update modules at the same time<odoo-bin -u>`:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:137
|
||
msgid "Going to http://localhost:8069/academy/academy/ should now result in:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:142
|
||
msgid "Storing data in Odoo"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:144
|
||
msgid ":ref:`Odoo models <reference/orm/model>` map to database tables."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:146
|
||
msgid "In the previous section we just displayed a list of string entered statically in the Python code. This doesn't allow modifications or persistent storage so we'll now move our data to the database."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:151
|
||
msgid "Defining the data model"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:153
|
||
msgid "Define a teacher model, and ensure it is imported from ``__init__.py`` so it is correctly loaded:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:156
|
||
#: ../../content/developer/howtos/website.rst:461
|
||
#: ../../content/developer/howtos/website.rst:656
|
||
#: ../../content/developer/howtos/website.rst:730
|
||
#: ../../content/developer/howtos/website.rst:796
|
||
#: ../../content/developer/howtos/website.rst:913
|
||
msgid "``academy/models.py``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:166
|
||
msgid "Then setup :ref:`basic access control <reference/security/acl>` for the model and add them to the manifest:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:169
|
||
#: ../../content/developer/howtos/website.rst:290
|
||
#: ../../content/developer/howtos/website.rst:586
|
||
#: ../../content/developer/howtos/website.rst:785
|
||
#: ../../content/developer/howtos/website.rst:846
|
||
#: ../../content/developer/howtos/website.rst:863
|
||
msgid "``academy/__manifest__.py``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:178
|
||
#: ../../content/developer/howtos/website.rst:665
|
||
msgid "``academy/security/ir.model.access.csv``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:184
|
||
msgid "this simply gives read access (``perm_read``) to all users (``group_id:id`` left empty)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:189
|
||
msgid ":ref:`Data files <reference/data>` (XML or CSV) must be added to the module manifest, Python files (models or controllers) don't but have to be imported from ``__init__.py`` (directly or indirectly)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:195
|
||
msgid "the administrator user bypasses access control, they have access to all models even if not given access"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:199
|
||
msgid "Demonstration data"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:201
|
||
msgid "The second step is to add some demonstration data to the system so it's possible to test it easily. This is done by adding a ``demo`` :ref:`data file <reference/data>`, which must be linked from the manifest:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:205
|
||
#: ../../content/developer/howtos/website.rst:884
|
||
msgid "``academy/demo.xml``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:224
|
||
msgid ":ref:`Data files <reference/data>` can be used for demo and non-demo data. Demo data are only loaded in \"demonstration mode\" and can be used for flow testing and demonstration, non-demo data are always loaded and used as initial system setup."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:229
|
||
msgid "In this case we're using demonstration data because an actual user of the system would want to input or import their own teachers list, this list is only useful for testing."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:234
|
||
msgid "Accessing the data"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:236
|
||
msgid "The last step is to alter model and template to use our demonstration data:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:238
|
||
msgid "fetch the records from the database instead of having a static list"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:239
|
||
msgid "Because :meth:`~odoo.models.Model.search` returns a set of records matching the filter (\"all records\" here), alter the template to print each teacher's ``name``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:269
|
||
msgid "Restart the server and update the module (in order to update the manifest and templates and load the demo file) then navigate to http://localhost:8069/academy/academy/. The page should look slightly different: names should simply be prefixed by a number (the database identifier for the teacher)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:276
|
||
msgid "Website support"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:278
|
||
msgid "Odoo bundles a module dedicated to building websites."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:280
|
||
msgid "So far we've used controllers fairly directly, but Odoo 8 added deeper integration and a few other services (e.g. default styling, theming) via the ``website`` module."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:284
|
||
msgid "first, add ``website`` as a dependency to ``academy``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:285
|
||
msgid "then add the ``website=True`` flag on the controller, this sets up a few new variables on :ref:`the request object <reference/http/request>` and allows using the website layout in our template"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:288
|
||
msgid "use the website layout in the template"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:333
|
||
msgid "After restarting the server while updating the module (in order to update the manifest and template) access http://localhost:8069/academy/academy/ should yield a nicer looking page with branding and a number of built-in page elements (top-level menu, footer, …)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:340
|
||
msgid "The website layout also provides support for editing tools: click :guilabel:`Sign In` (in the top-right), fill the credentials in (``admin`` / ``admin`` by default) then click :guilabel:`Log In`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:344
|
||
msgid "You're now in Odoo \"proper\": the administrative interface. For now click on the :guilabel:`Website` menu item (top-left corner."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:347
|
||
msgid "We're back in the website but as an administrator, with access to advanced editing features provided by the *website* support:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:350
|
||
msgid "a template code editor (:menuselection:`Customize --> HTML Editor`) where you can see and edit all templates used for the current page"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:352
|
||
msgid "the :guilabel:`Edit` button in the top-left switches to \"editing mode\" where blocks (snippets) and rich text editing are available"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:354
|
||
msgid "a number of other features such as mobile preview or :abbr:`SEO (Search Engine Optimization)`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:358
|
||
msgid "URLs and routing"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:360
|
||
msgid "Controller methods are associated with *routes* via the :func:`~odoo.http.route` decorator which takes a routing string and a number of attributes to customise its behavior or security."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:364
|
||
msgid "We've seen a \"literal\" routing string, which matches a URL section exactly, but routing strings can also use `converter patterns`_ which match bits of URLs and make those available as local variables. For instance we can create a new controller method which takes a bit of URL and prints it out:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:377
|
||
msgid "restart Odoo, access http://localhost:8069/academy/Alice/ and http://localhost:8069/academy/Bob/ and see the difference."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:380
|
||
msgid "As the name indicates, `converter patterns`_ don't just do extraction, they also do *validation* and *conversion*, so we can change the new controller to only accept integers:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:391
|
||
msgid "Restart Odoo, access http://localhost:8069/academy/2, note how the old value was a string, but the new one was converted to an integers. Try accessing http://localhost:8069/academy/Carol/ and note that the page was not found: since \"Carol\" is not an integer, the route was ignored and no route could be found."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:397
|
||
msgid "Odoo provides an additional converter called ``model`` which provides records directly when given their id. Let's use this to create a generic page for teacher biographies:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:426
|
||
msgid "then change the list of model to link to our new controller:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:448
|
||
msgid "Restart Odoo and upgrade the module, then you can visit each teacher's page. As an exercise, try adding blocks to a teacher's page to write a biography, then go to another teacher's page and so forth. You will discover, that your biography is shared between all teachers, because blocks are added to the *template*, and the *biography* template is shared between all teachers, when one page is edited they're all edited at the same time."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:456
|
||
msgid "Field editing"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:458
|
||
msgid "Data which is specific to a record should be saved on that record, so let us add a new biography field to our teachers:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:487
|
||
msgid "Restart Odoo and update the views, reload the teacher's page and… the field is invisible since it contains nothing."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:490
|
||
msgid "the view has been set to noupdate because modified previously, force via ``-i`` or do something else?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:493
|
||
msgid "For record fields, templates can use a special ``t-field`` directive which allows editing the field content from the website using field-specific interfaces. Change the *person* template to use ``t-field``:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:507
|
||
msgid "Restart Odoo and upgrade the module, there is now a placeholder under the teacher's name and a new zone for blocks in :guilabel:`Edit` mode. Content dropped there is stored in the corresponding teacher's ``biography`` field, and thus specific to that teacher."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:512
|
||
msgid "The teacher's name is also editable, and when saved the change is visible on the index page."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:515
|
||
msgid "``t-field`` can also take formatting options which depend on the exact field. For instance if we display the modification date for a teacher's record:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:529
|
||
msgid "it is displayed in a very \"computery\" manner and hard to read, but we could ask for a human-readable version:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:543
|
||
msgid "or a relative display:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:557
|
||
msgid "Administration and ERP integration"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:560
|
||
msgid "A brief and incomplete introduction to the Odoo administration"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:562
|
||
msgid "The Odoo administration was briefly seen during the `website support`_ section. We can go back to it using :menuselection:`Administrator --> Administrator` in the menu (or :guilabel:`Sign In` if you're signed out)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:566
|
||
msgid "The conceptual structure of the Odoo backend is simple:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:568
|
||
msgid "first are menus, a tree (menus can have sub-menus) of records. Menus without children map to…"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:570
|
||
msgid "actions. Actions have various types: links, reports, code which Odoo should execute or data display. Data display actions are called *window actions*, and tell Odoo to display a given *model* according to a set of views…"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:573
|
||
msgid "a view has a type, a broad category to which it corresponds (a list, a graph, a calendar) and an *architecture* which customises the way the model is displayed inside the view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:578
|
||
msgid "Editing in the Odoo administration"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:580
|
||
msgid "By default, an Odoo model is essentially invisible to a user. To make it visible it must be available through an action, which itself needs to be reachable, generally through a menu."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:584
|
||
msgid "Let's create a menu for our model:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:596
|
||
#: ../../content/developer/howtos/website.rst:627
|
||
#: ../../content/developer/howtos/website.rst:675
|
||
#: ../../content/developer/howtos/website.rst:747
|
||
#: ../../content/developer/howtos/website.rst:806
|
||
msgid "``academy/views.xml``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:613
|
||
msgid "then accessing http://localhost:8069/web/ in the top left should be a menu :guilabel:`Academy`, which is selected by default, as it is the first menu, and having opened a listing of teachers. From the listing it is possible to :guilabel:`Create` new teacher records, and to switch to the \"form\" by-record view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:619
|
||
msgid "If there is no definition of how to present records (a :ref:`view <reference/views>`) Odoo will automatically create a basic one on-the-fly. In our case it works for the \"list\" view for now (only displays the teacher's name) but in the \"form\" view the HTML ``biography`` field is displayed side-by-side with the ``name`` field and not given enough space. Let's define a custom form view to make viewing and editing teacher records a better experience:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:646
|
||
msgid "We have seen a pair of \"basic\" fields stored directly in the record. There are :ref:`a number of basic fields <reference/fields/basic>`. The second broad categories of fields are :ref:`relational <reference/fields/relational>` and used to link records to one another (within a model or across models)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:652
|
||
msgid "For demonstration, let's create a *courses* model. Each course should have a ``teacher`` field, linking to a single teacher record, but each teacher can teach many courses:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:672
|
||
msgid "let's also add views so we can see and edit a course's teacher:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:725
|
||
msgid "It should also be possible to create new courses directly from a teacher's page, or to see all the courses they teach, so add :class:`the inverse relationship <odoo.fields.One2many>` to the *teachers* model:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:769
|
||
msgid "Discussions and notifications"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:771
|
||
msgid "Odoo provides technical models, which don't directly fulfill business needs but which add capabilities to business objects without having to build them by hand."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:775
|
||
msgid "One of these is the *Chatter* system, part of Odoo's email and messaging system, which can add notifications and discussion threads to any model. The model simply has to :attr:`~odoo.models.Model._inherit` ``mail.thread``, and add the ``message_ids`` field to its form view to display the discussion thread. Discussion threads are per-record."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:781
|
||
msgid "For our academy, it makes sense to allow discussing courses to handle e.g. scheduling changes or discussions between teachers and assistants:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:826
|
||
msgid "At the bottom of each course form, there is now a discussion thread and the possibility for users of the system to leave messages and follow or unfollow discussions linked to specific courses."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:831
|
||
msgid "Selling courses"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:833
|
||
msgid "Odoo also provides business models which allow using or opting in business needs more directly. For instance the ``website_sale`` module sets up an e-commerce site based on the products in the Odoo system. We can easily make course subscriptions sellable by making our courses specific kinds of products."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:839
|
||
msgid "Rather than the previous classical inheritance, this means replacing our *course* model by the *product* model, and extending products in-place (to add anything we need to it)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:843
|
||
msgid "First of all we need to add a dependency on ``website_sale`` so we get both products (via ``sale``) and the ecommerce interface:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:857
|
||
msgid "restart Odoo, update your module, there is now a :guilabel:`Shop` section in the website, listing a number of pre-filled (via demonstration data) products."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:860
|
||
msgid "The second step is to replace the *courses* model by ``product.template``, and add a new category of product for courses:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:874
|
||
msgid "``academy/data.xml``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:923
|
||
msgid "With this installed, a few courses are now available in the :guilabel:`Shop`, though they may have to be looked for."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:928
|
||
msgid "to extend a model in-place, it's :attr:`inherited <odoo.models.Model._inherit>` without giving it a new :attr:`~odoo.models.Model._name`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:931
|
||
msgid "``product.template`` already uses the discussions system, so we can remove it from our extension model"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:933
|
||
msgid "we're creating our courses as *published* by default so they can be seen without having to log in"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:937
|
||
msgid "Altering existing views"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:939
|
||
msgid "So far, we have briefly seen:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:941
|
||
msgid "the creation of new models"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:942
|
||
msgid "the creation of new views"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:943
|
||
msgid "the creation of new records"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:944
|
||
msgid "the alteration of existing models"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:946
|
||
msgid "We're left with the alteration of existing records and the alteration of existing views. We'll do both on the :guilabel:`Shop` pages."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:949
|
||
msgid "View alteration is done by creating *extension* views, which are applied on top of the original view and alter it. These alteration views can be added or removed without modifying the original, making it easier to try things out and roll changes back."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:954
|
||
msgid "Since our courses are free, there is no reason to display their price on the shop page, so we're going to alter the view and hide the price if it's 0. The first task is finding out which view displays the price, this can be done via :menuselection:`Customize --> HTML Editor` which lets us read the various templates involved in rendering a page. Going through a few of them, \"Product item\" looks a likely culprit."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:961
|
||
msgid "Altering view architectures is done in 3 steps:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:963
|
||
msgid "Create a new view"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:964
|
||
msgid "Extend the view to modify by setting the new view's ``inherit_id`` to the modified view's external id"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:966
|
||
msgid "In the architecture, use the ``xpath`` tag to select and alter elements from the modified view"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:978
|
||
msgid "The second thing we will change is making the product categories sidebar visible by default: :menuselection:`Customize --> Product Categories` lets you toggle a tree of product categories (used to filter the main display) on and off."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:983
|
||
msgid "This is done via the ``customize_show`` and ``active`` fields of extension templates: an extension template (such as the one we've just created) can be *customize_show=True*. This choice will display the view in the :guilabel:`Customize` menu with a check box, allowing administrators to activate or disable them (and easily customize their website pages)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:989
|
||
msgid "We simply need to modify the *Product Categories* record and set its default to *active=\"True\"*:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/howtos/website.rst:999
|
||
msgid "With this, the *Product Categories* sidebar will automatically be enabled when the *Academy* module is installed."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference.rst:5
|
||
msgid "Reference"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:6
|
||
#: ../../content/developer/reference/iot.rst:138
|
||
msgid "Actions"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:8
|
||
msgid "Actions define the behavior of the system in response to user actions: login, action button, selection of an invoice, ..."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:11
|
||
msgid "Actions can be stored in the database or returned directly as dictionaries in e.g. button methods. All actions share two mandatory attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:15
|
||
#: ../../content/developer/reference/data.rst:135
|
||
#: ../../content/developer/reference/views.rst:1120
|
||
#: ../../content/developer/reference/views.rst:1156
|
||
#: ../../content/developer/reference/views.rst:1454
|
||
#: ../../content/developer/reference/views.rst:1742
|
||
msgid "``type``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:15
|
||
msgid "the category of the current action, determines which fields may be used and how the action is interpreted"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:18
|
||
msgid "short user-readable description of the action, may be displayed in the client's interface"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:21
|
||
msgid "A client can get actions in 4 forms:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:23
|
||
msgid "``False``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:24
|
||
msgid "if any action dialog is currently open, close it"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:26
|
||
msgid "A string"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:26
|
||
msgid "if a :ref:`client action <reference/actions/client>` matches, interpret as a client action's tag, otherwise treat as a number"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:29
|
||
msgid "A number"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:29
|
||
msgid "read the corresponding action record from the database, may be a database identifier or an :term:`external id`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:32
|
||
msgid "A dictionary"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:32
|
||
msgid "treat as a client action descriptor and execute"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:37
|
||
msgid "Bindings"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:39
|
||
msgid "Aside from their two mandatory attributes, all actions also share *optional* attributes used to present an action in an arbitrary model's contextual menu:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:45
|
||
msgid "``binding_model_id``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:43
|
||
msgid "specifies which model the action is bound to"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:45
|
||
msgid "For Server Actions, use ``model_id``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:55
|
||
msgid "``binding_type``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:48
|
||
msgid "specifies the type of binding, which is mostly which contextual menu the action will appear under"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:52
|
||
msgid "``action`` (default)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:52
|
||
msgid "Specifies that the action will appear in the :menuselection:`Action` contextual menu of the bound model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:55
|
||
msgid "``report``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:55
|
||
msgid "Specifies that the action will appear in the :menuselection:`Print` contextual menu of the bound model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:60
|
||
msgid "``binding_view_types``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:58
|
||
msgid "a comma-separated list of view types for which the action appears in the contextual menu, mostly \"list\" and / or \"form\". Defaults to ``list,form`` (both list and form )"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:65
|
||
msgid "Window Actions (``ir.actions.act_window``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:67
|
||
msgid "The most common action type, used to present visualisations of a model through :ref:`views <reference/views>`: a window action defines a set of view types (and possibly specific views) for a model (and possibly specific record of the model)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:72
|
||
msgid "Its fields are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:75
|
||
msgid "model to present views for"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:77
|
||
msgid "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 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 :meth:`~odoo.models.Model.fields_view_get`). The first type of the list is the default view type and will be open by default when the action is executed. Each view type should be present at most once in the list"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:86
|
||
msgid "if the default view is ``form``, specifies the record to load (otherwise a new record should be created)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:90
|
||
msgid "``search_view_id`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:89
|
||
msgid "``(id, name)`` pair, ``id`` is the database identifier of a specific search view to load for the action. Defaults to fetching the default search view for the model"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:95
|
||
#: ../../content/developer/reference/actions.rst:393
|
||
msgid "``target`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:93
|
||
msgid "whether the views should be open in the main content area (``current``), in full screen mode (``fullscreen``) or in a dialog/popup (``new``). Use ``main`` instead of ``current`` to clear the breadcrumbs. Defaults to ``current``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:97
|
||
#: ../../content/developer/reference/actions.rst:222
|
||
msgid "``context`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:98
|
||
msgid "additional context data to pass to the views"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:99
|
||
#: ../../content/developer/reference/views.rst:624
|
||
#: ../../content/developer/reference/views.rst:1891
|
||
msgid "``domain`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:100
|
||
msgid "filtering domain to implicitly add to all view search queries"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:103
|
||
msgid "``limit`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:102
|
||
msgid "number of records to display in lists by default. Defaults to 80 in the web client"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:105
|
||
msgid "For instance, to open customers (partner with the ``customer`` flag set) with list and form views::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:115
|
||
msgid "Or to open the form view of a specific product (obtained separately) in a new dialog::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:126
|
||
msgid "In-database window actions have a few different fields which should be ignored by clients, mostly to use in composing the ``views`` list:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:130
|
||
msgid "``view_mode`` (default= ``tree,form`` )"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:130
|
||
msgid "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)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:148
|
||
#: ../../content/developer/webservices/odoo.rst:1025
|
||
msgid "``view_ids``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:133
|
||
msgid "M2M\\ [#notquitem2m]_ to view objects, defines the initial content of ``views``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:136
|
||
msgid "Act_window views can also be defined cleanly through ``ir.actions.act_window.view``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:138
|
||
msgid "If you plan to allow multiple views for your model, prefer using ir.actions.act_window.view instead of the action ``view_ids``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:153
|
||
msgid "``view_id``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:151
|
||
msgid "specific view added to the ``views`` list in case its type is part of the ``view_mode`` list and not already filled by one of the views in ``view_ids``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:155
|
||
msgid "These are mostly used when defining actions from :ref:`reference/data`:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:166
|
||
msgid "will use the \"my_specific_view\" view even if that's not the default view for the model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:169
|
||
msgid "The server-side composition of the ``views`` sequence is the following:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:171
|
||
msgid "get each ``(id, type)`` from ``view_ids`` (ordered by ``sequence``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:172
|
||
msgid "if ``view_id`` is defined and its type isn't already filled, append its ``(id, type)``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:174
|
||
msgid "for each unfilled type in ``view_mode``, append ``(False, type)``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:178
|
||
msgid "``usage``?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:179
|
||
msgid "``groups_id``?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:180
|
||
msgid "``filter``?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:182
|
||
msgid "technically not an M2M: adds a sequence field and may be composed of just a view type, without a view id."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:188
|
||
msgid "URL Actions (``ir.actions.act_url``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:190
|
||
msgid "Allow opening a URL (website/web page) via an Odoo action. Can be customized via two fields:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:193
|
||
msgid "``url``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:194
|
||
msgid "the address to open when activating the action"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:196
|
||
msgid "opens the address in a new window/page if ``new``, replaces the current content with the page if ``self``. Defaults to ``new``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:207
|
||
msgid "will replace the current content section by the Odoo home page."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:212
|
||
msgid "Server Actions (``ir.actions.server``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:216
|
||
msgid "Allow triggering complex server code from any valid action location. Only two fields are relevant to clients:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:219
|
||
#: ../../content/developer/reference/data.rst:70
|
||
#: ../../content/developer/reference/data.rst:155
|
||
#: ../../content/developer/reference/data.rst:232
|
||
#: ../../content/developer/reference/data.rst:242
|
||
#: ../../content/developer/reference/views.rst:810
|
||
#: ../../content/developer/webservices/extract_api.rst:107
|
||
#: ../../content/developer/webservices/extract_api.rst:192
|
||
#: ../../content/developer/webservices/extract_api.rst:504
|
||
#: ../../content/developer/webservices/upgrade.rst:531
|
||
msgid "``id``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:220
|
||
msgid "the in-database identifier of the server action to run"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:222
|
||
msgid "context data to use when running the server action"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:224
|
||
msgid "In-database records are significantly richer and can perform a number of specific or generic actions based on their ``state``. Some fields (and corresponding behaviors) are shared between states:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:229
|
||
#: ../../content/developer/reference/actions.rst:433
|
||
#: ../../content/developer/webservices/odoo.rst:1161
|
||
msgid "``model_id``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:229
|
||
msgid "Odoo model linked to the action."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:231
|
||
#: ../../content/developer/webservices/odoo.rst:1019
|
||
#: ../../content/developer/webservices/odoo.rst:1170
|
||
#: ../../content/developer/webservices/upgrade.rst:545
|
||
msgid "``state``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:233
|
||
msgid "``code``: Executes python code given through the ``code`` argument."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:235
|
||
msgid "``object_create``: Creates a new record of model ``crud_model_id`` following ``fields_lines`` specifications."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:237
|
||
msgid "``object_write``: Updates the current record(s) following ``fields_lines`` specifications"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:239
|
||
msgid "``multi``: Executes serveral actions given through the ``child_ids`` argument."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:242
|
||
msgid "State fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:244
|
||
msgid "Depending on its state, the behavior is defined through different fields. The concerned state is given after each field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:289
|
||
msgid "``code`` (code)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:248
|
||
msgid "Specify a piece of Python code to execute when the action is called"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:263
|
||
msgid "The code segment can define a variable called ``action``, which will be returned to the client as the next action to execute:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:283
|
||
msgid "will ask the client to open a form for the record if it fulfills some condition"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:291
|
||
msgid "``crud_model_id`` (create)(required)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:292
|
||
msgid "model in which to create a new record"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:295
|
||
msgid "``link_field_id`` (create)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:294
|
||
msgid "many2one to ``ir.model.fields``, specifies the current record's m2o field on which the newly created record should be set (models should match)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:309
|
||
msgid "``fields_lines`` (create/write)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:298
|
||
msgid "fields to override when creating or copying the record. :class:`~odoo.fields.One2many` with the fields:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:302
|
||
msgid "``col1``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:302
|
||
msgid "``ir.model.fields`` to set in the concerned model (``crud_model_id`` for creates, ``model_id`` for updates)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:304
|
||
#: ../../content/developer/reference/orm.rst:827
|
||
msgid "``value``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:305
|
||
msgid "value for the field, interpreted via ``type``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:309
|
||
msgid "``type`` (value|reference|equation)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:307
|
||
msgid "If ``value``, the ``value`` field is interpreted as a literal value (possibly converted), if ``equation`` the ``value`` field is interpreted as a Python expression and evaluated"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:314
|
||
msgid "``child_ids`` (multi)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:312
|
||
msgid "Specify the multiple sub-actions (``ir.actions.server``) to enact in state multi. If sub-actions themselves return actions, the last one will be returned to the client as the multi's own next action"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:319
|
||
msgid "Evaluation context"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:321
|
||
msgid "A number of keys are available in the evaluation context of or surrounding server actions:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:324
|
||
msgid "``model`` model object linked to the action via ``model_id``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:325
|
||
msgid "``record``/``records`` record/recorset on which the action is triggered, can be void."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:326
|
||
msgid "``env`` Odoo Environment"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:327
|
||
msgid "``datetime``, ``dateutil``, ``time``, ``timezone`` corresponding Python modules"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:328
|
||
msgid "``log: log(message, level='info')`` logging function to record debug information in ir.logging table"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:329
|
||
msgid "``Warning`` constructor for the ``Warning`` exception"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:334
|
||
msgid "Report Actions (``ir.actions.report``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:336
|
||
msgid "Triggers the printing of a report."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:338
|
||
msgid "If you define your report through a `<record>` instead of a `<report>` tag and want the action to show up in the Print menu of the model's views, you will also need to specify ``binding_model_id`` from :ref:`reference/bindings`. It's not necessary to set ``binding_type`` to ``report``, since ``ir.actions.report`` will implicitly default to that."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:347
|
||
#: ../../content/developer/reference/reports.rst:195
|
||
#: ../../content/developer/reference/views.rst:616
|
||
#: ../../content/developer/reference/views.rst:719
|
||
#: ../../content/developer/reference/views.rst:807
|
||
msgid "``name`` (mandatory)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:346
|
||
msgid "used as the file name if ``print_report_name`` is not specified. Otherwise, only useful as a mnemonic/description of the report when looking for one in a list of some sort"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:349
|
||
msgid "``model`` (mandatory)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:350
|
||
msgid "the model your report will be about"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:351
|
||
msgid "``report_type`` (default=qweb-pdf)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:352
|
||
msgid "either ``qweb-pdf`` for PDF reports or ``qweb-html`` for HTML"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:353
|
||
msgid "``report_name`` (mandatory)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:354
|
||
msgid "the name (:term:`external id`) of the qweb template used to render the report"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:355
|
||
msgid "``print_report_name``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:356
|
||
msgid "python expression defining the name of the report."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:358
|
||
msgid "``groups_id``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:358
|
||
msgid ":class:`~odoo.fields.Many2many` field to the groups allowed to view/use the current report"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:360
|
||
msgid "``multi``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:361
|
||
msgid "if set to ``True``, the action will not be displayed on a form view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:363
|
||
msgid "``paperformat_id``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:363
|
||
msgid ":class:`~odoo.fields.Many2one` field to the paper format you wish to use for this report (if not specified, the company format will be used)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:370
|
||
msgid "``attachment_use``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:366
|
||
msgid "if set to ``True``, the report is only generated once the first time it is requested, and re-printed from the stored report afterwards instead of being re-generated every time."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:370
|
||
msgid "Can be used for reports which must only be generated once (e.g. for legal reasons)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:374
|
||
msgid "``attachment``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:373
|
||
msgid "python expression that defines the name of the report; the record is accessible as the variable ``object``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:379
|
||
msgid "Client Actions (``ir.actions.client``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:381
|
||
msgid "Triggers an action implemented entirely in the client."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:384
|
||
msgid "``tag``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:384
|
||
msgid "the client-side identifier of the action, an arbitrary string which the client should know how to react to"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:387
|
||
msgid "``params`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:387
|
||
msgid "a Python dictionary of additional data to send to the client, alongside the client action tag"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:390
|
||
msgid "whether the client action should be open in the main content area (``current``), in full screen mode (``fullscreen``) or in a dialog/popup (``new``). Use ``main`` instead of ``current`` to clear the breadcrumbs. Defaults to ``current``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:402
|
||
msgid "tells the client to start the Point of Sale interface, the server has no idea how the POS interface works."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:406
|
||
msgid ":ref:`Tutorial: Client Actions <howtos/web/client_actions>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:411
|
||
msgid "Automated Actions (``ir.cron``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:413
|
||
msgid "Actions triggered automatically on a predefined frequency."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:416
|
||
msgid "Name of the automated action (Mainly used in log display)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:419
|
||
msgid "``interval_number``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:419
|
||
msgid "Number of *interval_type* uom between two executions of the action"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:422
|
||
msgid "``interval_type``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:422
|
||
msgid "Unit of measure of frequency interval (``minutes``, ``hours``, ``days``, ``weeks``, ``months``,"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:426
|
||
msgid "``numbercall``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:425
|
||
msgid "Number of times this action has to be run. If the action is expected to run indefinitely, set to ``-1``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:430
|
||
msgid "``doall``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:429
|
||
msgid "Boolean precising whether the missed actions have to be executed in case of server restarts."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:433
|
||
msgid "Model on which this action will be called"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:441
|
||
msgid "``code``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:436
|
||
msgid "Code content of the action. Can be a simple call to the model's method :"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:443
|
||
msgid "``nextcall``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/actions.rst:444
|
||
msgid "Next planned execution date of this action (date/time format)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:6
|
||
msgid "Command-line interface: odoo-bin"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:11
|
||
msgid "Running the server"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:17
|
||
msgid "database(s) used when installing or updating modules. Providing a comma-separated list restrict access to databases provided in list."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:21
|
||
msgid "For advanced database options, take a look :ref:`below <reference/cmdline/server/database>`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:25
|
||
msgid "comma-separated list of modules to install before running the server (requires :option:`-d`)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:30
|
||
msgid "comma-separated list of modules to update before running the server (requires :option:`-d`)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:35
|
||
msgid "comma-separated list of directories in which modules are stored. These directories are scanned for modules."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:42
|
||
msgid "provide an alternate :ref:`configuration file <reference/cmdline/config>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:46
|
||
msgid "saves the server configuration to the current configuration file (:file:`{$HOME}/.odoorc` by default, and can be overridden using :option:`-c`)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:52
|
||
msgid "disables demo data loading for modules installed comma-separated, use ``all`` for all modules."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:57
|
||
msgid "runs tests after installing modules"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:61
|
||
msgid "select the tests to run by using tags."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:65
|
||
msgid "Specify directory where to write screenshots when an HttpCase.browser_js test fails. It defaults to :file:`/tmp/odoo_tests/{db_name}/screenshots`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:70
|
||
msgid "Enable screencasts and specify directory where to write screencasts files. The ``ffmpeg`` utility needs to be installed to encode frames into a video file. Otherwise frames will be kept instead of the video file."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:77
|
||
msgid "Database"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:81
|
||
msgid "database username, used to connect to PostgreSQL."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:85
|
||
msgid "database password, if using `password authentication`_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:89
|
||
msgid "host for the database server"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:91
|
||
msgid "``localhost`` on Windows"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:92
|
||
msgid "UNIX socket otherwise"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:96
|
||
msgid "port the database listens on, defaults to 5432"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:100
|
||
msgid "hides databases that do not match ``<filter>``. The filter is a `regular expression`_, with the additions that:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:103
|
||
msgid "``%h`` is replaced by the whole hostname the request is made on."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:104
|
||
msgid "``%d`` is replaced by the subdomain the request is made on, with the exception of ``www`` (so domain ``odoo.com`` and ``www.odoo.com`` both match the database ``odoo``)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:108
|
||
msgid "These operations are case sensitive. Add option ``(?i)`` to match all databases (so domain ``odoo.com`` using ``(?i)%d`` matches the database ``Odoo``)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:112
|
||
msgid "Since version 11, it's also possible to restrict access to a given database listen by using the --database parameter and specifying a comma-separated list of databases"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:116
|
||
msgid "When combining the two parameters, db-filter supersedes the comma-separated database list for restricting database list, while the comma-separated list is used for performing requested operations like upgrade of modules."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:124
|
||
msgid "Restrict access to databases whose name starts with 11"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:130
|
||
msgid "Restrict access to only two databases, 11firstdatabase and 11seconddatabase"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:136
|
||
msgid "Restrict access to only two databases, 11firstdatabase and 11seconddatabase, and update base module on one database: 11firstdatabase. If database 11seconddatabase doesn't exist, the database is created and base modules is installed"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:145
|
||
msgid "Restrict access to databases whose name starts with 11, and update base module on one database: 11firstdatabase. If database 11seconddatabase doesn't exist, the database is created and base modules is installed"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:152
|
||
msgid "when creating new databases from the database-management screens, use the specified `template database`_. Defaults to ``template0``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:157
|
||
msgid "Path to the PostgreSQL binaries that are used by the database manager to dump and restore databases. You have to specify this option only if these binaries are located in a non-standard directory."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:163
|
||
msgid "Suppresses the ability to list databases available on the system"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:167
|
||
msgid "Control the SSL security of the connection between Odoo and PostgreSQL. Value should bve one of 'disable', 'allow', 'prefer', 'require', 'verify-ca' or 'verify-full' Default value is 'prefer'"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:175
|
||
msgid "Emails"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:179
|
||
msgid "Email address used as <FROM> when Odoo needs to send mails"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:183
|
||
msgid "Address of the SMTP server to connect to in order to send mails"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:189
|
||
msgid "If set, odoo should use SSL/STARTSSL SMTP connections"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:193
|
||
msgid "Username to connect to the SMTP server"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:197
|
||
msgid "Password to connect to the SMTP server"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:202
|
||
msgid "Internationalisation"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:204
|
||
msgid "Use these options to translate Odoo to another language. See i18n section of the user manual. Option '-d' is mandatory. Option '-l' is mandatory in case of importation"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:210
|
||
msgid "specifies the languages (separated by commas) for the translations you want to be loaded"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:215
|
||
msgid "specify the language of the translation file. Use it with --i18n-export or --i18n-import"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:220
|
||
msgid "export all sentences to be translated to a CSV file, a PO file or a TGZ archive and exit."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:225
|
||
msgid "import a CSV or a PO file with translations and exit. The '-l' option is required."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:230
|
||
msgid "overwrites existing translation terms on updating a module or importing a CSV or a PO file."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:235
|
||
msgid "specify modules to export. Use in combination with --i18n-export"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:240
|
||
msgid "Advanced Options"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:245
|
||
msgid "Developer features"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:249
|
||
msgid "``all``: all the features below are activated"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:251
|
||
msgid "``xml``: read template qweb from xml file directly instead of database. Once a template has been modified in database, it will be not be read from the xml file until the next update/init."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:255
|
||
msgid "``reload``: restart server when python file are updated (may not be detected depending on the text editor used)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:258
|
||
msgid "``qweb``: break in the evaluation of qweb template when a node contains ``t-debug='debugger'``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:260
|
||
msgid "``(i)p(u)db``: start the chosen python debugger in the code when an unexpected error is raised before logging and returning the error."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:267
|
||
msgid "HTTP"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:271
|
||
msgid "do not start the HTTP or long-polling workers (may still start :ref:`cron <reference/actions/cron>` workers)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:274
|
||
msgid "has no effect if :option:`--test-enable` is set, as tests require an accessible HTTP server"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:279
|
||
msgid "TCP/IP address on which the HTTP server listens, defaults to ``0.0.0.0`` (all addresses)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:284
|
||
msgid "Port on which the HTTP server listens, defaults to 8069."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:288
|
||
msgid "TCP port for long-polling connections in multiprocessing or gevent mode, defaults to 8072. Not used in default (threaded) mode."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:293
|
||
msgid "enables the use of ``X-Forwarded-*`` headers through `Werkzeug's proxy support`_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:296
|
||
msgid "proxy mode *must not* be enabled outside of a reverse proxy scenario"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:302
|
||
msgid "Logging"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:304
|
||
msgid "By default, Odoo displays all logging of level_ ``info`` except for workflow logging (``warning`` only), and log output is sent to ``stdout``. Various options are available to redirect logging to other destinations and to customize the amount of logging output."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:311
|
||
msgid "sends logging output to the specified file instead of stdout. On Unix, the file `can be managed by external log rotation programs <https://docs.python.org/3/library/logging.handlers.html#watchedfilehandler>`_ and will automatically be reopened when replaced"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:318
|
||
msgid "logs to the system's event logger: `syslog on unices <https://docs.python.org/3/library/logging.handlers.html#sysloghandler>`_ and `the Event Log on Windows <https://docs.python.org/3/library/logging.handlers.html#nteventloghandler>`_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:321
|
||
msgid "Neither is configurable"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:325
|
||
msgid "logs to the ``ir.logging`` model (``ir_logging`` table) of the specified database. The database can be the name of a database in the \"current\" PostgreSQL, or `a PostgreSQL URI`_ for e.g. log aggregation."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:331
|
||
msgid ":samp:`{LOGGER}:{LEVEL}`, enables ``LOGGER`` at the provided ``LEVEL`` e.g. ``odoo.models:DEBUG`` will enable all logging messages at or above ``DEBUG`` level in the models."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:335
|
||
msgid "The colon ``:`` is mandatory"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:336
|
||
msgid "The logger can be omitted to configure the root (default) handler"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:337
|
||
msgid "If the level is omitted, the logger is set to ``INFO``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:339
|
||
msgid "The option can be repeated to configure multiple loggers e.g."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:347
|
||
msgid "enable DEBUG logging for RPC requests, equivalent to ``--log-handler=odoo.http.rpc.request:DEBUG``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:352
|
||
msgid "enable DEBUG logging for RPC responses, equivalent to ``--log-handler=odoo.http.rpc.response:DEBUG``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:357
|
||
msgid "enables DEBUG logging of HTTP requests and responses, equivalent to ``--log-handler=odoo.http:DEBUG``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:362
|
||
msgid "enables DEBUG logging of SQL querying, equivalent to ``--log-handler=odoo.sql_db:DEBUG``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:367
|
||
msgid "Shortcut to more easily set predefined levels on specific loggers. \"real\" levels (``critical``, ``error``, ``warn``, ``debug``) are set on the ``odoo`` and ``werkzeug`` loggers (except for ``debug`` which is only set on ``odoo``)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:372
|
||
msgid "Odoo also provides debugging pseudo-levels which apply to different sets of loggers:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:377
|
||
msgid "``debug_sql``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:376
|
||
msgid "sets the SQL logger to ``debug``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:378
|
||
msgid "equivalent to ``--log-sql``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:381
|
||
msgid "``debug_rpc``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:380
|
||
msgid "sets the ``odoo`` and HTTP request loggers to ``debug``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:382
|
||
msgid "equivalent to ``--log-level debug --log-request``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:387
|
||
msgid "``debug_rpc_answer``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:384
|
||
msgid "sets the ``odoo`` and HTTP request and response loggers to ``debug``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:387
|
||
msgid "equivalent to ``--log-level debug --log-request --log-response``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:391
|
||
msgid "In case of conflict between :option:`--log-level` and :option:`--log-handler`, the latter is used"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:397
|
||
msgid "Multiprocessing"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:401
|
||
msgid "if ``count`` is not 0 (the default), enables multiprocessing and sets up the specified number of HTTP workers (sub-processes processing HTTP and RPC requests)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:405
|
||
msgid "multiprocessing mode is only available on Unix-based systems"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:407
|
||
msgid "A number of options allow limiting and recycling workers:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:411
|
||
msgid "Number of requests a worker will process before being recycled and restarted."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:414
|
||
msgid "Defaults to *8196*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:418
|
||
msgid "Maximum allowed virtual memory per worker. If the limit is exceeded, the worker is killed and recycled at the end of the current request."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:421
|
||
msgid "Defaults to *2048MiB*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:425
|
||
msgid "Hard limit on virtual memory, any worker exceeding the limit will be immediately killed without waiting for the end of the current request processing."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:429
|
||
msgid "Defaults to *2560MiB*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:433
|
||
msgid "Prevents the worker from using more than <limit> CPU seconds for each request. If the limit is exceeded, the worker is killed."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:436
|
||
msgid "Defaults to *60*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:440
|
||
msgid "Prevents the worker from taking longer than <limit> seconds to process a request. If the limit is exceeded, the worker is killed."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:443
|
||
msgid "Differs from :option:`--limit-time-cpu` in that this is a \"wall time\" limit including e.g. SQL queries."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:446
|
||
msgid "Defaults to *120*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:450
|
||
msgid "number of workers dedicated to :ref:`cron <reference/actions/cron>` jobs. Defaults to *2*. The workers are threads in multi-threading mode and processes in multi-processing mode."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:453
|
||
msgid "For multi-processing mode, this is in addition to the HTTP worker processes."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:458
|
||
msgid "Configuration file"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:462
|
||
msgid "Most of the command-line options can also be specified via a configuration file. Most of the time, they use similar names with the prefix ``-`` removed and other ``-`` are replaced by ``_`` e.g. :option:`--db-template` becomes ``db_template``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:467
|
||
msgid "Some conversions don't match the pattern:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:469
|
||
msgid ":option:`--db-filter` becomes ``dbfilter``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:470
|
||
msgid ":option:`--no-http` corresponds to the ``http_enable`` boolean"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:471
|
||
msgid "logging presets (all options starting with ``--log-`` except for :option:`--log-handler` and :option:`--log-db`) just add content to ``log_handler``, use that directly in the configuration file"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:474
|
||
msgid ":option:`--smtp` is stored as ``smtp_server``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:475
|
||
msgid ":option:`--database` is stored as ``db_name``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:476
|
||
msgid ":option:`--i18n-import` and :option:`--i18n-export` aren't available at all from configuration files"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:479
|
||
msgid "The default configuration file is :file:`{$HOME}/.odoorc` which can be overridden using :option:`--config <odoo-bin -c>`. Specifying :option:`--save <odoo-bin -s>` will save the current configuration state back to that file. The configuration items relative to the command-line are to be specified in the section ``[options]``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:485
|
||
msgid "Here is a sample file:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:509
|
||
msgid "Shell"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:511
|
||
msgid "Odoo command-line also allows to launch odoo as a python console environment. This enables direct interaction with the :ref:`orm <reference/orm>` and its functionalities."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:521
|
||
msgid "Specify a preferred REPL to use in shell mode."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:527
|
||
msgid "Scaffolding"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:531
|
||
msgid "Scaffolding is the automated creation of a skeleton structure to simplify bootstrapping (of new modules, in the case of Odoo). While not necessary it avoids the tedium of setting up basic structures and looking up what all starting requirements are."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:536
|
||
msgid "Scaffolding is available via the :command:`odoo-bin scaffold` subcommand."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:544
|
||
msgid "the name of the module to create, may munged in various manners to generate programmatic names (e.g. module directory name, model names, …)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:549
|
||
msgid "directory in which to create the new module, defaults to the current directory"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:554
|
||
msgid "a template directory, files are passed through jinja2_ then copied to the ``destination`` directory"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:558
|
||
msgid "This will create module *my_module* in directory */addons/*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:563
|
||
msgid "Database Population"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:567
|
||
msgid "Odoo CLI supports database population features. If the feature is :ref:`implemented on a given model <reference/testing/populate/methods>`, it allows automatic data generation of the model's records to test your modules in databases containing non-trivial amounts of records."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:577
|
||
msgid "list of models for which the database should be filled"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:581
|
||
msgid "population size, the actual records number depends on the model's `_populate_sizes` attribute. The generated records content is specified by the :meth:`~odoo.models._populate_factories` method of a given model (cf. the :file:`populate` folder of modules for further details)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:587
|
||
msgid ":ref:`reference/testing/populate`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:591
|
||
msgid "Cloc"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:595
|
||
msgid "Odoo Cloc is a tool to count the number of relevant lines written in Python, Javascript or XML. This can be used as a rough metric for pricing maintenance of extra modules."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:600
|
||
msgid "Command-line options"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:605
|
||
msgid "Process the code of all extra modules installed on the provided database, and of all server actions and computed fields manually created in the provided database."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:607
|
||
msgid "The :option:`--addons-path` option is required to specify the path(s) to the module folder(s)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:610
|
||
msgid "If combined with :option:`--path`, the count will be that of the sum of both options' results (with possible overlaps). At least one of these two options is required to specify which code to process."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:617
|
||
msgid ":ref:`reference/cmdline/cloc/database-option`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:622
|
||
msgid "Process the files in the provided path."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:625
|
||
msgid "If combined with :option:`--database`, the count will be that of the sum of both options' results (with possible overlaps). At least one of these two options is required to specify which code to process."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:632
|
||
msgid "Multiple paths can be provided by repeating the option."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:639
|
||
msgid ":ref:`reference/cmdline/cloc/path-option`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:645
|
||
msgid "Comma-separated list of directories in which modules are stored. These directories are scanned for modules."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:646
|
||
msgid "Required if the :option:`--database` option is used."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:651
|
||
msgid "Specify a configuration file to use in place of the :option:`--addons-path` option."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:660
|
||
msgid "Show the details of lines counted for each file."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:664
|
||
msgid "Processed files"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:669
|
||
msgid "With the :option:`--database` option"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:671
|
||
msgid "Odoo Cloc counts the lines in each file of extra installed modules in a given database. In addition, it counts the Python lines of server actions and custom computed fields that have been directly created in the database or imported."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:676
|
||
msgid "Some files are excluded from the count by default:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:678
|
||
msgid "The manifest (:file:`__manifest__.py` or :file:`__openerp__.py`)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:679
|
||
msgid "The contents of the folder :file:`static/lib`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:680
|
||
msgid "The tests defined in the folder :file:`tests` and :file:`static/tests`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:681
|
||
msgid "The migrations scripts defined in the folder :file:`migrations`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:682
|
||
msgid "The XML files declared in the ``demo`` or ``demo_xml`` sections of the manifest"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:684
|
||
msgid "For special cases, a list of files that should be ignored by Odoo Cloc can be defined per module. This is specified by the ``cloc_exclude`` entry of the manifest:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:696
|
||
msgid "The pattern ``**/*`` can be used to ignore an entire module. This can be useful to exclude a module from maintenance service costs."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:698
|
||
msgid "For more information about the pattern syntax, see `glob <https://docs.python.org/3/library/pathlib.html#pathlib.Path.glob>`_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:705
|
||
msgid "With the :option:`--path` option"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:707
|
||
msgid "This method works the same as with the :ref:`--database option <reference/cmdline/cloc/database-option>` if a manifest file is present in the given folder. Otherwise, it counts all files."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:713
|
||
msgid "Identifying Extra Modules"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:715
|
||
msgid "To distinguish between standard and extra modules, Odoo Cloc uses the following heuristic: modules that are located (real file system path, after following symbolic links) in the same parent directory as the ``base``, ``web`` or ``web_enterprise`` standard modules are considered standard. Other modules are treated as extra modules."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:722
|
||
msgid "Error Handling"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:724
|
||
msgid "Some file cannot be counted by Odoo Cloc. Those file are reported at the end of the output."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:728
|
||
msgid "Max file size exceeded"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:730
|
||
msgid "Odoo Cloc rejects any file larger than 25MB. Usually, source files are smaller than 1 MB. If a file is rejected, it may be:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:733
|
||
msgid "A generated XML file that contains lots of data. It should be excluded in the manifest."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:734
|
||
msgid "A JavaScript library that should be placed in the :file:`static/lib` folder."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:737
|
||
msgid "Syntax Error"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/cmdline.rst:739
|
||
msgid "Odoo Cloc cannot count the lines of code of a Python file with a syntax problem. If an extra module contains such files, they should be fixed to allow the module to load. If the module works despite the presence of those files, they are probably not loaded and should therefore be removed from the module, or at least excluded in the manifest via ``cloc_exclude``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:6
|
||
msgid "Data Files"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:8
|
||
msgid "Odoo is greatly data-driven, and a big part of modules definition is thus the definition of the various records it manages: UI (menus and views), security (access rights and access rules), reports and plain data are all defined via records."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:16
|
||
msgid "The main way to define data in Odoo is via XML data files: The broad structure of an XML data file is the following:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:19
|
||
msgid "Any number of operation elements within the root element ``odoo``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:30
|
||
msgid "Data files are executed sequentially, operations can only refer to the result of operations defined previously"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:35
|
||
msgid "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."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:53
|
||
msgid "Core operations"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:58
|
||
#: ../../content/developer/reference/views.rst:387
|
||
#: ../../content/developer/reference/views.rst:1270
|
||
msgid "``record``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:60
|
||
msgid "``record`` appropriately defines or updates a database record, it has the following attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:63
|
||
#: ../../content/developer/reference/data.rst:153
|
||
msgid "``model`` (required)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:64
|
||
msgid "name of the model to create (or update)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:66
|
||
msgid "the :term:`external identifier` for this record. It is strongly recommended to provide one"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:69
|
||
msgid "for record creation, allows subsequent definitions to either modify or refer to this record"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:71
|
||
msgid "for record modification, the record to modify"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:73
|
||
msgid "context to use when creating the record"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:77
|
||
msgid "``forcecreate``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:75
|
||
msgid "in update mode whether the record should be created if it doesn't exist"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:77
|
||
msgid "Requires an :term:`external id`, defaults to ``True``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:80
|
||
#: ../../content/developer/reference/views.rst:369
|
||
#: ../../content/developer/reference/views.rst:881
|
||
#: ../../content/developer/reference/views.rst:1232
|
||
#: ../../content/developer/reference/views.rst:1560
|
||
#: ../../content/developer/reference/views.rst:1878
|
||
msgid "``field``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:82
|
||
msgid "Each record can be composed of ``field`` tags, defining values to set when creating the record. A ``record`` with no ``field`` will use all default values (creation) or do nothing (update)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:86
|
||
msgid "A ``field`` has a mandatory ``name`` attribute, the name of the field to set, and various methods to define the value itself:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:91
|
||
msgid "Nothing"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:90
|
||
msgid "if no value is provided for the field, an implicit ``False`` will be set on the field. Can be used to clear a field, or avoid using a default value for the field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:98
|
||
#: ../../content/developer/reference/data.rst:159
|
||
msgid "``search``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:94
|
||
msgid "for :ref:`relational fields <reference/fields/relational>`, should be a :ref:`domain <reference/orm/domains>` on the field's model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:97
|
||
msgid "Will evaluate the domain, search the field's model using it and set the search's result as the field's value. Will only use the first result if the field is a :class:`~odoo.fields.Many2one`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:104
|
||
msgid "``ref``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:101
|
||
msgid "if a ``ref`` attribute is provided, its value must be a valid :term:`external id`, which will be looked up and set as the field's value."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:104
|
||
msgid "Mostly for :class:`~odoo.fields.Many2one` and :class:`~odoo.fields.Reference` fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:107
|
||
msgid "if a ``type`` attribute is provided, it is used to interpret and convert the field's content. The field's content can be provided through an external file using the ``file`` attribute, or through the node's body."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:111
|
||
msgid "Available types are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:115
|
||
msgid "``xml``, ``html``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:114
|
||
msgid "extracts the ``field``'s children as a single document, evaluates any :term:`external id` specified with the form ``%(external_id)s``. ``%%`` can be used to output actual *%* signs."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:118
|
||
msgid "``file``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:118
|
||
msgid "ensures that the field content is a valid file path in the current model, saves the pair :samp:`{module},{path}` as the field value"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:121
|
||
msgid "``char``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:121
|
||
msgid "sets the field content directly as the field's value without alterations"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:124
|
||
msgid "``base64``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:124
|
||
msgid "base64_-encodes the field's content, useful combined with the ``file`` *attribute* to load e.g. image data into attachments"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:127
|
||
msgid "``int``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:127
|
||
msgid "converts the field's content to an integer and sets it as the field's value"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:130
|
||
msgid "``float``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:130
|
||
msgid "converts the field's content to a float and sets it as the field's value"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:135
|
||
msgid "``list``, ``tuple``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:133
|
||
msgid "should contain any number of ``value`` elements with the same properties as ``field``, each element resolves to an item of a generated tuple or list, and the generated collection is set as the field's value"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:145
|
||
msgid "``eval``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:138
|
||
msgid "for cases where the previous methods are unsuitable, the ``eval`` attributes simply evaluates whatever Python expression it is provided and sets the result as the field's value."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:142
|
||
msgid "The evaluation context contains various modules (``time``, ``datetime``, ``timedelta``, ``relativedelta``), a function to resolve :term:`external identifiers` (``ref``) and the model object for the current field if applicable (``obj``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:148
|
||
#: ../../content/developer/reference/views.rst:1314
|
||
msgid "``delete``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:150
|
||
msgid "The ``delete`` tag can remove any number of records previously defined. It has the following attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:154
|
||
msgid "the model in which a specified record should be deleted"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:156
|
||
msgid "the :term:`external id` of a record to remove"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:158
|
||
msgid "a :ref:`domain <reference/orm/domains>` to find records of the model to remove"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:161
|
||
msgid "``id`` and ``search`` are exclusive"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:164
|
||
msgid "``function``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:166
|
||
msgid "The ``function`` tag calls a method on a model, with provided parameters. It has two mandatory parameters ``model`` and ``name`` specifying respectively the model and the name of the method to call."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:170
|
||
msgid "Parameters can be provided using ``eval`` (should evaluate to a sequence of parameters to call the method with) or ``value`` elements (see ``list`` values)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:200
|
||
msgid "Shortcuts"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:202
|
||
msgid "Because some important structural models of Odoo are complex and involved, data files provide shorter alternatives to defining them using :ref:`record tags <reference/data/record>`:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:207
|
||
msgid "``menuitem``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:209
|
||
msgid "Defines an ``ir.ui.menu`` record with a number of defaults and fallbacks:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:218
|
||
msgid "``parent``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:212
|
||
msgid "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"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:214
|
||
msgid "If no ``parent`` is provided, tries to interpret the ``name`` attribute as a ``/``-separated sequence of menu names and find a place in the menu hierarchy. In that interpretation, intermediate menus are automatically created"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:218
|
||
msgid "Otherwise the menu is defined as a \"top-level\" menu item (*not* a menu with no parent)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:221
|
||
msgid "If no ``name`` attribute is specified, tries to get the menu name from a linked action if any. Otherwise uses the record's ``id``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:226
|
||
#: ../../content/developer/reference/data.rst:250
|
||
#: ../../content/developer/reference/views.rst:837
|
||
#: ../../content/developer/reference/views.rst:1499
|
||
#: ../../content/developer/reference/views.rst:1873
|
||
#: ../../content/developer/reference/views.rst:1983
|
||
#: ../../content/developer/webservices/odoo.rst:1175
|
||
msgid "``groups``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:224
|
||
msgid "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 is *removed* from the menu's groups"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:229
|
||
#: ../../content/developer/reference/views.rst:1454
|
||
msgid "``action``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:229
|
||
msgid "if specified, the ``action`` attribute should be the :term:`external id` of an action to execute when the menu is open"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:232
|
||
msgid "the menu item's :term:`external id`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:237
|
||
msgid "``template``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:239
|
||
msgid "Creates a :ref:`QWeb view <reference/views/qweb>` requiring only the ``arch`` section of the view, and allowing a few *optional* attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:243
|
||
msgid "the view's :term:`external identifier`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:245
|
||
msgid "``name``, ``inherit_id``, ``priority``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:245
|
||
msgid "same as the corresponding field on ``ir.ui.view`` (nb: ``inherit_id`` should be an :term:`external identifier`)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:248
|
||
msgid "``primary``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:248
|
||
msgid "if set to ``True`` and combined with a ``inherit_id``, defines the view as a primary"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:251
|
||
msgid "comma-separated list of group :term:`external identifiers`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:253
|
||
#: ../../content/developer/webservices/extract_api.rst:282
|
||
msgid "``page``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:253
|
||
msgid "if set to ``\"True\"``, the template is a website page (linkable to, deletable)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:258
|
||
msgid "``optional``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:256
|
||
msgid "``enabled`` or ``disabled``, whether the view can be disabled (in the website interface) and its default status. If unset, the view is always enabled."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:264
|
||
msgid "CSV data files"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:266
|
||
msgid "XML data files are flexible and self-descriptive, but very verbose when creating a number of simple records of the same model in bulk."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:269
|
||
msgid "For this case, data files can also use csv_, this is often the case for :ref:`access rights <reference/security/acl>`:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:272
|
||
msgid "the file name is :file:`{model_name}.csv`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:273
|
||
msgid "the first row lists the fields to write, with the special field ``id`` for :term:`external identifiers` (used for creation or update)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:275
|
||
msgid "each row thereafter creates a new record"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:277
|
||
msgid "Here's the first lines of the data file defining US states ``res.country.state.csv``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:283
|
||
msgid "rendered in a more readable format:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "id"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "country_id:id"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "name"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "code"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "state_au_1"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "au"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "Australian Capital Territory"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "ACT"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "state_au_2"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "New South Wales"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "NSW"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "state_au_3"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "Northern Territory"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "NT"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "state_au_4"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "Queensland"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "QLD"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "state_au_5"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "South Australia"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "SA"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "state_au_6"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "Tasmania"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "TAS"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "state_au_7"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "Victoria"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "VIC"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "state_au_8"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "Western Australia"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "WA"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "state_us_1"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "us"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "Alabama"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "AL"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "state_us_2"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "Alaska"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "AK"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "state_us_3"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "Arizona"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "AZ"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "state_us_4"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "Arkansas"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "AR"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "state_us_5"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "California"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "CA"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "state_us_6"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "Colorado"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/static/res.country.state.csv:1
|
||
msgid "CO"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:290
|
||
msgid "For each row (record):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:292
|
||
msgid "the first column is the :term:`external id` of the record to create or update"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:294
|
||
msgid "the second column is the :term:`external id` of the country object to link to (country objects must have been defined beforehand)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:296
|
||
msgid "the third column is the ``name`` field for ``res.country.state``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/data.rst:297
|
||
msgid "the fourth column is the ``code`` field for ``res.country.state``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:8
|
||
msgid "Odoo Guidelines"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:10
|
||
msgid "This page introduces the Odoo Coding Guidelines. Those aim to improve the quality of Odoo Apps code. Indeed proper code improves readability, eases maintenance, helps debugging, lowers complexity and promotes reliability. These guidelines should be applied to every new module and to all new development."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:17
|
||
msgid "When modifying existing files in **stable version** the original file style strictly supersedes any other style guidelines. In other words please never modify existing files in order to apply these guidelines. It avoids disrupting the revision history of code lines. Diff should be kept minimal. For more details, see our `pull request guide <https://odoo.com/submit-pr>`_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:25
|
||
msgid "When modifying existing files in **master (development) version** apply those guidelines to existing code only for modified code or if most of the file is under revision. In other words modify existing files structure only if it is going under major changes. In that case first do a **move** commit then apply the changes related to the feature."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:35
|
||
msgid "Directories"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:36
|
||
msgid "A module is organized in important directories. Those contain the business logic; having a look at them should make you understand the purpose of the module."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:39
|
||
msgid "*data/* : demo and data xml"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:40
|
||
msgid "*models/* : models definition"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:41
|
||
msgid "*controllers/* : contains controllers (HTTP routes)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:42
|
||
msgid "*views/* : contains the views and templates"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:43
|
||
msgid "*static/* : contains the web assets, separated into *css/, js/, img/, lib/, ...*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:45
|
||
msgid "Other optional directories compose the module."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:47
|
||
msgid "*wizard/* : regroups the transient models (``models.TransientModel``) and their views"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:48
|
||
msgid "*report/* : contains the printable reports and models based on SQL views. Python objects and XML views are included in this directory"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:49
|
||
msgid "*tests/* : contains the Python tests"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:53
|
||
msgid "File naming"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:55
|
||
msgid "File naming is important to quickly find information through all odoo addons. This section explains how to name files in a standard odoo module. As an example we use a `plant nursery <https://github.com/tivisse/odoodays-2018/tree/master/plant_nursery>`_ application. It holds two main models *plant.nursery* and *plant.order*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:60
|
||
msgid "Concerning *models*, split the business logic by sets of models belonging to a same main model. Each set lies in a given file named based on its main model. If there is only one model, its name is the same as the module name. Each inherited model should be in its own file to help understanding of impacted models."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:74
|
||
msgid "Concerning *security* and access rights and rules two main files should be used. First one is the definition of access rights done in a ``ir.model.access.csv`` file. User groups are defined in ``<module>_groups.xml``. Access rules are defined in ``<model>_security.xml``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:88
|
||
msgid "Concerning *views*, backend views should be split like models and suffixed by ``_views.xml``. Backend views are list, form, kanban, activity, graph, pivot, .. views. To ease split by model in views main menus not linked to specific actions may be extracted into an optional ``<module>_menus.xml`` file. Templates (QWeb pages used notably for portal / website display) and bundles (import of JS and CSS assets) are put in separate files. Those are respectively ``<model>_templates.xml`` and ``assets.xml`` files."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:108
|
||
msgid "Concerning *data*, split them by purpose (demo or data) and main model. Filenames will be the main_model name suffixed by ``_demo.xml`` or ``_data.xml``. For instance for an application having demo and data for its main model as well as subtypes, activities and mail templates all related to mail module:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:121
|
||
msgid "Concerning *controllers*, generally all controllers belong to a single controller contained in a file named ``<module_name>.py``. An old convention in Odoo is to name this file ``main.py`` but it is considered as outdated. If you need to inherit an existing controller from another module do it in ``<inherited_module_name>.py``. For example adding portal controller in an application is done in ``portal.py``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:135
|
||
msgid "Concerning *static files*, Javascript files follow globally the same logic as python models. Each component should be in its own file with a meaningful name. For instance, the activity widgets are located in ``activity.js`` of mail module. Subdirectories can also be created to structure the 'package' (see web module for more details). The same logic should be applied for the templates of JS widgets (static XML files) and for their styles (scss files). Don't link data (image, libraries) outside Odoo: do not use an URL to an image but copy it in the codebase instead."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:144
|
||
msgid "Concerning *wizards*, naming convention is the same of for python models: ``<transient>.py`` and ``<transient>_views.xml``. Both are put in the wizard directory. This naming comes from old odoo applications using the wizard keyword for transient models."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:156
|
||
msgid "Concerning *statistics reports* done with python / SQL views and classic views naming is the following :"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:166
|
||
msgid "Concerning *printable reports* which contain mainly data preparation and Qweb templates naming is the following :"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:176
|
||
msgid "The complete tree of our Odoo module therefore looks like"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:235
|
||
msgid "File names should only contain ``[a-z0-9_]`` (lowercase alphanumerics and ``_``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:238
|
||
msgid "Use correct file permissions : folder 755 and file 644."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:243
|
||
msgid "XML files"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:246
|
||
msgid "Format"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:247
|
||
msgid "To declare a record in XML, the **record** notation (using *<record>*) is recommended:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:249
|
||
msgid "Place ``id`` attribute before ``model``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:250
|
||
msgid "For field declaration, ``name`` attribute is first. Then place the *value* either in the ``field`` tag, either in the ``eval`` attribute, and finally other attributes (widget, options, ...) ordered by importance."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:255
|
||
msgid "Try to group the record by model. In case of dependencies between action/menu/views, this convention may not be applicable."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:257
|
||
msgid "Use naming convention defined at the next point"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:258
|
||
msgid "The tag *<data>* is only used to set not-updatable data with ``noupdate=1``. If there is only not-updatable data in the file, the ``noupdate=1`` can be set on the ``<odoo>`` tag and do not set a ``<data>`` tag."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:276
|
||
msgid "Odoo supports custom tags acting as syntactic sugar:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:278
|
||
msgid "menuitem: use it as a shortcut to declare a ``ir.ui.menu``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:279
|
||
msgid "template: use it to declare a QWeb View requiring only the ``arch`` section of the view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:280
|
||
msgid "report: use to declare a :ref:`report action <reference/actions/report>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:281
|
||
msgid "act_window: use it if the record notation can't do what you want"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:283
|
||
msgid "The 4 first tags are preferred over the *record* notation."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:287
|
||
msgid "XML IDs and naming"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:290
|
||
msgid "Security, View and Action"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:292
|
||
msgid "Use the following pattern :"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:294
|
||
msgid "For a menu: :samp:`{<model_name>}_menu`, or :samp:`{<model_name>}_menu_{do_stuff}` for submenus."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:295
|
||
msgid "For a view: :samp:`{<model_name>}_view_{<view_type>}`, where *view_type* is ``kanban``, ``form``, ``tree``, ``search``, ..."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:297
|
||
msgid "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 multiple actions are declared for the model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:301
|
||
msgid "For window actions: suffix the action name by the specific view information like :samp:`{<model_name>}_action_view_{<view_type>}`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:303
|
||
msgid "For a group: :samp:`{<module_name>}_group_{<group_name>}` where *group_name* is the name of the group, generally 'user', 'manager', ..."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:305
|
||
msgid "For a rule: :samp:`{<model_name>}_rule_{<concerned_group>}` where *concerned_group* is the short name of the concerned group ('user' for the 'model_name_group_user', 'public' for public user, 'company' for multi-company rules, ...)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:310
|
||
msgid "Name should be identical to xml id with dots replacing underscores. Actions should have a real naming as it is used as display name."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:364
|
||
msgid "Inheriting XML"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:366
|
||
msgid "Xml Ids of inheriting views should use the same ID as the original record. It helps finding all inheritance at a glance. As final Xml Ids are prefixed by the module that creates them there is no overlap."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:370
|
||
msgid "Naming should contain an ``.inherit.{details}`` suffix to ease understanding the override purpose when looking at its name."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:381
|
||
msgid "New primary views do not require the inherit suffix as those are new records based upon the first one."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:396
|
||
#: ../../content/developer/reference/qweb.rst:332
|
||
#: ../../content/developer/reference/security.rst:355
|
||
#: ../../content/developer/reference/security.rst:357
|
||
msgid "Python"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:400
|
||
msgid "Do not forget to read the :ref:`Security Pitfalls <reference/security/pitfalls>` section as well to write secure code."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:404
|
||
msgid "PEP8 options"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:406
|
||
msgid "Using a linter can help show syntax and semantic warnings or errors. Odoo source code tries to respect Python standard, but some of them can be ignored."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:409
|
||
msgid "E501: line too long"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:410
|
||
msgid "E301: expected 1 blank line, found 0"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:411
|
||
msgid "E302: expected 2 blank lines, found 1"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:414
|
||
msgid "Imports"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:415
|
||
msgid "The imports are ordered as"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:417
|
||
msgid "External libraries (one per line sorted and split in python stdlib)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:418
|
||
msgid "Imports of ``odoo``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:419
|
||
msgid "Imports from Odoo modules (rarely, and only if necessary)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:421
|
||
msgid "Inside these 3 groups, the imported lines are alphabetically sorted."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:439
|
||
msgid "Idiomatics of Programming (Python)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:441
|
||
msgid "Each python file should have ``# -*- coding: utf-8 -*-`` as first line."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:442
|
||
msgid "Always favor *readability* over *conciseness* or using the language features or idioms."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:443
|
||
msgid "Don't use ``.clone()``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:454
|
||
msgid "Python dictionary : creation and update"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:479
|
||
msgid "Use meaningful variable/class/method names"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:480
|
||
msgid "Useless variable : Temporary variables can make the code clearer by giving names to objects, but that doesn't mean you should create temporary variables all the time:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:492
|
||
msgid "Multiple return points are OK, when they're simpler"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:512
|
||
msgid "Know your builtins : You should at least have a basic understanding of all the Python builtins (http://docs.python.org/library/functions.html)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:520
|
||
msgid "Also, ``if 'key' in my_dict`` and ``if my_dict.get('key')`` have very different meaning, be sure that you're using the right one."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:523
|
||
msgid "Learn list comprehensions : Use list comprehension, dict comprehension, and basic manipulation using ``map``, ``filter``, ``sum``, ... They make the code easier to read."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:536
|
||
msgid "Collections are booleans too : In python, many objects have \"boolean-ish\" value when evaluated in a boolean context (such as an if). Among these are collections (lists, dicts, sets, ...) which are \"falsy\" when empty and \"truthy\" when containing items:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:547
|
||
msgid "So, you can write ``if some_collection:`` instead of ``if len(some_collection):``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:550
|
||
msgid "Iterate on iterables"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:564
|
||
msgid "Use dict.setdefault"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:580
|
||
msgid "As a good developer, document your code (docstring on methods, simple comments for tricky part of code)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:582
|
||
msgid "In additions to these guidelines, you may also find the following link interesting: http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html (a little bit outdated, but quite relevant)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:587
|
||
msgid "Programming in Odoo"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:589
|
||
msgid "Avoid to create generators and decorators: only use the ones provided by the Odoo API."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:591
|
||
msgid "As in python, use ``filtered``, ``mapped``, ``sorted``, ... methods to ease code reading and performance."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:596
|
||
msgid "Make your method work in batch"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:597
|
||
msgid "When adding a function, make sure it can process multiple records by iterating on self to treat each record."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:606
|
||
msgid "For performance issue, when developing a 'stat button' (for instance), do not perform a ``search`` or a ``search_count`` in a loop. It is recommended to use ``read_group`` method, to compute all value in only one request."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:621
|
||
msgid "Propagate the context"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:622
|
||
msgid "The context is a ``frozendict`` that cannot be modified. To call a method with a different context, the ``with_context`` method should be used :"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:631
|
||
msgid "Passing parameter in context can have dangerous side-effects."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:633
|
||
msgid "Since the values are propagated automatically, some unexpected behavior may appear. Calling ``create()`` method of a model with *default_my_field* key in context will set the default value of *my_field* for the concerned model. But if during this creation, other objects (such as sale.order.line, on sale.order creation) having a field name *my_field* are created, their default value will be set too."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:639
|
||
msgid "If you need to create a key context influencing the behavior of some object, choice a good name, and eventually prefix it by the name of the module to isolate its impact. A good example are the keys of ``mail`` module : *mail_create_nosubscribe*, *mail_notrack*, *mail_notify_user_signature*, ..."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:646
|
||
msgid "Think extendable"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:648
|
||
msgid "Functions and methods should not contain too much logic: having a lot of small and simple methods is more advisable than having few large and complex methods. A good rule of thumb is to split a method as soon as it has more than one responsibility (see http://en.wikipedia.org/wiki/Single_responsibility_principle)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:653
|
||
msgid "Hardcoding a business logic in a method should be avoided as it prevents to be easily extended by a submodule."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:679
|
||
msgid "The above code is over extendable for the sake of example but the readability must be taken into account and a tradeoff must be made."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:682
|
||
msgid "Also, name your functions accordingly: small and properly named functions are the starting point of readable/maintainable code and tighter documentation."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:685
|
||
msgid "This recommendation is also relevant for classes, files, modules and packages. (See also http://en.wikipedia.org/wiki/Cyclomatic_complexity)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:690
|
||
msgid "Never commit the transaction"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:691
|
||
msgid "The Odoo framework is in charge of providing the transactional context for all RPC calls. The principle is that a new database cursor is opened at the beginning of each RPC call, and committed when the call has returned, just before transmitting the answer to the RPC client, approximately like this:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:712
|
||
msgid "If any error occurs during the execution of the RPC call, the transaction is rolled back atomically, preserving the state of the system."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:715
|
||
msgid "Similarly, the system also provides a dedicated transaction during the execution of tests suites, so it can be rolled back or not depending on the server startup options."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:719
|
||
msgid "The consequence is that if you manually call ``cr.commit()`` anywhere there is a very high chance that you will break the system in various ways, because you will cause partial commits, and thus partial and unclean rollbacks, causing among others:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:724
|
||
msgid "inconsistent business data, usually data loss"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:725
|
||
msgid "workflow desynchronization, documents stuck permanently"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:726
|
||
msgid "tests that can't be rolled back cleanly, and will start polluting the database, and triggering error (this is true even if no error occurs during the transaction)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:737
|
||
msgid "Here is the very simple rule:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:731
|
||
msgid "You should **NEVER** call ``cr.commit()`` yourself, **UNLESS** you have created your own database cursor explicitly! And the situations where you need to do that are exceptional!"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:735
|
||
msgid "And by the way if you did create your own cursor, then you need to handle error cases and proper rollback, as well as properly close the cursor when you're done with it."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:739
|
||
msgid "And contrary to popular belief, you do not even need to call ``cr.commit()`` in the following situations: - in the ``_auto_init()`` method of an *models.Model* object: this is taken care of by the addons initialization method, or by the ORM transaction when creating custom models - in reports: the ``commit()`` is handled by the framework too, so you can update the database even from within a report - within *models.Transient* methods: these methods are called exactly like regular *models.Model* ones, within a transaction and with the corresponding ``cr.commit()/rollback()`` at the end - etc. (see general rule above if you have in doubt!)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:751
|
||
msgid "All ``cr.commit()`` calls outside of the server framework from now on must have an **explicit comment** explaining why they are absolutely necessary, why they are indeed correct, and why they do not break the transactions. Otherwise they can and will be removed !"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:758
|
||
msgid "Use translation method correctly"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:760
|
||
msgid "Odoo uses a GetText-like method named \"underscore\" ``_( )`` to indicate that a static string used in the code needs to be translated at runtime using the language of the context. This pseudo-method is accessed within your code by importing as follows:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:769
|
||
msgid "A few very important rules must be followed when using it, in order for it to work and to avoid filling the translations with useless junk."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:772
|
||
msgid "Basically, this method should only be used for static strings written manually in the code, it will not work to translate field values, such as Product names, etc. This must be done instead using the translate flag on the corresponding field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:777
|
||
msgid "The method accepts optional positional or named parameter The rule is very simple: calls to the underscore method should always be in the form ``_('literal string')`` and nothing else:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:820
|
||
msgid "Also, keep in mind that translators will have to work with the literal values that are passed to the underscore function, so please try to make them easy to understand and keep spurious characters and formatting to a minimum. Translators must be aware that formatting patterns such as ``%s`` or ``%d``, newlines, etc. need to be preserved, but it's important to use these in a sensible and obvious manner:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:840
|
||
msgid "In general in Odoo, when manipulating strings, prefer ``%`` over ``.format()`` (when only one variable to replace in a string), and prefer ``%(varname)`` instead of position (when multiple variables have to be replaced). This makes the translation easier for the community translators."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:847
|
||
msgid "Symbols and Conventions"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:857
|
||
msgid "Model name (using the dot notation, prefix by the module name) :"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:850
|
||
msgid "When defining an Odoo Model : use singular form of the name (*res.partner* and *sale.order* instead of *res.partnerS* and *saleS.orderS*)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:852
|
||
msgid "When defining an Odoo Transient (wizard) : use ``<related_base_model>.<action>`` where *related_base_model* is the base model (defined in *models/*) related to the transient, and *action* is the short name of what the transient do. Avoid the *wizard* word. For instance : ``account.invoice.make``, ``project.task.delegate.batch``, ..."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:856
|
||
msgid "When defining *report* model (SQL views e.i.) : use ``<related_base_model>.report.<action>``, based on the Transient convention."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:859
|
||
msgid "Odoo Python Class : use camelcase (Object-oriented style)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:870
|
||
msgid "Variable name :"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:868
|
||
msgid "use camelcase for model variable"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:869
|
||
msgid "use underscore lowercase notation for common variable."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:870
|
||
msgid "suffix your variable name with *_id* or *_ids* if it contains a record id or list of id. Don't use ``partner_id`` to contain a record of res.partner"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:878
|
||
msgid "``One2Many`` and ``Many2Many`` fields should always have *_ids* as suffix (example: sale_order_line_ids)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:879
|
||
msgid "``Many2One`` fields should have *_id* as suffix (example : partner_id, user_id, ...)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:889
|
||
msgid "Method conventions"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:881
|
||
msgid "Compute Field : the compute method pattern is *_compute_<field_name>*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:882
|
||
msgid "Search method : the search method pattern is *_search_<field_name>*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:883
|
||
msgid "Default method : the default method pattern is *_default_<field_name>*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:884
|
||
msgid "Selection method: the selection method pattern is *_selection_<field_name>*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:885
|
||
msgid "Onchange method : the onchange method pattern is *_onchange_<field_name>*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:886
|
||
msgid "Constraint method : the constraint method pattern is *_check_<constraint_name>*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:887
|
||
msgid "Action method : an object action method is prefix with *action_*. Since it uses only one record, add ``self.ensure_one()`` at the beginning of the method."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:900
|
||
msgid "In a Model attribute order should be"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:892
|
||
msgid "Private attributes (``_name``, ``_description``, ``_inherit``, ...)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:893
|
||
msgid "Default method and ``_default_get``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:894
|
||
msgid "Field declarations"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:895
|
||
msgid "Compute, inverse and search methods in the same order as field declaration"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:896
|
||
msgid "Selection method (methods used to return computed values for selection fields)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:897
|
||
msgid "Constrains methods (``@api.constrains``) and onchange methods (``@api.onchange``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:898
|
||
msgid "CRUD methods (ORM overrides)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:899
|
||
msgid "Action methods"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:900
|
||
msgid "And finally, other business methods."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:956
|
||
msgid "Javascript and CSS"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:959
|
||
msgid "Static files organization"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:961
|
||
msgid "Odoo addons have some conventions on how to structure various files. We explain here in more details how web assets are supposed to be organized."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:964
|
||
msgid "The first thing to know is that the Odoo server will serve (statically) all files located in a *static/* folder, but prefixed with the addon name. So, for example, if a file is located in *addons/web/static/src/js/some_file.js*, then it will be statically available at the url *your-odoo-server.com/web/static/src/js/some_file.js*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:969
|
||
msgid "The convention is to organize the code according to the following structure:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:971
|
||
msgid "*static*: all static files in general"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:973
|
||
msgid "*static/lib*: this is the place where js libs should be located, in a sub folder. So, for example, all files from the *jquery* library are in *addons/web/static/lib/jquery*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:975
|
||
msgid "*static/src*: the generic static source code folder"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:977
|
||
msgid "*static/src/css*: all css files"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:978
|
||
msgid "*static/src/fonts*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:979
|
||
msgid "*static/src/img*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:980
|
||
msgid "*static/src/js*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:982
|
||
msgid "*static/src/js/tours*: end user tour files (tutorials, not tests)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:984
|
||
msgid "*static/src/scss*: scss files"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:985
|
||
msgid "*static/src/xml*: all qweb templates that will be rendered in JS"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:987
|
||
msgid "*static/tests*: this is where we put all test related files."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:989
|
||
msgid "*static/tests/tours*: this is where we put all tour test files (not tutorials)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:992
|
||
msgid "Javascript coding guidelines"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:994
|
||
msgid "``use strict;`` is recommended for all javascript files"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:995
|
||
msgid "Use a linter (jshint, ...)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:996
|
||
msgid "Never add minified Javascript Libraries"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:997
|
||
msgid "Use camelcase for class declaration"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:999
|
||
msgid "More precise JS guidelines are detailed in the `github wiki <https://github.com/odoo/odoo/wiki/Javascript-coding-guidelines>`_. You may also have a look at existing API in Javascript by looking Javascript References."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1004
|
||
msgid "CSS coding guidelines"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1006
|
||
msgid "Prefix all your classes with *o_<module_name>* where *module_name* is the technical name of the module ('sale', 'im_chat', ...) or the main route reserved by the module (for website module mainly, i.e. : 'o_forum' for *website_forum* module). The only exception for this rule is the webclient: it simply uses *o_* prefix."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1011
|
||
msgid "Avoid using *id* tag"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1012
|
||
msgid "Use Bootstrap native classes"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1013
|
||
msgid "Use underscore lowercase notation to name class"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1018
|
||
msgid "Git"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1021
|
||
msgid "Configure your git"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1023
|
||
msgid "Based on ancestral experience and oral tradition, the following things go a long way towards making your commits more helpful:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1026
|
||
msgid "Be sure to define both the user.email and user.name in your local git config"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1032
|
||
msgid "Be sure to add your full name to your Github profile here. Please feel fancy and add your team, avatar, your favorite quote, and whatnot ;-)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1036
|
||
msgid "Commit message structure"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1038
|
||
msgid "Commit message has four parts: tag, module, short description and full description. Try to follow the preferred structure for your commit messages"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1061
|
||
msgid "Tag and module name"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1063
|
||
msgid "Tags are used to prefix your commit. They should be one of the following"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1065
|
||
msgid "**[FIX]** for bug fixes: mostly used in stable version but also valid if you are fixing a recent bug in development version;"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1067
|
||
msgid "**[REF]** for refactoring: when a feature is heavily rewritten;"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1068
|
||
msgid "**[ADD]** for adding new modules;"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1069
|
||
msgid "**[REM]** for removing resources: removing dead code, removing views, removing modules, ...;"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1071
|
||
msgid "**[REV]** for reverting commits: if a commit causes issues or is not wanted reverting it is done using this tag;"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1073
|
||
msgid "**[MOV]** for moving files: use git move and do not change content of moved file otherwise Git may loose track and history of the file; also used when moving code from one file to another;"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1076
|
||
msgid "**[REL]** for release commits: new major or minor stable versions;"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1077
|
||
msgid "**[IMP]** for improvements: most of the changes done in development version are incremental improvements not related to another tag;"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1079
|
||
msgid "**[MERGE]** for merge commits: used in forward port of bug fixes but also as main commit for feature involving several separated commits;"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1081
|
||
msgid "**[CLA]** for signing the Odoo Individual Contributor License;"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1082
|
||
msgid "**[I18N]** for changes in translation files;"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1084
|
||
msgid "After tag comes the modified module name. Use the technical name as functional name may change with time. If several modules are modified, list them or use various to tell it is cross-modules. Unless really required or easier avoid modifying code across several modules in the same commit. Understanding module history may become difficult."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1091
|
||
msgid "Commit message header"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1093
|
||
msgid "After tag and module name comes a meaningful commit message header. It should be self explanatory and include the reason behind the change. Do not use single words like \"bugfix\" or \"improvements\". Try to limit the header length to about 50 characters for readability."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1098
|
||
msgid "Commit message header should make a valid sentence once concatenated with ``if applied, this commit will <header>``. For example ``[IMP] base: prevent to archive users linked to active partners`` is correct as it makes a valid sentence ``if applied, this commit will prevent users to archive...``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1104
|
||
msgid "Commit message full description"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1106
|
||
msgid "In the message description specify the part of the code impacted by your changes (module name, lib, transversal object, ...) and a description of the changes."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1109
|
||
msgid "First explain WHY you are modifying code. What is important if someone goes back to your commit in about 4 decades (or 3 days) is why you did it. It is the purpose of the change."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1113
|
||
msgid "What you did can be found in the commit itself. If there was some technical choices involved it is a good idea to explain it also in the commit message after the why. For Odoo R&D developers \"PO team asked me to do it\" is not a valid why, by the way."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1117
|
||
msgid "Please avoid commits which simultaneously impact multiple modules. Try to split into different commits where impacted modules are different. It will be helpful if we need to revert changes in a given module separately."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1121
|
||
msgid "Don't hesitate to be a bit verbose. Most people will only see your commit message and judge everything you did in your life just based on those few sentences. No pressure at all."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1125
|
||
msgid "**You spend several hours, days or weeks working on meaningful features. Take some time to calm down and write clear and understandable commit messages.**"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1128
|
||
msgid "If you are an Odoo R&D developer the WHY should be the purpose of the task you are working on. Full specifications make the core of the commit message. **If you are working on a task that lacks purpose and specifications please consider making them clear before continuing.**"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1133
|
||
msgid "Finally here are some examples of correct commit messages :"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/guidelines.rst:1156
|
||
msgid "Use the long description to explain the *why* not the *what*, the *what* can be seen in the diff"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/http.rst:6
|
||
msgid "Web Controllers"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/http.rst:9
|
||
msgid "Controllers"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/http.rst:11
|
||
msgid "Controllers need to provide extensibility, much like :class:`~odoo.models.Model`, but can't use the same mechanism as the pre-requisites (a database with loaded modules) may not be available yet (e.g. no database created, or no database selected)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/http.rst:16
|
||
msgid "Controllers thus provide their own extension mechanism, separate from that of models:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/http.rst:19
|
||
msgid "Controllers are created by :ref:`inheriting <python:tut-inheritance>` from :class:`~odoo.http.Controller`. Routes are defined through methods decorated with :func:`~odoo.http.route`::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/http.rst:27
|
||
msgid "To *override* a controller, :ref:`inherit <python:tut-inheritance>` from its class and override relevant methods, re-exposing them if necessary::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/http.rst:36
|
||
msgid "decorating with :func:`~odoo.http.route` is necessary to keep the method (and route) visible: if the method is redefined without decorating, it will be \"unpublished\""
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/http.rst:39
|
||
msgid "the decorators of all methods are combined, if the overriding method's decorator has no argument all previous ones will be kept, any provided argument will override previously defined ones e.g.::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/http.rst:48
|
||
msgid "will change ``/some_url`` from public authentication to user (requiring a log-in)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/http.rst:52
|
||
#: ../../content/developer/reference/orm.rst:48
|
||
#: ../../content/developer/reference/qweb.rst:590
|
||
msgid "API"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/http.rst:57
|
||
msgid "Routing"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/http.rst:64
|
||
msgid "Request"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/http.rst:66
|
||
msgid "The request object is automatically set on :data:`odoo.http.request` at the start of the request"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/http.rst:78
|
||
#: ../../content/developer/webservices/extract_api.rst:103
|
||
#: ../../content/developer/webservices/extract_api.rst:188
|
||
#: ../../content/developer/webservices/extract_api.rst:500
|
||
msgid "Response"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:4
|
||
msgid "Internet of Things"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:6
|
||
msgid "IoT Drivers allow any Odoo module to communicate in real-time with any device connected to the IoT Box. Communication with the IoT Box goes both ways, so the Odoo client can send commands to and receive information from any of the supported devices."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:11
|
||
msgid "To add support for a device, all we need is:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:13
|
||
msgid "an `Interface`, to detect connected devices of a specific type"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:14
|
||
msgid "a `Driver`, to communicate with an individual device"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:16
|
||
msgid "At each boot, the IoT Box will load all of the Interfaces and Drivers that can be located on the connected Odoo instance. Each module can contain an `iot_handlers` directory that will be copied to the IoT Box. The structure of this directory is the following"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:35
|
||
msgid "Detect Devices"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:37
|
||
msgid "Devices connected to the IoT Box are detected through `Interfaces`. There is an Interface for each supported connection type (USB, Bluetooth, Video, Printers, Serial, etc.). The interface maintains a list of detected devices and associates them with the right Driver."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:42
|
||
msgid "Supported devices will appear both on the IoT Box Homepage that you can access through its IP address and in the IoT module of the connected Odoo instance."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:46
|
||
msgid "Interface"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:48
|
||
msgid "The role of the Interface is to maintain a list of devices connected through a determined connection type. Creating a new interface requires"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:51
|
||
msgid "Extending the `Interface` class"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:52
|
||
msgid "Setting the `connection_type` class attribute"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:53
|
||
msgid "Implementing the `get_devices` method, that should return a dictionary containing data about each detected device. This data will be given as argument to the constructors and `supported` method of the Drivers."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:58
|
||
msgid "Setting the `_loop_delay` attribute will modify the interval between calls to `get_devices`. By default, this interval is set to 3 seconds."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:75
|
||
msgid "Driver"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:77
|
||
msgid "Once the interface has retrieved the list of detected devices, it will loop through all of the Drivers that have the same `connection_type` attribute and test their respective `supported` method on all detected devices. If the supported method of a Driver returns `True`, an instance of this Driver will be created for the corresponding device."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:84
|
||
msgid "`supported` methods of drivers are given a priority order. The `supported` method of a child class will always be tested before the one of its parent. This priority can be adjusted by modifying the `priority` attribute of the Driver."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:89
|
||
msgid "Creating a new Driver requires:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:91
|
||
msgid "Extending `Driver`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:92
|
||
msgid "Setting the `connection_type` class attribute."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:93
|
||
msgid "Setting the `device_type`, `device_connection` and `device_name` attributes."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:94
|
||
msgid "Defining the `supported` method"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:114
|
||
msgid "Communicate With Devices"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:116
|
||
msgid "Once your new device is detected and appears in the IoT module, the next step is to communicate with it. Since the box only has a local IP address, it can only be reached from the same local network. Communication, therefore, needs to happen on the browser-side, in JavaScript."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:121
|
||
msgid "The process depends on the direction of the communication: - From the browser to the box, through `Actions`_ - From the box to the browser, through `Longpolling`_"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:125
|
||
msgid "Both channels are accessed from the same JS object, the `DeviceProxy`, which is instantiated using the IP of the IoT Box and the device identifier."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:140
|
||
msgid "Actions are used to tell a selected device to execute a specific action, such as taking a picture, printing a receipt, etc."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:144
|
||
msgid "It must be noted that no “answer” will be sent by the box on this route, only the request status. The answer to the action, if any, has to be retrieved via the longpolling."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:148
|
||
msgid "An action can be performed on the DeviceProxy Object."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:154
|
||
msgid "In your driver, define an `action` method that will be executed when called from an Odoo module. It takes the data given during the call as argument."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:163
|
||
msgid "Longpolling"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:165
|
||
msgid "When any module in Odoo wants to read data from a specific device, it creates a listener identified by the IP/domain of the box and the device identifier and passes it a callback function to be called every time the device status changes. The callback is called with the new data as argument."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/iot.rst:178
|
||
msgid "In the Driver, an event is released by calling the `device_changed` function from the `event_manager`. All callbacks set on the listener will then be called with `self.data` as argument."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:6
|
||
msgid "Javascript Cheatsheet"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:8
|
||
msgid "There are many ways to solve a problem in JavaScript, and in Odoo. However, the Odoo framework was designed to be extensible (this is a pretty big constraint), and some common problems have a nice standard solution. The standard solution has probably the advantage of being easy to understand for an odoo developers, and will probably keep working when Odoo is modified."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:14
|
||
msgid "This document tries to explain the way one could solve some of these issues. Note that this is not a reference. This is just a random collection of recipes, or explanations on how to proceed in some cases."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:19
|
||
msgid "First of all, remember that the first rule of customizing odoo with JS is: *try to do it in python*. This may seem strange, but the python framework is quite extensible, and many behaviours can be done simply with a touch of xml or python. This has usually a lower cost of maintenance than working with JS:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:24
|
||
msgid "the JS framework tends to change more, so JS code needs to be more frequently updated"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:26
|
||
msgid "it is often more difficult to implement a customized behaviour if it needs to communicate with the server and properly integrate with the javascript framework. There are many small details taken care by the framework that customized code needs to replicate. For example, responsiveness, or updating the url, or displaying data without flickering."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:33
|
||
msgid "This document does not really explain any concepts. This is more a cookbook. For more details, please consult the javascript reference page (see :doc:`javascript_reference`)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:38
|
||
msgid "Creating a new field widget"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:40
|
||
msgid "This is probably a really common usecase: we want to display some information in a form view in a really specific (maybe business dependent) way. For example, assume that we want to change the text color depending on some business condition."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:44
|
||
msgid "This can be done in three steps: creating a new widget, registering it in the field registry, then adding the widget to the field in the form view"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:58
|
||
msgid "creating a new widget:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:48
|
||
msgid "This can be done by extending a widget:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:68
|
||
msgid "registering it in the field registry:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:61
|
||
msgid "The web client needs to know the mapping between a widget name and its actual class. This is done by a registry:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:77
|
||
msgid "adding the widget in the form view"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:75
|
||
msgid "Note that only the form, list and kanban views use this field widgets registry. These views are tightly integrated, because the list and kanban views can appear inside a form view)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:80
|
||
msgid "Modifying an existing field widget"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:82
|
||
msgid "Another use case is that we want to modify an existing field widget. For example, the voip addon in odoo need to modify the FieldPhone widget to add the possibility to easily call the given number on voip. This is done by *including* the FieldPhone widget, so there is no need to change any existing form view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:87
|
||
msgid "Field Widgets (instances of (subclass of) AbstractField) are like every other widgets, so they can be monkey patched. This looks like this:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:109
|
||
msgid "Note that there is no need to add the widget to the registry, since it is already registered."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:113
|
||
msgid "Modifying a main widget from the interface"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:115
|
||
msgid "Another common usecase is the need to customize some elements from the user interface. For example, adding a message in the home menu. The usual process in this case is again to *include* the widget. This is the only way to do it, since there are no registries for those widgets."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:120
|
||
msgid "This is usually done with code looking like this:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:136
|
||
msgid "Creating a new view (from scratch)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:138
|
||
msgid "Creating a new view is a more advanced topic. This cheatsheet will only highlight the steps that will probably need to be done (in no particular order):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:141
|
||
msgid "adding a new view type to the field ``type`` of ``ir.ui.view``::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:148
|
||
msgid "adding the new view type to the field ``view_mode`` of ``ir.actions.act_window.view``::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:179
|
||
msgid "creating the four main pieces which makes a view (in JavaScript):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:157
|
||
msgid "we need a view (a subclass of ``AbstractView``, this is the factory), a renderer (from ``AbstractRenderer``), a controller (from ``AbstractController``) and a model (from ``AbstractModel``). I suggest starting by simply extending the superclasses:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:189
|
||
msgid "adding the view to the registry:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:182
|
||
msgid "As usual, the mapping between a view type and the actual class needs to be updated:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:196
|
||
msgid "implementing the four main classes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:192
|
||
msgid "The ``View`` class needs to parse the ``arch`` field and setup the other three classes. The ``Renderer`` is in charge of representing the data in the user interface, the ``Model`` is supposed to talk to the server, to load data and process it. And the ``Controller`` is there to coordinate, to talk to the web client, ..."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:210
|
||
msgid "creating some views in the database:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:213
|
||
msgid "Customizing an existing view"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:215
|
||
msgid "Assume we need to create a custom version of a generic view. For example, a kanban view with some extra *ribbon-like* widget on top (to display some specific custom information). In that case, this can be done with 3 steps: extend the kanban view (which also probably mean extending controllers/renderers and/or models), then registering the view in the view registry, and finally, using the view in the kanban arch (a specific example is the helpdesk dashboard)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:245
|
||
msgid "extending a view:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:223
|
||
msgid "Here is what it could look like:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:254
|
||
msgid "adding it to the view registry:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:248
|
||
msgid "as usual, we need to inform the web client of the mapping between the name of the views and the actual class."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:273
|
||
msgid "using it in an actual view:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:257
|
||
msgid "we now need to inform the web client that a specific ``ir.ui.view`` needs to use our new class. Note that this is a web client specific concern. From the point of view of the server, we still have a kanban view. The proper way to do this is by using a special attribute ``js_class`` (which will be renamed someday into ``widget``, because this is really not a good name) on the root node of the arch:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:277
|
||
msgid "Note: you can change the way the view interprets the arch structure. However, from the server point of view, this is still a view of the same base type, subjected to the same rules (rng validation, for example). So, your views still need to have a valid arch field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:283
|
||
msgid "Promises and asynchronous code"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:285
|
||
msgid "For a very good and complete introduction to promises, please read this excellent article https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/async%20%26%20performance/ch3.md"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:288
|
||
msgid "Creating new Promises"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:307
|
||
msgid "turn a constant into a promise"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:290
|
||
msgid "There are 2 static functions on Promise that create a resolved or rejected promise based on a constant:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:306
|
||
msgid "Note that even if the promises are created already resolved or rejected, the `then` or `catch` handlers will still be called asynchronously."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:320
|
||
msgid "based on an already asynchronous code"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:310
|
||
msgid "Suppose that in a function you must do a rpc, and when it is completed set the result on this. The `this._rpc` is a function that returns a `Promise`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:350
|
||
msgid "for callback based function"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:323
|
||
msgid "Suppose that you were using a function `this.close` that takes as parameter a callback that is called when the closing is finished. Now suppose that you are doing that in a method that must send a promise that is resolved when the closing is finished."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:336
|
||
msgid "line 2: we save the `this` into a variable so that in an inner function, we can access the scope of our component"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:338
|
||
msgid "line 3: we create and return a new promise. The constructor of a promise takes a function as parameter. This function itself has 2 parameters that we called here `resolve` and `reject`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:338
|
||
msgid "`resolve` is a function that, when called, puts the promise in the resolved state."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:339
|
||
msgid "`reject` is a function that, when called, puts the promise in the rejected state. We do not use reject here and it can be omitted."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:340
|
||
msgid "line 4: we are calling the function close on our object. It takes a function as parameter (the callback) and it happens that resolve is already a function, so we can pass it directly. To be clearer, we could have written:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:366
|
||
msgid "creating a promise generator (calling one promise after the other *in sequence* and waiting for the last one)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:353
|
||
msgid "Suppose that you need to loop over an array, do an operation *in sequence* and resolve a promise when the last operation is done."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:367
|
||
msgid "This way, the promise you return is effectively the last promise."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:382
|
||
msgid "creating a promise, then resolving it outside the scope of its definition (anti-pattern)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:369
|
||
msgid "we do not recommend using this, but sometimes it is useful. Think carefully for alternatives first..."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:385
|
||
msgid "Waiting for Promises"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:404
|
||
msgid "waiting for a number of Promises"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:387
|
||
msgid "if you have multiple promises that all need to be waited, you can convert them into a single promise that will be resolved when all the promises are resolved using Promise.all(arrayOfPromises)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:419
|
||
msgid "waiting for a part of a promise chain, but not another part"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:407
|
||
msgid "If you have an asynchronous process that you want to wait to do something, but you also want to return to the caller before that something is done."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:422
|
||
msgid "Error handling"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:446
|
||
msgid "in general in promises"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:425
|
||
msgid "The general idea is that a promise should not be rejected for control flow, but should only be rejected for errors. When that is the case, you would have multiple resolutions of your promise with, for instance status codes that you would have to check in the `then` handlers and a single `catch` handler at the end of the promise chain."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:486
|
||
msgid "in Odoo specifically"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:449
|
||
msgid "In Odoo, it happens that we use promise rejection for control flow, like in mutexes and other concurrency primitives defined in module `web.concurrency` We also want to execute the catch for *business* reasons, but not when there is a coding error in the definition of the promise or of the handlers. For this, we have introduced the concept of `guardedCatch`. It is called like `catch` but not when the rejected reason is an error"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:489
|
||
msgid "Testing asynchronous code"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:543
|
||
msgid "using promises in tests"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:492
|
||
msgid "In the tests code, we support the latest version of Javascript, including primitives like `async` and `await`. This makes using and waiting for promises very easy. Most helper methods also return a promise (either by being marked `async` or by returning a promise directly."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_cheatsheet.rst:544
|
||
msgid "as you can see, the nicer form is to use `async/await` as it is clearer and shorter to write."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:8
|
||
msgid "Javascript Reference"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:10
|
||
msgid "This document presents the Odoo Javascript framework. This framework is not a large application in term of lines of code, but it is quite generic, because it is basically a machine to turn a declarative interface description into a live application, able to interact with every model and records in the database. It is even possible to use the web client to modify the interface of the web client."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:18
|
||
#: ../../content/developer/webservices/iap.rst:26
|
||
msgid "Overview"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:20
|
||
msgid "The Javascript framework is designed to work with three main use cases:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:22
|
||
msgid "the *web client*: this is the private web application, where one can view and edit business data. This is a single page application (the page is never reloaded, only the new data is fetched from the server whenever it is needed)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:25
|
||
msgid "the *website*: this is the public part of Odoo. It allows an unidentified user to browse some content, to shop or to perform many actions, as a client. This is a classical website: various routes with controllers and some javascript to make it work."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:29
|
||
msgid "the *point of sale*: this is the interface for the point of sale. It is a specialized single page application."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:32
|
||
msgid "Some javascript code is common to these three use cases, and is bundled together (see below in the assets section). This document will focus mostly on the web client design."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:37
|
||
msgid "Web client"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:40
|
||
msgid "Single Page Application"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:42
|
||
msgid "In short, the *webClient*, instance of *WebClient* is the root component of the whole user interface. Its responsibility is to orchestrate all various subcomponents, and to provide services, such as rpcs, local storage and more."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:46
|
||
msgid "In runtime, the web client is a single page application. It does not need to request a full page from the server each time the user perform an action. Instead, it only requests what it needs, and then replaces/updates the view. Also, it manages the url: it is kept in sync with the web client state."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:51
|
||
msgid "It means that while a user is working on Odoo, the web client class (and the action manager) actually creates and destroys many sub components. The state is highly dynamic, and each widget could be destroyed at any time."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:56
|
||
msgid "Overview of web client JS code"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:58
|
||
msgid "Here, we give a very quick overview on the web client code, in the *web/static/src/js* addon. Note that it is deliberately not exhaustive. We only cover the most important files/folders."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:62
|
||
msgid "*boot.js*: this is the file that defines the module system. It needs to be loaded first."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:64
|
||
msgid "*core/*: this is a collection of lower level building blocks. Notably, it contains the class system, the widget system, concurrency utilities, and many other class/functions."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:67
|
||
msgid "*chrome/*: in this folder, we have most large widgets which make up most of the user interface."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:69
|
||
msgid "*chrome/abstract_web_client.js* and *chrome/web_client.js*: together, these files define the WebClient widget, which is the root widget for the web client."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:71
|
||
msgid "*chrome/action_manager.js*: this is the code that will convert an action into a widget (for example a kanban or a form view)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:73
|
||
msgid "*chrome/search_X.js* all these files define the search view (it is not a view in the point of view of the web client, only from the server point of view)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:75
|
||
msgid "*fields*: all main view field widgets are defined here"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:76
|
||
msgid "*views*: this is where the views are located"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:79
|
||
msgid "Assets Management"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:81
|
||
msgid "Managing assets in Odoo is not as straightforward as it is in some other apps. One of the reason is that we have a variety of situations where some, but not all the assets are required. For example, the needs of the web client, the point of sale, the website or even the mobile application are different. Also, some assets may be large, but are seldom needed. In that case, we sometimes want them to be loaded lazily."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:88
|
||
msgid "The main idea is that we define a set of *bundles* in xml. A bundle is here defined as a collection of files (javascript, css, scss). In Odoo, the most important bundles are defined in the file *addons/web/views/webclient_templates.xml*. It looks like this:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:103
|
||
msgid "The files in a bundle can then be inserted into a template by using the *t-call-assets* directive:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:111
|
||
msgid "Here is what happens when a template is rendered by the server with these directives:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:113
|
||
msgid "all the *scss* files described in the bundle are compiled into css files. A file named *file.scss* will be compiled in a file named *file.scss.css*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:116
|
||
msgid "if we are in *debug=assets* mode"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:118
|
||
msgid "the *t-call-assets* directive with the *t-js* attribute set to false will be replaced by a list of stylesheet tags pointing to the css files"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:121
|
||
msgid "the *t-call-assets* directive with the *t-css* attribute set to false will be replaced by a list of script tags pointing to the js files"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:124
|
||
msgid "if we are not in *debug=assets* mode"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:126
|
||
msgid "the css files will be concatenated and minified, then a stylesheet tag is generated"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:129
|
||
msgid "the js files are concatenated and minified, then a script tag is generated"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:131
|
||
msgid "Note that the assets files are cached, so in theory, a browser should only load them once."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:135
|
||
msgid "Main bundles"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:136
|
||
msgid "When the Odoo server is started, it checks the timestamp of each file in a bundle, and if necessary, will create/recreate the corresponding bundles."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:139
|
||
msgid "Here are some important bundles that most developers will need to know:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:141
|
||
msgid "*web.assets_common*: this bundle contains most assets which are common to the web client, the website, and also the point of sale. This is supposed to contain lower level building blocks for the odoo framework. Note that it contains the *boot.js* file, which defines the odoo module system."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:146
|
||
msgid "*web.assets_backend*: this bundle contains the code specific to the web client (notably the web client/action manager/views)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:149
|
||
msgid "*web.assets_frontend*: this bundle is about all that is specific to the public website: ecommerce, forum, blog, event management, ..."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:154
|
||
msgid "Adding files in an asset bundle"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:156
|
||
msgid "The proper way to add a file located in *addons/web* to a bundle is simple: it is just enough to add a *script* or a *stylesheet* tag to the bundle in the file *webclient_templates.xml*. But when we work in a different addon, we need to add a file from that addon. In that case, it should be done in three steps:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:161
|
||
msgid "add a *assets.xml* file in the *views/* folder"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:162
|
||
msgid "add the string 'views/assets.xml' in the 'data' key in the manifest file"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:163
|
||
msgid "create an inherited view of the desired bundle, and add the file(s) with an xpath expression. For example,"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:178
|
||
msgid "Note that the files in a bundle are all loaded immediately when the user loads the odoo web client. This means that the files are transferred through the network everytime (except when the browser cache is active). In some cases, it may be better to lazyload some assets. For example, if a widget requires a large library, and that widget is not a core part of the experience, then it may be a good idea to only load the library when the widget is actually created. The widget class has actually builtin support just for this use case. (see section :ref:`reference/javascript_reference/qweb`)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:188
|
||
msgid "What to do if a file is not loaded/updated"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:190
|
||
msgid "There are many different reasons why a file may not be properly loaded. Here are a few things you can try to solve the issue:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:193
|
||
msgid "once the server is started, it does not know if an asset file has been modified. So, you can simply restart the server to regenerate the assets."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:195
|
||
msgid "check the console (in the dev tools, usually opened with F12) to make sure there are no obvious errors"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:197
|
||
msgid "try to add a console.log at the beginning of your file (before any module definition), so you can see if a file has been loaded or not"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:199
|
||
msgid "in the user interface, in debug mode (INSERT LINK HERE TO DEBUG MODE), there is an option to force the server to update its assets files."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:201
|
||
msgid "use the *debug=assets* mode. This will actually bypass the asset bundles (note that it does not actually solve the issue. The server still uses outdated bundles)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:203
|
||
msgid "finally, the most convenient way to do it, for a developer, is to start the server with the *--dev=all* option. This activates the file watcher options, which will automatically invalidate assets when necessary. Note that it does not work very well if the OS is Windows."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:207
|
||
msgid "remember to refresh your page!"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:208
|
||
msgid "or maybe to save your code file..."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:211
|
||
msgid "Once an asset file has been recreated, you need to refresh the page, to reload the proper files (if that does not work, the files may be cached)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:216
|
||
msgid "Javascript Module System"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:218
|
||
msgid "Once we are able to load our javascript files into the browser, we need to make sure they are loaded in the correct order. In order to do that, Odoo has defined a small module system (located in the file *addons/web/static/src/js/boot.js*, which needs to be loaded first)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:223
|
||
msgid "The Odoo module system, inspired by AMD, works by defining the function *define* on the global odoo object. We then define each javascript module by calling that function. In the Odoo framework, a module is a piece of code that will be executed as soon as possible. It has a name and potentially some dependencies. When its dependencies are loaded, a module will then be loaded as well. The value of the module is then the return value of the function defining the module."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:231
|
||
msgid "As an example, it may look like this:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:256
|
||
msgid "An alternative way to define a module is to give explicitly a list of dependencies in the second argument."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:271
|
||
msgid "If some dependencies are missing/non ready, then the module will simply not be loaded. There will be a warning in the console after a few seconds."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:274
|
||
msgid "Note that circular dependencies are not supported. It makes sense, but it means that one needs to be careful."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:278
|
||
msgid "Defining a module"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:280
|
||
msgid "The *odoo.define* method is given three arguments:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:282
|
||
msgid "*moduleName*: the name of the javascript module. It should be a unique string. The convention is to have the name of the odoo addon followed by a specific description. For example, 'web.Widget' describes a module defined in the *web* addon, which exports a *Widget* class (because the first letter is capitalized)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:287
|
||
msgid "If the name is not unique, an exception will be thrown and displayed in the console."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:290
|
||
msgid "*dependencies*: the second argument is optional. If given, it should be a list of strings, each corresponding to a javascript module. This describes the dependencies that are required to be loaded before the module is executed. If the dependencies are not explicitly given here, then the module system will extract them from the function by calling toString on it, then using a regexp to find all *require* statements."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:308
|
||
msgid "finally, the last argument is a function which defines the module. Its return value is the value of the module, which may be passed to other modules requiring it. Note that there is a small exception for asynchronous modules, see the next section."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:313
|
||
msgid "If an error happens, it will be logged (in debug mode) in the console:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:315
|
||
msgid "``Missing dependencies``: These modules do not appear in the page. It is possible that the JavaScript file is not in the page or that the module name is wrong"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:318
|
||
msgid "``Failed modules``: A javascript error is detected"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:320
|
||
msgid "``Rejected modules``: The module returns a rejected Promise. It (and its dependent modules) is not loaded."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:323
|
||
msgid "``Rejected linked modules``: Modules who depend on a rejected module"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:325
|
||
msgid "``Non loaded modules``: Modules who depend on a missing or a failed module"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:331
|
||
msgid "Asynchronous modules"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:333
|
||
msgid "It can happen that a module needs to perform some work before it is ready. For example, it could do a rpc to load some data. In that case, the module can simply return a promise. In that case, the module system will simply wait for the promise to complete before registering the module."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:353
|
||
msgid "Best practices"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:355
|
||
msgid "remember the convention for a module name: *addon name* suffixed with *module name*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:357
|
||
msgid "declare all your dependencies at the top of the module. Also, they should be sorted alphabetically by module name. This makes it easier to understand your module."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:359
|
||
msgid "declare all exported values at the end"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:360
|
||
msgid "try to avoid exporting too many things from one module. It is usually better to simply export one thing in one (small/smallish) module."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:362
|
||
msgid "asynchronous modules can be used to simplify some use cases. For example, the *web.dom_ready* module returns a promise which will be resolved when the dom is actually ready. So, another module that needs the DOM could simply have a `require('web.dom_ready')` statement somewhere, and the code will only be executed when the DOM is ready."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:367
|
||
msgid "try to avoid defining more than one module in one file. It may be convenient in the short term, but this is actually harder to maintain."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:372
|
||
msgid "Class System"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:374
|
||
msgid "Odoo was developed before ECMAScript 6 classes were available. In Ecmascript 5, the standard way to define a class is to define a function and to add methods on its prototype object. This is fine, but it is slightly complex when we want to use inheritance, mixins."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:379
|
||
msgid "For these reasons, Odoo decided to use its own class system, inspired by John Resig. The base Class is located in *web.Class*, in the file *class.js*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:383
|
||
msgid "Creating a subclass"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:385
|
||
msgid "Let us discuss how classes are created. The main mechanism is to use the *extend* method (this is more or less the equivalent of *extend* in ES6 classes)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:407
|
||
msgid "In this example, the *init* function is the constructor. It will be called when an instance is created. Making an instance is done by using the *new* keyword."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:413
|
||
msgid "It is convenient to be able to inherit an existing class. This is simply done by using the *extend* method on the superclass. When a method is called, the framework will secretly rebind a special method: *_super* to the currently called method. This allows us to use *this._super* whenever we need to call a parent method."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:438
|
||
msgid "Mixins"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:440
|
||
msgid "The odoo Class system does not support multiple inheritance, but for those cases when we need to share some behaviour, we have a mixin system: the *extend* method can actually take an arbitrary number of arguments, and will combine all of them in the new class."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:460
|
||
msgid "In this example, the *Hamster* class is a subclass of Animal, but it also mix the DanceMixin in."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:465
|
||
msgid "Patching an existing class"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:467
|
||
msgid "It is not common, but we sometimes need to modify another class *in place*. The goal is to have a mechanism to change a class and all future/present instances. This is done by using the *include* method:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:483
|
||
msgid "This is obviously a dangerous operation and should be done with care. But with the way Odoo is structured, it is sometimes necessary in one addon to modify the behavior of a widget/class defined in another addon. Note that it will modify all instances of the class, even if they have already been created."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:490
|
||
msgid "Widgets"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:492
|
||
msgid "The *Widget* class is really an important building block of the user interface. Pretty much everything in the user interface is under the control of a widget. The Widget class is defined in the module *web.Widget*, in *widget.js*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:496
|
||
msgid "In short, the features provided by the Widget class include:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:498
|
||
msgid "parent/child relationships between widgets (*PropertiesMixin*)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:499
|
||
msgid "extensive lifecycle management with safety features (e.g. automatically destroying children widgets during the destruction of a parent)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:501
|
||
msgid "automatic rendering with :ref:`qweb <reference/qweb>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:502
|
||
msgid "various utility functions to help interacting with the outside environment."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:504
|
||
msgid "Here is an example of a basic counter widget:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:525
|
||
msgid "For this example, assume that the template *some.template* (and is properly loaded: the template is in a file, which is properly defined in the *qweb* key in the module manifest) is given by:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:536
|
||
msgid "This example widget can be used in the following manner:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:545
|
||
msgid "This example illustrates a few of the features of the *Widget* class, including the event system, the template system, the constructor with the initial *parent* argument."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:549
|
||
msgid "Widget Lifecycle"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:551
|
||
msgid "Like many component systems, the widget class has a well defined lifecycle. The usual lifecycle is the following: *init* is called, then *willStart*, then the rendering takes place, then *start* and finally *destroy*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:557
|
||
msgid "this is the constructor. The init method is supposed to initialize the base state of the widget. It is synchronous and can be overridden to take more parameters from the widget's creator/parent"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:0
|
||
#: ../../content/developer/reference/javascript_reference.rst:0
|
||
#: ../../content/developer/reference/javascript_reference.rst:0
|
||
#: ../../content/developer/reference/mobile.rst:0
|
||
#: ../../content/developer/reference/mobile.rst:0
|
||
#: ../../content/developer/reference/mobile.rst:0
|
||
#: ../../content/developer/reference/mobile.rst:0
|
||
#: ../../content/developer/reference/mobile.rst:0
|
||
#: ../../content/developer/reference/qweb.rst:0
|
||
msgid "Arguments"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:561
|
||
msgid "the new widget's parent, used to handle automatic destruction and event propagation. Can be ``null`` for the widget to have no parent."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:568
|
||
msgid "this method will be called once by the framework when a widget is created and in the process of being appended to the DOM. The *willStart* method is a hook that should return a promise. The JS framework will wait for this promise to complete before moving on to the rendering step. Note that at this point, the widget does not have a DOM root element. The *willStart* hook is mostly useful to perform some asynchronous work, such as fetching data from the server"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:577
|
||
msgid "This step is automatically done by the framework. What happens is that the framework checks if a template key is defined on the widget. If that is the case, then it will render that template with the *widget* key bound to the widget in the rendering context (see the example above: we use *widget.count* in the QWeb template to read the value from the widget). If no template is defined, we read the *tagName* key and create a corresponding DOM element. When the rendering is done, we set the result as the $el property of the widget. After this, we automatically bind all events in the events and custom_events keys."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:589
|
||
msgid "when the rendering is complete, the framework will automatically call the *start* method. This is useful to perform some specialized post-rendering work. For example, setting up a library."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:593
|
||
msgid "Must return a promise to indicate when its work is done."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:0
|
||
#: ../../content/developer/reference/javascript_reference.rst:0
|
||
#: ../../content/developer/reference/javascript_reference.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mobile.rst:0
|
||
#: ../../content/developer/reference/mobile.rst:0
|
||
#: ../../content/developer/reference/qweb.rst:0
|
||
#: ../../content/developer/webservices/iap.rst:0
|
||
#: ../../content/developer/webservices/upgrade.rst:0
|
||
#: ../../content/developer/webservices/upgrade.rst:0
|
||
#: ../../content/developer/webservices/upgrade.rst:0
|
||
#: ../../content/developer/webservices/upgrade.rst:0
|
||
#: ../../content/developer/webservices/upgrade.rst:0
|
||
#: ../../content/developer/webservices/upgrade.rst:0
|
||
msgid "Returns"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:595
|
||
msgid "promise"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:599
|
||
msgid "This is always the final step in the life of a widget. When a widget is destroyed, we basically perform all necessary cleanup operations: removing the widget from the component tree, unbinding all events, ..."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:603
|
||
msgid "Automatically called when the widget's parent is destroyed, must be called explicitly if the widget has no parent or if it is removed but its parent remains."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:607
|
||
msgid "Note that the willStart and start method are not necessarily called. A widget can be created (the *init* method will be called) and then destroyed (*destroy* method) without ever having been appended to the DOM. If that is the case, the willStart and start will not even be called."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:613
|
||
msgid "Widget API"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:617
|
||
msgid "Used if the widget has no template defined. Defaults to ``div``, will be used as the tag name to create the DOM element to set as the widget's DOM root. It is possible to further customize this generated DOM root with the following attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:625
|
||
msgid "Used to generate an ``id`` attribute on the generated DOM root. Note that this is rarely needed, and is probably not a good idea if a widget can be used more than once."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:631
|
||
msgid "Used to generate a ``class`` attribute on the generated DOM root. Note that it can actually contain more than one css class: *'some-class other-class'*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:637
|
||
msgid "Mapping (object literal) of attribute names to attribute values. Each of these k:v pairs will be set as a DOM attribute on the generated DOM root."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:643
|
||
msgid "raw DOM element set as root to the widget (only available after the start lifecycle method)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:648
|
||
msgid "jQuery wrapper around :attr:`~Widget.el`. (only available after the start lifecycle method)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:653
|
||
msgid "Should be set to the name of a :ref:`QWeb template <reference/qweb>`. If set, the template will be rendered after the widget has been initialized but before it has been started. The root element generated by the template will be set as the DOM root of the widget."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:660
|
||
msgid "List of paths to xml files that need to be loaded before the widget can be rendered. This will not induce loading anything that has already been loaded. This is useful when you want to load your templates lazily, or if you want to share a widget between the website and the web client interface."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:674
|
||
msgid "Events are a mapping of an event selector (an event name and an optional CSS selector separated by a space) to a callback. The callback can be the name of a widget's method or a function object. In either case, the ``this`` will be set to the widget:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:688
|
||
msgid "The selector is used for jQuery's event delegation, the callback will only be triggered for descendants of the DOM root matching the selector. If the selector is left out (only an event name is specified), the event will be set directly on the widget's DOM root."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:694
|
||
msgid "Note: the use of an inline function is discouraged, and will probably be removed sometimes in the future."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:699
|
||
msgid "this is almost the same as the *events* attribute, but the keys are arbitrary strings. They represent business events triggered by some sub widgets. When an event is triggered, it will 'bubble up' the widget tree (see the section on component communication for more details)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:706
|
||
msgid "``true`` if the widget is being or has been destroyed, ``false`` otherwise"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:711
|
||
msgid "Applies the CSS selector specified as parameter to the widget's DOM root:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:718
|
||
msgid "is functionally identical to:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:724
|
||
msgid "CSS selector"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:725
|
||
msgid "jQuery object"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:727
|
||
msgid "this helper method is similar to ``Backbone.View.$``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:731
|
||
msgid "Re-sets the widget's DOM root to the provided element, also handles re-setting the various aliases of the DOM root as well as unsetting and re-setting delegated events."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:735
|
||
msgid "a DOM element or jQuery object to set as the widget's DOM root"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:740
|
||
msgid "Inserting a widget in the DOM"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:744
|
||
msgid "Renders the widget and inserts it as the last child of the target, uses `.appendTo()`_"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:749
|
||
msgid "Renders the widget and inserts it as the first child of the target, uses `.prependTo()`_"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:754
|
||
msgid "Renders the widget and inserts it as the preceding sibling of the target, uses `.insertAfter()`_"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:759
|
||
msgid "Renders the widget and inserts it as the following sibling of the target, uses `.insertBefore()`_"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:762
|
||
msgid "All of these methods accept whatever the corresponding jQuery method accepts (CSS selectors, DOM nodes or jQuery objects). They all return a promise and are charged with three tasks:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:766
|
||
msgid "rendering the widget's root element via :func:`~Widget.renderElement`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:767
|
||
msgid "inserting the widget's root element in the DOM using whichever jQuery method they match"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:769
|
||
msgid "starting the widget, and returning the result of starting it"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:772
|
||
msgid "Widget Guidelines"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:774
|
||
msgid "Identifiers (``id`` attribute) should be avoided. In generic applications and modules, ``id`` limits the re-usability of components and tends to make code more brittle. Most of the time, they can be replaced with nothing, classes or keeping a reference to a DOM node or jQuery element."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:779
|
||
msgid "If an ``id`` is absolutely necessary (because a third-party library requires one), the id should be partially generated using ``_.uniqueId()`` e.g.:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:786
|
||
msgid "Avoid predictable/common CSS class names. Class names such as \"content\" or \"navigation\" might match the desired meaning/semantics, but it is likely an other developer will have the same need, creating a naming conflict and unintended behavior. Generic class names should be prefixed with e.g. the name of the component they belong to (creating \"informal\" namespaces, much as in C or Objective-C)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:793
|
||
msgid "Global selectors should be avoided. Because a component may be used several times in a single page (an example in Odoo is dashboards), queries should be restricted to a given component's scope. Unfiltered selections such as ``$(selector)`` or ``document.querySelectorAll(selector)`` will generally lead to unintended or incorrect behavior. Odoo Web's :class:`~Widget` has an attribute providing its DOM root (:attr:`~Widget.$el`), and a shortcut to select nodes directly (:func:`~Widget.$`)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:802
|
||
msgid "More generally, never assume your components own or controls anything beyond its own personal :attr:`~Widget.$el` (so, avoid using a reference to the parent widget)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:806
|
||
msgid "Html templating/rendering should use QWeb unless absolutely trivial."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:808
|
||
msgid "All interactive components (components displaying information to the screen or intercepting DOM events) must inherit from :class:`~Widget` and correctly implement and use its API and life cycle."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:812
|
||
msgid "Make sure to wait for start to be finished before using $el e.g.:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:844
|
||
msgid "QWeb Template Engine"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:846
|
||
msgid "The web client uses the :doc:`qweb` template engine to render widgets (unless they override the *renderElement* method to do something else). The Qweb JS template engine is based on XML, and is mostly compatible with the python implementation."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:851
|
||
msgid "Now, let us explain how the templates are loaded. Whenever the web client starts, a rpc is made to the */web/webclient/qweb* route. The server will then return a list of all templates defined in data files for each installed modules. The correct files are listed in the *qweb* entry in each module manifest."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:856
|
||
msgid "The web client will wait for that list of template to be loaded, before starting its first widget."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:859
|
||
msgid "This mechanism works quite well for our needs, but sometimes, we want to lazy load a template. For example, imagine that we have a widget which is rarely used. In that case, maybe we prefer to not load its template in the main file, in order to make the web client slightly lighter. In that case, we can use the *xmlDependencies* key of the Widget:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:877
|
||
msgid "With this, the *Counter* widget will load the xmlDependencies files in its *willStart* method, so the template will be ready when the rendering is performed."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:882
|
||
msgid "Event system"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:884
|
||
msgid "There are currently two event systems supported by Odoo: a simple system which allows adding listeners and triggering events, and a more complete system that also makes events 'bubble up'."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:888
|
||
msgid "Both of these event systems are implemented in the *EventDispatcherMixin*, in the file *mixins.js*. This mixin is included in the *Widget* class."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:892
|
||
msgid "Base Event system"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:894
|
||
msgid "This event system was historically the first. It implements a simple bus pattern. We have 4 main methods:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:897
|
||
msgid "*on*: this is used to register a listener on an event."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:898
|
||
msgid "*off*: useful to remove events listener."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:899
|
||
msgid "*once*: this is used to register a listener that will only be called once."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:900
|
||
msgid "*trigger*: trigger an event. This will cause each listeners to be called."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:902
|
||
msgid "Here is an example on how this event system could be used:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:927
|
||
msgid "the use of this event system is discouraged, we plan to replace each *trigger* method by the *trigger_up* method from the extended event system"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:931
|
||
msgid "Extended Event System"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:933
|
||
msgid "The custom event widgets is a more advanced system, which mimic the DOM events API. Whenever an event is triggered, it will 'bubble up' the component tree, until it reaches the root widget, or is stopped."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:937
|
||
msgid "*trigger_up*: this is the method that will create a small *OdooEvent* and dispatch it in the component tree. Note that it will start with the component that triggered the event"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:940
|
||
msgid "*custom_events*: this is the equivalent of the *event* dictionary, but for odoo events."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:943
|
||
msgid "The OdooEvent class is very simple. It has three public attributes: *target* (the widget that triggered the event), *name* (the event name) and *data* (the payload). It also has 2 methods: *stopPropagation* and *is_stopped*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:947
|
||
msgid "The previous example can be updated to use the custom event system:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:974
|
||
msgid "Registries"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:976
|
||
msgid "A common need in the Odoo ecosystem is to extend/change the behaviour of the base system from the outside (by installing an application, i.e. a different module). For example, one may need to add a new widget type in some views. In that case, and many others, the usual process is to create the desired component, then add it to a registry (registering step), to make the rest of the web client aware of its existence."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:983
|
||
msgid "There are a few registries available in the system:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:998
|
||
msgid "field registry (exported by :js:data:`web.field_registry`)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:986
|
||
msgid "The field registry contains all field widgets known to the web client. Whenever a view (typically form or list/kanban) needs a field widget, this is where it will look. A typical use case look like this:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:998
|
||
msgid "Note that each value should be a subclass of *AbstractField*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1003
|
||
msgid "view registry"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1001
|
||
msgid "This registry contains all JS views known to the web client (and in particular, the view manager). Each value of this registry should be a subclass of *AbstractView*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1010
|
||
msgid "action registry"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1006
|
||
msgid "We keep track of all client actions in this registry. This is where the action manager looks up whenever it needs to create a client action. In version 11, each value should simply be a subclass of *Widget*. However, in version 12, the values are required to be *AbstractAction*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1013
|
||
msgid "Communication between widgets"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1015
|
||
msgid "There are many ways to communicate between components."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1023
|
||
msgid "From a parent to its child"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1018
|
||
msgid "This is a simple case. The parent widget can simply call a method on its child:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1050
|
||
msgid "From a widget to its parent/some ancestor"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1026
|
||
msgid "In this case, the widget's job is simply to notify its environment that something happened. Since we do not want the widget to have a reference to its parent (this would couple the widget with its parent's implementation), the best way to proceed is usually to trigger an event, which will bubble up the component tree, by using the ``trigger_up`` method:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1036
|
||
msgid "This event will be triggered on the widget, then will bubble up and be eventually caught by some upstream widget:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1081
|
||
msgid "Cross component"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1053
|
||
msgid "Cross component communication can be achieved by using a bus. This is not the preferred form of communication, because it has the disadvantage of making the code harder to maintain. However, it has the advantage of decoupling the components. In that case, this is simply done by triggering and listening to events on a bus. For example:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1084
|
||
msgid "Services"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1086
|
||
msgid "In version 11.0, we introduced the notion of *service*. The main idea is to give to sub components a controlled way to access their environment, in a way that allow the framework enough control, and which is testable."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1090
|
||
msgid "The service system is organized around three ideas: services, service providers and widgets. The way it works is that widgets trigger (with *trigger_up*) events, these events bubble up to a service provider, which will ask a service to perform a task, then maybe return an answer."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1096
|
||
#: ../../content/developer/webservices/iap.rst:354
|
||
msgid "Service"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1098
|
||
msgid "A service is an instance of the *AbstractService* class. It basically only has a name and a few methods. Its job is to perform some work, typically something depending on the environment."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1102
|
||
msgid "For example, we have the *ajax* service (job is to perform a rpc), the *localStorage* (interact with the browser local storage) and many others."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1105
|
||
msgid "Here is a simplified example on how the ajax service is implemented:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1118
|
||
msgid "This service is named 'ajax' and define one method, *rpc*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1121
|
||
msgid "Service Provider"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1123
|
||
msgid "For services to work, it is necessary that we have a service provider ready to dispatch the custom events. In the *backend* (web client), this is done by the main web client instance. Note that the code for the service provider comes from the *ServiceProviderMixin*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1130
|
||
msgid "Widget"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1132
|
||
msgid "The widget is the part that requests a service. In order to do that, it simply triggers an event *call_service* (typically by using the helper function *call*). This event will bubble up and communicate the intent to the rest of the system."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1136
|
||
msgid "In practice, some functions are so frequently called that we have some helpers functions to make them easier to use. For example, the *_rpc* method is a helper that helps making a rpc."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1152
|
||
msgid "If a widget is destroyed, it will be detached from the main component tree and will not have a parent. In that case, the events will not bubble up, which means that the work will not be done. This is usually exactly what we want from a destroyed widget."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1158
|
||
msgid "RPCs"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1160
|
||
msgid "The rpc functionality is supplied by the ajax service. But most people will probably only interact with the *_rpc* helpers."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1163
|
||
msgid "There are typically two usecases when working on Odoo: one may need to call a method on a (python) model (this goes through a controller *call_kw*), or one may need to directly call a controller (available on some route)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1167
|
||
msgid "Calling a method on a python model:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1177
|
||
msgid "Directly calling a controller:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1187
|
||
msgid "Notifications"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1189
|
||
msgid "The Odoo framework has a standard way to communicate various information to the user: notifications, which are displayed on the top right of the user interface."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1192
|
||
msgid "There are two types of notifications:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1194
|
||
msgid "*notification*: useful to display some feedback. For example, whenever a user unsubscribed to a channel."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1197
|
||
msgid "*warning*: useful to display some important/urgent information. Typically most kind of (recoverable) errors in the system."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1200
|
||
msgid "Also, notifications can be used to ask a question to the user without disturbing its workflow. Imagine a phone call received through VOIP: a sticky notification could be displayed with two buttons *Accept* and *Decline*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1205
|
||
msgid "Notification system"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1207
|
||
msgid "The notification system in Odoo is designed with the following components:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1209
|
||
msgid "a *Notification* widget: this is a simple widget that is meant to be created and displayed with the desired information"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1212
|
||
msgid "a *NotificationService*: a service whose responsibility is to create and destroy notifications whenever a request is done (with a custom_event). Note that the web client is a service provider."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1216
|
||
msgid "a client action *display_notification*: this allows to trigger the display of a notification from python (e.g. in the method called when the user clicked on a button of type object)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1220
|
||
msgid "two helper functions in *ServiceMixin*: *do_notify* and *do_warn*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1224
|
||
msgid "Displaying a notification"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1225
|
||
msgid "The most common way to display a notification is by using two methods that come from the *ServiceMixin*:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1241
|
||
msgid "*do_notify(title, message, sticky, className)*:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1229
|
||
msgid "Display a notification of type *notification*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1231
|
||
#: ../../content/developer/reference/javascript_reference.rst:1246
|
||
msgid "*title*: string. This will be displayed on the top as a title"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1233
|
||
#: ../../content/developer/reference/javascript_reference.rst:1248
|
||
msgid "*message*: string, the content of the notification"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1235
|
||
#: ../../content/developer/reference/javascript_reference.rst:1250
|
||
msgid "*sticky*: boolean, optional. If true, the notification will stay until the user dismisses it. Otherwise, the notification will be automatically closed after a short delay."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1239
|
||
#: ../../content/developer/reference/javascript_reference.rst:1254
|
||
msgid "*className*: string, optional. This is a css class name that will be automatically added to the notification. This could be useful for styling purpose, even though its use is discouraged."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1256
|
||
msgid "*do_warn(title, message, sticky, className)*:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1244
|
||
msgid "Display a notification of type *warning*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1258
|
||
msgid "Here are two examples on how to use these methods:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1267
|
||
msgid "Here an example in python:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1284
|
||
msgid "Systray"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1286
|
||
msgid "The Systray is the right part of the menu bar in the interface, where the web client displays a few widgets, such as a messaging menu."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1289
|
||
msgid "When the SystrayMenu is created by the menu, it will look for all registered widgets and add them as a sub widget at the proper place."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1292
|
||
msgid "There is currently no specific API for systray widgets. They are supposed to be simple widgets, and can communicate with their environment just like other widgets with the *trigger_up* method."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1297
|
||
msgid "Adding a new Systray Item"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1299
|
||
msgid "There is no systray registry. The proper way to add a widget is to add it to the class variable SystrayMenu.items."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1314
|
||
msgid "Ordering"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1316
|
||
msgid "Before adding the widget to himself, the Systray Menu will sort the items by a sequence property. If that property is not present on the prototype, it will use 50 instead. So, to position a systray item to be on the right, one can set a very high sequence number (and conversely, a low number to put it on the left)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1328
|
||
msgid "Translation management"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1330
|
||
msgid "Some translations are made on the server side (basically all text strings rendered or processed by the server), but there are strings in the static files that need to be translated. The way it currently works is the following:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1334
|
||
msgid "each translatable string is tagged with the special function *_t* (available in the JS module *web.core*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1336
|
||
msgid "these strings are used by the server to generate the proper PO files"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1337
|
||
msgid "whenever the web client is loaded, it will call the route */web/webclient/translations*, which returns a list of all translatable terms"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1339
|
||
msgid "in runtime, whenever the function *_t* is called, it will look up in this list in order to find a translation, and return it or the original string if none is found."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1343
|
||
msgid "Note that translations are explained in more details, from the server point of view, in the document :doc:`translations`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1346
|
||
msgid "There are two important functions for the translations in javascript: *_t* and *_lt*. The difference is that *_lt* is lazily evaluated."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1365
|
||
msgid "In this example, the *_lt* is necessary because the translations are not ready when the module is loaded."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1368
|
||
msgid "Note that translation functions need some care. The string given in argument should not be dynamic."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1372
|
||
msgid "Session"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1374
|
||
msgid "There is a specific module provided by the web client which contains some information specific to the user current *session*. Some notable keys are"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1377
|
||
msgid "uid: the current user ID (its ID as a *res.users*)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1378
|
||
msgid "user_name: the user name, as a string"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1379
|
||
msgid "the user context (user ID, language and timezone)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1380
|
||
msgid "partner_id: the ID of the partner associated to the current user"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1381
|
||
msgid "db: the name of the database currently being in use"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1384
|
||
msgid "Adding information to the session"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1386
|
||
msgid "When the /web route is loaded, the server will inject some session information in the template a script tag. The information will be read from the method *session_info* of the model *ir.http*. So, if one wants to add a specific information, it can be done by overriding the session_info method and adding it to the dictionary."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1406
|
||
msgid "Now, the value can be obtained in javascript by reading it in the session:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1414
|
||
msgid "Note that this mechanism is designed to reduce the amount of communication needed by the web client to be ready. It is more appropriate for data which is cheap to compute (a slow session_info call will delay the loading for the web client for everyone), and for data which is required early in the initialization process."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1423
|
||
msgid "The word 'view' has more than one meaning. This section is about the design of the javascript code of the views, not the structure of the *arch* or anything else."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1427
|
||
msgid "In 2017, Odoo replaced the previous view code with a new architecture. The main need was to separate the rendering logic from the model logic."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1431
|
||
msgid "Views (in a generic sense) are now described with 4 pieces: a View, a Controller, a Renderer and a Model. The API of these 4 pieces is described in the AbstractView, AbstractController, AbstractRenderer and AbstractModel classes."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1452
|
||
msgid "the View is the factory. Its job is to get a set of fields, arch, context and some other parameters, then to construct a Controller/Renderer/Model triplet."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1455
|
||
msgid "The view's role is to properly setup each piece of the MVC pattern, with the correct information. Usually, it has to process the arch string and extract the data necessary for each other parts of the view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1459
|
||
msgid "Note that the view is a class, not a widget. Once its job has been done, it can be discarded."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1462
|
||
msgid "the Renderer has one job: representing the data being viewed in a DOM element. Each view can render the data in a different way. Also, it should listen on appropriate user actions and notify its parent (the Controller) if necessary."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1466
|
||
msgid "The Renderer is the V in the MVC pattern."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1468
|
||
msgid "the Model: its job is to fetch and hold the state of the view. Usually, it represents in some way a set of records in the database. The Model is the owner of the 'business data'. It is the M in the MVC pattern."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1472
|
||
msgid "the Controller: its job is to coordinate the renderer and the model. Also, it is the main entry point for the rest of the web client. For example, when the user changes something in the search view, the *update* method of the controller will be called with the appropriate information."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1477
|
||
msgid "It is the C in the MVC pattern."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1480
|
||
msgid "The JS code for the views has been designed to be usable outside of the context of a view manager/action manager. They could be used in a client action, or, they could be displayed in the public website (with some work on the assets)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1487
|
||
msgid "Field Widgets"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1489
|
||
msgid "A good part of the web client experience is about editing and creating data. Most of that work is done with the help of field widgets, which are aware of the field type and of the specific details on how a value should be displayed and edited."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1494
|
||
msgid "AbstractField"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1496
|
||
msgid "The *AbstractField* class is the base class for all widgets in a view, for all views that support them (currently: Form, List, Kanban)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1499
|
||
msgid "There are many differences between the v11 field widgets and the previous versions. Let us mention the most important ones:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1502
|
||
msgid "the widgets are shared between all views (well, Form/List/Kanban). No need to duplicate the implementation anymore. Note that it is possible to have a specialized version of a widget for a view, by prefixing it with the view name in the view registry: *list.many2one* will be chosen in priority over *many2one*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1506
|
||
msgid "the widgets are no longer the owner of the field value. They only represent the data and communicate with the rest of the view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1508
|
||
msgid "the widgets do no longer need to be able to switch between edit and readonly mode. Now, when such a change is necessary, the widget will be destroyed and rerendered again. It is not a problem, since they do not own their value anyway"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1512
|
||
msgid "the field widgets can be used outside of a view. Their API is slightly awkward, but they are designed to be standalone."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1516
|
||
msgid "Decorations"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1518
|
||
msgid "Like the list view, field widgets have a simple support for decorations. The goal of decorations is to have a simple way to specify a text color depending on the record current state. For example,"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1526
|
||
msgid "The valid decoration names are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1528
|
||
msgid "decoration-bf"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1529
|
||
msgid "decoration-it"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1530
|
||
msgid "decoration-danger"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1531
|
||
msgid "decoration-info"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1532
|
||
msgid "decoration-muted"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1533
|
||
msgid "decoration-primary"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1534
|
||
msgid "decoration-success"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1535
|
||
msgid "decoration-warning"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1537
|
||
msgid "Each decoration *decoration-X* will be mapped to a css class *text-X*, which is a standard bootstrap css class (except for *text-it* and *text-bf*, which are handled by odoo and correspond to italic and bold, respectively). Note that the value of the decoration attribute should be a valid python expression, which will be evaluated with the record as evaluation context."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1544
|
||
msgid "Non relational fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1546
|
||
msgid "We document here all non relational fields available by default, in no particular order."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1580
|
||
msgid "integer (FieldInteger)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1550
|
||
msgid "This is the default field type for fields of type *integer*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1552
|
||
#: ../../content/developer/reference/javascript_reference.rst:1741
|
||
msgid "Supported field types: *integer*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1554
|
||
#: ../../content/developer/reference/javascript_reference.rst:1595
|
||
#: ../../content/developer/reference/javascript_reference.rst:1667
|
||
#: ../../content/developer/reference/javascript_reference.rst:1680
|
||
#: ../../content/developer/reference/javascript_reference.rst:1693
|
||
#: ../../content/developer/reference/javascript_reference.rst:1720
|
||
#: ../../content/developer/reference/javascript_reference.rst:1805
|
||
#: ../../content/developer/reference/javascript_reference.rst:1823
|
||
#: ../../content/developer/reference/javascript_reference.rst:1888
|
||
#: ../../content/developer/reference/javascript_reference.rst:1932
|
||
#: ../../content/developer/reference/javascript_reference.rst:1951
|
||
#: ../../content/developer/reference/javascript_reference.rst:1983
|
||
#: ../../content/developer/reference/javascript_reference.rst:2004
|
||
#: ../../content/developer/reference/javascript_reference.rst:2076
|
||
#: ../../content/developer/reference/javascript_reference.rst:2106
|
||
#: ../../content/developer/reference/javascript_reference.rst:2180
|
||
#: ../../content/developer/reference/javascript_reference.rst:2195
|
||
#: ../../content/developer/reference/javascript_reference.rst:2205
|
||
#: ../../content/developer/reference/javascript_reference.rst:2253
|
||
msgid "Options:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1556
|
||
#: ../../content/developer/reference/javascript_reference.rst:1597
|
||
msgid "type: setting the input type (*text* by default, can be set on *number*)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1558
|
||
#: ../../content/developer/reference/javascript_reference.rst:1599
|
||
msgid "On edit mode, the field is rendered as an input with the HTML attribute type setted on *number* (so user can benefit the native support, especially on mobile). In this case, the default formatting is disabled to avoid incompability."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1566
|
||
#: ../../content/developer/reference/javascript_reference.rst:1607
|
||
msgid "step: set the step to the value up and down when the user click on buttons (only for input of type number, 1 by default)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1573
|
||
msgid "format: should the number be formatted. (true by default)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1576
|
||
msgid "By default, numbers are formatted according to locale parameters."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1576
|
||
msgid "This option will prevent the field's value from being formatted."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1621
|
||
msgid "float (FieldFloat)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1583
|
||
msgid "This is the default field type for fields of type *float*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1585
|
||
#: ../../content/developer/reference/javascript_reference.rst:1628
|
||
#: ../../content/developer/reference/javascript_reference.rst:1635
|
||
#: ../../content/developer/reference/javascript_reference.rst:1644
|
||
msgid "Supported field types: *float*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1587
|
||
#: ../../content/developer/reference/javascript_reference.rst:2100
|
||
#: ../../content/developer/reference/javascript_reference.rst:2175
|
||
msgid "Attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1589
|
||
msgid "digits: displayed precision"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1628
|
||
msgid "float_time (FieldFloatTime)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1624
|
||
msgid "The goal of this widget is to display properly a float value that represents a time interval (in hours). So, for example, 0.5 should be formatted as 0:30, or 4.75 correspond to 4:45."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1635
|
||
msgid "float_factor (FieldFloatFactor)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1631
|
||
msgid "This widget aims to display properly a float value that converted using a factor given in its options. So, for example, the value saved in database is 0.5 and the factor is 3, the widget value should be formatted as 1.5."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1648
|
||
msgid "float_toggle (FieldFloatToggle)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1638
|
||
msgid "The goal of this widget is to replace the input field by a button containing a range of possible values (given in the options). Each click allows the user to loop in the range. The purpose here is to restrict the field value to a predefined selection. Also, the widget support the factor conversion as the *float_factor* widget (Range values should be the result of the conversion)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1653
|
||
msgid "boolean (FieldBoolean)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1651
|
||
msgid "This is the default field type for fields of type *boolean*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1653
|
||
#: ../../content/developer/reference/javascript_reference.rst:1920
|
||
#: ../../content/developer/reference/javascript_reference.rst:1930
|
||
#: ../../content/developer/reference/javascript_reference.rst:2002
|
||
msgid "Supported field types: *boolean*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1658
|
||
msgid "char (FieldChar)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1656
|
||
msgid "This is the default field type for fields of type *char*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1658
|
||
#: ../../content/developer/reference/javascript_reference.rst:1748
|
||
#: ../../content/developer/reference/javascript_reference.rst:1756
|
||
#: ../../content/developer/reference/javascript_reference.rst:1787
|
||
#: ../../content/developer/reference/javascript_reference.rst:1794
|
||
#: ../../content/developer/reference/javascript_reference.rst:2021
|
||
msgid "Supported field types: *char*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1673
|
||
msgid "date (FieldDate)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1661
|
||
msgid "This is the default field type for fields of type *date*. Note that it also works with datetime fields. It uses the session timezone when formatting dates."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1665
|
||
#: ../../content/developer/reference/javascript_reference.rst:1678
|
||
#: ../../content/developer/reference/javascript_reference.rst:1691
|
||
#: ../../content/developer/reference/javascript_reference.rst:1711
|
||
msgid "Supported field types: *date*, *datetime*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1669
|
||
#: ../../content/developer/reference/javascript_reference.rst:1682
|
||
msgid "datepicker: extra settings for the datepicker_ widget."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1686
|
||
msgid "datetime (FieldDateTime)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1676
|
||
msgid "This is the default field type for fields of type *datetime*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1703
|
||
msgid "daterange (FieldDateRange)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1689
|
||
msgid "This widget allows the user to select start and end date into a single picker."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1695
|
||
msgid "related_start_date: apply on end date field to get start date value which is used to display range in the picker."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1697
|
||
msgid "related_end_date: apply on start date field to get end date value which is used to display range in the picker."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1699
|
||
msgid "picker_options: extra settings for picker."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1711
|
||
msgid "remaining_days (RemainingDays)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1706
|
||
msgid "This widget can be used on date and datetime fields. In readonly, it displays the delta (in days) between the value of the field and today. The widget is intended to be used for informative purpose: therefore the value cannot be modified in edit mode."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1726
|
||
msgid "monetary (FieldMonetary)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1714
|
||
msgid "This is the default field type for fields of type 'monetary'. It is used to display a currency. If there is a currency fields given in option, it will use that, otherwise it will fall back to the default currency (in the session)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1718
|
||
msgid "Supported field types: *monetary*, *float*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1722
|
||
msgid "currency_field: another field name which should be a many2one on currency."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1732
|
||
msgid "text (FieldText)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1729
|
||
msgid "This is the default field type for fields of type *text*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1731
|
||
msgid "Supported field types: *text*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1742
|
||
msgid "handle (HandleWidget)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1735
|
||
msgid "This field's job is to be displayed as a *handle*, and allows reordering the various records by drag and dropping them."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1738
|
||
msgid "It has to be specified on the field by which records are sorted."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1739
|
||
msgid "Having more than one field with a handle widget on the same list is not supported."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1748
|
||
msgid "email (FieldEmail)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1745
|
||
msgid "This field displays email address. The main reason to use it is that it is rendered as an anchor tag with the proper href, in readonly mode."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1756
|
||
msgid "phone (FieldPhone)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1751
|
||
msgid "This field displays a phone number. The main reason to use it is that it is rendered as an anchor tag with the proper href, in readonly mode, but only in some cases: we only want to make it clickable if the device can call this particular number."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1775
|
||
msgid "url (UrlWidget)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1759
|
||
msgid "This field displays an url (in readonly mode). The main reason to use it is that it is rendered as an anchor tag with the proper css classes and href."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1762
|
||
msgid "Also, the text of the anchor tag can be customized with the *text* attribute (it won't change the href value)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1787
|
||
msgid "domain (FieldDomain)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1778
|
||
msgid "The \"Domain\" field allows the user to construct a technical-prefix domain thanks to a tree-like interface and see the selected records in real time. In debug mode, an input is also there to be able to enter the prefix char domain directly (or to build advanced domains the tree-like interface does not allow to)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1784
|
||
msgid "Note that this is limited to 'static' domain (no dynamic expression, or access to context variable)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1794
|
||
msgid "link_button (LinkButton)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1790
|
||
msgid "The LinkButton widget actually simply displays a span with an icon and the text value as content. The link is clickable and will open a new browser window with its value as url."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1816
|
||
msgid "image (FieldBinaryImage)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1797
|
||
msgid "This widget is used to represent a binary value as an image. In some cases, the server returns a 'bin_size' instead of the real image (a bin_size is a string representing a file size, such as 6.5kb). In that case, the widget will make an image with a source attribute corresponding to an image on the server."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1803
|
||
#: ../../content/developer/reference/javascript_reference.rst:1821
|
||
msgid "Supported field types: *binary*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1807
|
||
msgid "preview_image: if the image is only loaded as a 'bin_size', then this option is useful to inform the web client that the default field name is not the name of the current field, but the name of another field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1811
|
||
msgid "accepted_file_extensions: the file extension the user can pick from the file input dialog box (default value is `image/\\*`) (cf: ``accept`` attribute on <input type=\"file\"/>)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1836
|
||
msgid "binary (FieldBinaryFile)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1819
|
||
msgid "Generic widget to allow saving/downloading a binary file."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1825
|
||
#: ../../content/developer/reference/javascript_reference.rst:2197
|
||
msgid "accepted_file_extensions: the file extension the user can pick from the file input dialog box (cf: ``accept`` attribute on <input type=\"file\"/>)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1828
|
||
msgid "Attribute:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1830
|
||
msgid "filename: saving a binary file will lose its file name, since it only saves the binary value. The filename can be saved in another field. To do that, an attribute filename should be set to a field present in the view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1845
|
||
msgid "priority (PriorityWidget)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1839
|
||
msgid "This widget is rendered as a set of stars, allowing the user to click on it to select a value or not. This is useful for example to mark a task as high priority."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1843
|
||
msgid "Note that this widget also works in 'readonly' mode, which is unusual."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1845
|
||
#: ../../content/developer/reference/javascript_reference.rst:1862
|
||
#: ../../content/developer/reference/javascript_reference.rst:1886
|
||
#: ../../content/developer/reference/javascript_reference.rst:1905
|
||
#: ../../content/developer/reference/javascript_reference.rst:1914
|
||
#: ../../content/developer/reference/javascript_reference.rst:2057
|
||
msgid "Supported field types: *selection*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1857
|
||
msgid "attachment_image (AttachmentImage)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1848
|
||
msgid "Image widget for many2one fields. If the field is set, this widget will be rendered as an image with the proper src url. This widget does not have a different behaviour in edit or readonly mode, it is only useful to view an image."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1853
|
||
#: ../../content/developer/reference/javascript_reference.rst:2098
|
||
#: ../../content/developer/reference/javascript_reference.rst:2130
|
||
#: ../../content/developer/reference/javascript_reference.rst:2141
|
||
#: ../../content/developer/reference/javascript_reference.rst:2150
|
||
#: ../../content/developer/reference/javascript_reference.rst:2168
|
||
msgid "Supported field types: *many2one*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1880
|
||
msgid "image_selection (ImageSelection)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1860
|
||
msgid "Allow the user to select a value by clicking on an image."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1864
|
||
msgid "Options: a dictionary with a mapping from a selection value to an object with the url for an image (*image_link*) and a preview image (*preview_link*)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1867
|
||
msgid "Note that this option is not optional!"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1896
|
||
msgid "label_selection (LabelSelection)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1883
|
||
msgid "This widget renders a simple non-editable label. This is only useful to display some information, not to edit it."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1890
|
||
msgid "classes: a mapping from a selection value to a css class"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1909
|
||
msgid "state_selection (StateSelectionWidget)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1899
|
||
msgid "This is a specialized selection widget. It assumes that the record has some hardcoded fields, present in the view: *stage_id*, *legend_normal*, *legend_blocked*, *legend_done*. This is mostly used to display and change the state of a task in a project, with additional information displayed in the dropdown."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1914
|
||
msgid "kanban_state_selection (StateSelectionWidget)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1912
|
||
msgid "This is exactly the same widget as state_selection"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1920
|
||
msgid "boolean_favorite (FavoriteWidget)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1917
|
||
msgid "This widget is displayed as an empty (or not) star, depending on a boolean value. Note that it also can be edited in readonly mode."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1939
|
||
msgid "boolean_button (FieldBooleanButton)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1923
|
||
msgid "The Boolean Button widget is meant to be used in a stat button in a form view. The goal is to display a nice button with the current state of a boolean field (for example, 'Active'), and allow the user to change that field when clicking on it."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1928
|
||
msgid "Note that it also can be edited in readonly mode."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1934
|
||
msgid "terminology: it can be either 'active', 'archive', 'close' or a customized mapping with the keys *string_true*, *string_false*, *hover_true*, *hover_false*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1943
|
||
msgid "boolean_toggle (BooleanToggle)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1942
|
||
msgid "Displays a toggle switch to represent a boolean. This is a subfield of FieldBoolean, mostly used to have a different look."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1964
|
||
msgid "statinfo (StatInfo)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1946
|
||
msgid "This widget is meant to represent statistical information in a *stat button*. It is basically just a label with a number."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1949
|
||
#: ../../content/developer/reference/javascript_reference.rst:1972
|
||
#: ../../content/developer/reference/javascript_reference.rst:1981
|
||
msgid "Supported field types: *integer, float*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1953
|
||
msgid "label_field: if given, the widget will use the value of the label_field as text."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1976
|
||
msgid "percentpie (FieldPercentPie)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1967
|
||
msgid "This widget is meant to represent statistical information in a *stat button*. This is similar to a statinfo widget, but the information is represented in a *pie* chart (empty to full). Note that the value is interpreted as a percentage (a number between 0 and 100)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1995
|
||
msgid "progressbar (FieldProgressBar)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1979
|
||
msgid "Represent a value as a progress bar (from 0 to some value)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1985
|
||
msgid "editable: boolean if value is editable"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1986
|
||
msgid "current_value: get the current_value from the field that must be present in the view"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1987
|
||
msgid "max_value: get the max_value from the field that must be present in the view"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1988
|
||
msgid "edit_max_value: boolean if the max_value is editable"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1989
|
||
msgid "title: title of the bar, displayed on top of the bar --> not translated, use parameter (not option) \"title\" instead"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2013
|
||
msgid "toggle_button (FieldToggleBoolean)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:1998
|
||
msgid "This widget is intended to be used on boolean fields. It toggles a button switching between a green bullet / gray bullet. It also set up a tooltip, depending on the value and some options."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2006
|
||
msgid "active: the string for the tooltip that should be set when boolean is true"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2007
|
||
msgid "inactive: the tooltip that should be set when boolean is false"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2031
|
||
msgid "dashboard_graph (JournalDashboardGraph)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2016
|
||
msgid "This is a more specialized widget, useful to display a graph representing a set of data. For example, it is used in the accounting dashboard kanban view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2019
|
||
msgid "It assumes that the field is a JSON serialization of a set of data."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2023
|
||
msgid "Attribute"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2025
|
||
msgid "graph_type: string, can be either 'line' or 'bar'"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2037
|
||
msgid "ace (AceEditor)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2034
|
||
msgid "This widget is intended to be used on Text fields. It provides Ace Editor for editing XML and Python."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2037
|
||
msgid "Supported field types: *char, text*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2050
|
||
msgid "badge (FieldBadge)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2040
|
||
msgid "Displays the value inside a bootstrap badge pill."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2042
|
||
msgid "Supported field types: *char*, *selection*, *many2one*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2044
|
||
msgid "By default, the badge has a lightgrey background, but it can be customized by using the decoration-X mechanism. For instance, to display a red badge under a given condition:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2061
|
||
msgid "a string which is used to display some info when no value is selected"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2083
|
||
msgid "radio (FieldRadio)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2068
|
||
msgid "This is a subfield of FielSelection, but specialized to display all the valid choices as radio buttons."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2071
|
||
msgid "Note that if used on a many2one records, then more rpcs will be done to fetch the name_gets of the related records."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2074
|
||
#: ../../content/developer/reference/javascript_reference.rst:2089
|
||
#: ../../content/developer/reference/javascript_reference.rst:2273
|
||
msgid "Supported field types: *selection, many2one*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2078
|
||
msgid "horizontal: if true, radio buttons will be displayed horizontally."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2093
|
||
msgid "selection_badge (FieldSelectionBadge)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2086
|
||
msgid "This is a subfield of FieldSelection, but specialized to display all the valid choices as rectangular badges."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2121
|
||
msgid "many2one (FieldMany2One)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2096
|
||
msgid "Default widget for many2one fields."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2102
|
||
msgid "can_create: allow the creation of related records (take precedence over no_create option)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2104
|
||
msgid "can_write: allow the editing of related records (default: true)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2108
|
||
msgid "no_create: prevent the creation of related records"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2109
|
||
msgid "quick_create: allow the quick creation of related records (default: true)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2110
|
||
msgid "no_quick_create: prevent the quick creation of related records (don't ask me)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2111
|
||
msgid "no_create_edit: same as no_create, maybe..."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2112
|
||
msgid "create_name_field: when creating a related record, if this option is set, the value of the *create_name_field* will be filled with the value of the input (default: *name*)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2113
|
||
msgid "always_reload: boolean, default to false. If true, the widget will always do an additional name_get to fetch its name value. This is used for the situations where the name_get method is overridden (please do not do that)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2116
|
||
msgid "no_open: boolean, default to false. If set to true, the many2one will not redirect on the record when clicking on it (in readonly mode)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2130
|
||
msgid "list.many2one (ListFieldMany2One)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2124
|
||
msgid "Default widget for many2one fields (in list view)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2126
|
||
msgid "Specialization of many2one field for list views. The main reason is that we need to render many2one fields (in readonly mode) as a text, which does not allow opening the related records."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2141
|
||
msgid "many2one_barcode (FieldMany2OneBarcode)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2133
|
||
msgid "Widget for many2one fields allows to open the camera from a mobile device (Android/iOS) to scan a barcode."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2135
|
||
msgid "Specialization of many2one field where the user is allowed to use the native camera to scan a barcode. Then it uses name_search to search this value."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2138
|
||
msgid "If this widget is set and user is not using the mobile application, it will fallback to regular many2one (FieldMany2One)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2150
|
||
msgid "many2one_avatar (Many2OneAvatar)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2144
|
||
msgid "This widget is only supported on many2one fields pointing to a model which inherits from 'image.mixin'. In readonly, it displays the image of the related record next to its display_name. Note that the display_name isn't a clickable link in this case. In edit, it behaves exactly like the regular many2one."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2157
|
||
msgid "many2one_avatar_user (Many2OneAvatarUser)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2153
|
||
msgid "This widget is a specialization of the Many2OneAvatar. When the avatar is clicked, we open a chat window with the corresponding user. This widget can only be set on many2one fields pointing to the 'res.users' model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2157
|
||
msgid "Supported field types: *many2one* (pointing to 'res.users')"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2162
|
||
msgid "many2one_avatar_employee (Many2OneAvatarEmployee)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2160
|
||
msgid "Same as Many2OneAvatarUser, but for many2one fields pointing to 'hr.employee'."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2162
|
||
msgid "Supported field types: *many2one* (pointing to 'hr.employee')"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2168
|
||
msgid "kanban.many2one (KanbanFieldMany2One)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2165
|
||
msgid "Default widget for many2one fields (in kanban view). We need to disable all editing in kanban views."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2185
|
||
msgid "many2many (FieldMany2Many)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2171
|
||
msgid "Default widget for many2many fields."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2173
|
||
#: ../../content/developer/reference/javascript_reference.rst:2193
|
||
#: ../../content/developer/reference/javascript_reference.rst:2203
|
||
#: ../../content/developer/reference/javascript_reference.rst:2230
|
||
#: ../../content/developer/reference/javascript_reference.rst:2235
|
||
#: ../../content/developer/reference/javascript_reference.rst:2244
|
||
msgid "Supported field types: *many2many*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2177
|
||
msgid "mode: string, default view to display"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2178
|
||
msgid "domain: restrict the data to a specific domain"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2182
|
||
msgid "create_text: allow the customization of the text displayed when adding a new record"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2184
|
||
msgid "link: domain determining whether or not records can be added to the relation (default: True)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2185
|
||
msgid "unlink: domain determining whether or not records can be removed from the relation (default: True)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2198
|
||
msgid "many2many_binary (FieldMany2ManyBinaryMultiFiles)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2188
|
||
msgid "This widget helps the user to upload or delete one or more files at the same time."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2191
|
||
msgid "Note that this widget is specific to the model 'ir.attachment'."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2224
|
||
msgid "many2many_tags (FieldMany2ManyTags)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2201
|
||
msgid "Display many2many as a list of tags."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2207
|
||
msgid "create: domain determining whether or not new tags can be created (default: True)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2213
|
||
msgid "color_field: the name of a numeric field, which should be present in the view. A color will be chosen depending on its value."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2220
|
||
msgid "no_edit_color: set to True to remove the possibility to change the color of the tags (default: False)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2230
|
||
msgid "form.many2many_tags (FormFieldMany2ManyTags)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2227
|
||
msgid "Specialization of many2many_tags widget for form views. It has some extra code to allow editing the color of a tag."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2235
|
||
msgid "kanban.many2many_tags (KanbanFieldMany2ManyTags)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2233
|
||
msgid "Specialization of many2many_tags widget for kanban views."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2244
|
||
msgid "many2many_checkboxes (FieldMany2ManyCheckBoxes)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2238
|
||
msgid "This field displays a list of checkboxes and allows the user to select a subset of the choices. Note that the number of displayed values is limited to 100. This limit isn't customizable. It simply allows to handle extreme cases where this widget is wrongly set on a field with a huge comodel. In those cases, a list view is more adequate as it allows pagination and filtering."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2267
|
||
msgid "one2many (FieldOne2Many)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2247
|
||
msgid "Default widget for one2many fields."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2249
|
||
msgid "It usually displays data in a sub list view, or a sub kanban view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2251
|
||
msgid "Supported field types: *one2many*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2255
|
||
msgid "create: domain determining whether or not related records can be created (default: True)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2257
|
||
msgid "delete: domain determining whether or not related records can be deleted (default: True)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2263
|
||
msgid "create_text: a string that is used to customize the 'Add' label/text."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2273
|
||
msgid "statusbar (FieldStatus)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2270
|
||
msgid "This is a really specialized widget for the form views. It is the bar on top of many forms which represent a flow, and allow selecting a specific state."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2281
|
||
msgid "reference (FieldReference)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2276
|
||
msgid "The FieldReference is a combination of a select (for the model) and a FieldMany2One (for its value). It allows the selection of a record on an arbitrary model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2280
|
||
msgid "Supported field types: *char, reference*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2284
|
||
msgid "Client actions"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2286
|
||
msgid "The idea of a client action is a customized widget that is integrated in the web client interface, just like a *act_window_action*. This is useful when you need a component that is not closely linked to an existing view or a specific model. For example, the Discuss application is actually a client action."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2292
|
||
msgid "A client action is a term that has various meanings, depending on the context:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2294
|
||
msgid "from the perspective of the server, it is a record of the model *ir_action*, with a field *tag* of type char"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2296
|
||
msgid "from the perspective of the web client, it is a widget, which inherit from the class AbstractAction, and is supposed to be registered in the action registry under the corresponding key (from the field char)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2300
|
||
msgid "Whenever a menu item is associated to a client action, opening it will simply fetch the action definition from the server, then lookup into its action registry to get the Widget definition at the appropriate key, and finally, it will instantiate and append the widget to the proper place in the DOM."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2306
|
||
msgid "Adding a client action"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2308
|
||
msgid "A client action is a widget which will control the part of the screen below the menu bar. It can have a control panel, if necessary. Defining a client action can be done in two steps: implementing a new widget, and registering the widget in the action registry."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2323
|
||
msgid "Implementing a new client action."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2314
|
||
msgid "This is done by creating a widget:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2346
|
||
msgid "Registering the client action:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2326
|
||
msgid "As usual, we need to make the web client aware of the mapping between client actions and the actual class:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2336
|
||
msgid "Then, to use the client action in the web client, we need to create a client action record (a record of the model ``ir.actions.client``) with the proper ``tag`` attribute:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2349
|
||
msgid "Using the control panel"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2351
|
||
msgid "By default, the client action does not display a control panel. In order to do that, several steps should be done."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2354
|
||
msgid "Set the *hasControlPanel* to *true*. In the widget code:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2366
|
||
msgid "when the ``loadControlPanel`` is set to true, the client action will automatically get the content of a search view or a control panel view. In this case, a model name should be specified like this:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2377
|
||
msgid "Call the method *updateControlPanel* whenever we need to update the control panel. For example:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/javascript_reference.rst:2406
|
||
msgid "The ``updateControlPanel`` is the main method to customize the content in controlpanel. For more information, look into the `control_panel_renderer.js <https://github.com/odoo/odoo/blob/13.0/addons/web/static/src/js/views/control_panel/control_panel_renderer.js#L130>`_ file."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:6
|
||
msgid "Mixins and Useful Classes"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:8
|
||
msgid "Odoo implements some useful classes and mixins that make it easy for you to add often-used behaviours on your objects. This guide will details most of them, with examples and use cases."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:15
|
||
msgid "Messaging features"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:20
|
||
msgid "Messaging integration"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:23
|
||
msgid "Basic messaging system"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:25
|
||
msgid "Integrating messaging features to your model is extremely easy. Simply inheriting the ``mail.thread`` model and adding the messaging fields (and their appropriate widgets) to your form view will get you up and running in no time."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:29
|
||
#: ../../content/developer/reference/mixins.rst:203
|
||
#: ../../content/developer/reference/mixins.rst:275
|
||
#: ../../content/developer/reference/mixins.rst:425
|
||
#: ../../content/developer/reference/mixins.rst:612
|
||
#: ../../content/developer/reference/mixins.rst:741
|
||
#: ../../content/developer/reference/orm.rst:177
|
||
#: ../../content/developer/reference/orm.rst:843
|
||
#: ../../content/developer/reference/views.rst:1004
|
||
msgid "Example"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:31
|
||
msgid "Let's create a simplistic model representing a business trip. Since organizing this kind of trip usually involves a lot of people and a lot of discussion, let's add support for message exchange on the model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:46
|
||
msgid "In the form view:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:66
|
||
msgid "Once you've added chatter support on your model, users can easily add messages or internal notes on any record of your model; every one of those will send a notification (to all followers for messages, to employee (*base.group_user*) users for internal notes). If your mail gateway and catchall address are correctly configured, these notifications will be sent by e-mail and can be replied-to directly from your mail client; the automatic routing system will route the answer to the correct thread."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:74
|
||
msgid "Server-side, some helper functions are there to help you easily send messages and to manage followers on your record:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:78
|
||
msgid "Posting messages"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:81
|
||
msgid "Post a new message in an existing thread, returning the new mail.message ID."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/qweb.rst:0
|
||
#: ../../content/developer/webservices/iap.rst:0
|
||
#: ../../content/developer/webservices/iap.rst:0
|
||
#: ../../content/developer/webservices/iap.rst:0
|
||
#: ../../content/developer/webservices/iap.rst:0
|
||
#: ../../content/developer/webservices/iap.rst:0
|
||
#: ../../content/developer/webservices/iap.rst:0
|
||
#: ../../content/developer/webservices/iap.rst:0
|
||
#: ../../content/developer/webservices/upgrade.rst:0
|
||
#: ../../content/developer/webservices/upgrade.rst:0
|
||
#: ../../content/developer/webservices/upgrade.rst:0
|
||
#: ../../content/developer/webservices/upgrade.rst:0
|
||
#: ../../content/developer/webservices/upgrade.rst:0
|
||
#: ../../content/developer/webservices/upgrade.rst:0
|
||
msgid "Parameters"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:84
|
||
msgid "body of the message, usually raw HTML that will be sanitized"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:86
|
||
msgid "see mail_message.message_type field"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:87
|
||
msgid "handle reply to a previous message by adding the parent partners to the message in case of private discussion"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:89
|
||
msgid "list of attachment tuples in the form ``(name,content)``, where content is NOT base64 encoded"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:91
|
||
msgid "extra keyword arguments will be used as default column values for the new mail.message record"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:93
|
||
msgid "ID of newly created mail.message"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/reference/mixins.rst:0
|
||
#: ../../content/developer/webservices/upgrade.rst:0
|
||
#: ../../content/developer/webservices/upgrade.rst:0
|
||
#: ../../content/developer/webservices/upgrade.rst:0
|
||
#: ../../content/developer/webservices/upgrade.rst:0
|
||
#: ../../content/developer/webservices/upgrade.rst:0
|
||
#: ../../content/developer/webservices/upgrade.rst:0
|
||
msgid "Return type"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:98
|
||
msgid "Helper method to send a mail / post a message using a view_id to render using the ir.qweb engine. This method is stand alone, because there is nothing in template and composer that allows to handle views in batch. This method will probably disappear when templates handle ir ui views."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:104
|
||
msgid "external id or record of the view that should be sent"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:109
|
||
msgid "Helper method to send a mail with a template"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:111
|
||
msgid "the id of the template to render to create the body of the message"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:112
|
||
msgid "parameter to create a mail.compose.message wizzard (which inherit from mail.message)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:115
|
||
msgid "Receiving messages"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:116
|
||
msgid "These methods are called when a new e-mail is processed by the mail gateway. These e-mails can either be new thread (if they arrive via an :ref:`alias <reference/mixins/mail/alias>`) or simply replies from an existing thread. Overriding them allows you to set values on the thread's record depending on some values from the email itself (i.e. update a date or an e-mail address, add CC's addresses as followers, etc.)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:124
|
||
msgid "Called by ``message_process`` when a new message is received for a given thread model, if the message did not belong to an existing thread."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:128
|
||
msgid "The default behavior is to create a new record of the corresponding model (based on some very basic info extracted from the message). Additional behavior may be implemented by overriding this method."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:132
|
||
msgid "a map containing the email details and attachments. See ``message_process`` and ``mail.message.parse`` for details"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:134
|
||
msgid "optional dictionary of additional field values to pass to create() when creating the new thread record; be careful, these values may override any other values coming from the message"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:139
|
||
msgid "the id of the newly created thread object"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:143
|
||
msgid "Called by ``message_process`` when a new message is received for an existing thread. The default behavior is to update the record with ``update_vals`` taken from the incoming email."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:147
|
||
msgid "Additional behavior may be implemented by overriding this method."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:150
|
||
msgid "a map containing the email details and attachments; see ``message_process`` and ``mail.message.parse()`` for details."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:152
|
||
msgid "a dict containing values to update records given their ids; if the dict is None or is void, no write operation is performed."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:154
|
||
#: ../../content/developer/reference/mixins.rst:182
|
||
#: ../../content/developer/reference/mixins.rst:192
|
||
msgid "True"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:157
|
||
msgid "Followers management"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:160
|
||
msgid "Add partners to the records followers."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:162
|
||
#: ../../content/developer/reference/mixins.rst:178
|
||
msgid "IDs of the partners that will be subscribed to the record"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:164
|
||
#: ../../content/developer/reference/mixins.rst:180
|
||
msgid "IDs of the channels that will be subscribed to the record"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:166
|
||
msgid "IDs of the subtypes that the channels/partners will be subscribed to (defaults to the default subtypes if ``None``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:168
|
||
msgid "if True, delete existing followers before creating new one using the subtypes given in the parameters"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:170
|
||
msgid "Success/Failure"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:176
|
||
msgid "Remove partners from the record's followers."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:188
|
||
msgid "Wrapper on message_subscribe, using users."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:190
|
||
msgid "IDs of the users that will be unsubscribed to the record; if None, unsubscribe the current user instead."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:197
|
||
msgid "Logging changes"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:199
|
||
msgid "The ``mail`` module adds a powerful tracking system on fields, allowing you to log changes to specific fields in the record's chatter. To add tracking to a field, simple set the tracking attribute to True."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:205
|
||
msgid "Let's track changes on the name and responsible of our business trips:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:219
|
||
msgid "From now on, every change to a trip's name or responsible will log a note on the record. The ``name`` field will be displayed in the notification as well to give more context about the notification (even if the name did not change)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:226
|
||
msgid "Subtypes"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:228
|
||
msgid "Subtypes give you more granular control over messages. Subtypes act as a classification system for notifications, allowing subscribers to a document to customize the subtype of notifications they wish to receive."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:232
|
||
msgid "Subtypes are created as data in your module; the model has the following fields:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:235
|
||
msgid "``name`` (mandatory) - :class:`~odoo.fields.Char`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:235
|
||
msgid "name of the subtype, will be displayed in the notification customization popup"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:238
|
||
msgid "``description`` - :class:`~odoo.fields.Char`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:238
|
||
msgid "description that will be added in the message posted for this subtype. If void, the name will be added instead"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:241
|
||
msgid "``internal`` - :class:`~odoo.fields.Boolean`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:241
|
||
msgid "messages with internal subtypes will be visible only by employees, aka members of the ``base.group_user`` group"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:246
|
||
msgid "``parent_id`` - :class:`~odoo.fields.Many2one`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:244
|
||
msgid "link subtypes for automatic subscription; for example project subtypes are linked to task subtypes through this link. When someone is subscribed to a project, he will be subscribed to all tasks of this project with subtypes found using the parent subtype"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:249
|
||
msgid "``relation_field`` - :class:`~odoo.fields.Char`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:249
|
||
msgid "as an example, when linking project and tasks subtypes, the relation field is the project_id field of tasks"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:251
|
||
msgid "``res_model`` - :class:`~odoo.fields.Char`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:252
|
||
msgid "model the subtype applies to; if False, this subtype applies to all models"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:253
|
||
msgid "``default`` - :class:`~odoo.fields.Boolean`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:254
|
||
msgid "wether the subtype is activated by default when subscribing"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:255
|
||
msgid "``sequence`` - :class:`~odoo.fields.Integer`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:256
|
||
msgid "used to order subtypes in the notification customization popup"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:259
|
||
msgid "``hidden`` - :class:`~odoo.fields.Boolean`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:258
|
||
msgid "wether the subtype is hidden in the notification customization popup"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:261
|
||
msgid "Interfacing subtypes with field tracking allows to subscribe to different kind of notifications depending on what might interest users. To do this, you can override the ``_track_subtype()`` function:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:267
|
||
#: ../../content/developer/reference/mixins.rst:349
|
||
msgid "Give the subtype triggered by the changes on the record according to values that have been updated."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:270
|
||
msgid "the original values of the record; only modified fields are present in the dict"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:272
|
||
#: ../../content/developer/reference/mixins.rst:391
|
||
msgid "a subtype's full external id or False if no subtype is triggered"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:277
|
||
msgid "Let's add a ``state`` field on our example class and trigger a notification with a specific subtype when this field change values."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:280
|
||
msgid "First, let's define our subtype:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:292
|
||
msgid "Then, we need to override the ``track_subtype()`` function. This function is called by the tracking system to know which subtype should be used depending on the change currently being applied. In our case, we want to use our shiny new subtype when the ``state`` field changes from *draft* to *confirmed*:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:323
|
||
msgid "Customizing notifications"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:325
|
||
msgid "When sending notifications to followers, it can be quite useful to add buttons in the template to allow quick actions directly from the e-mail. Even a simple button to link directly to the record's form view can be useful; however in most cases you don't want to display these buttons to portal users."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:330
|
||
msgid "The notification system allows customizing notification templates in the following ways:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:333
|
||
msgid "Display *Access Buttons*: these buttons are visible at the top of the notification e-mail and allow the recipient to directly access the form view of the record"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:335
|
||
msgid "Display *Follow Buttons*: these buttons allow the recipient to directly quickly subscribe from the record"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:337
|
||
msgid "Display *Unfollow Buttons*: these buttons allow the recipient to directly quickly unsubscribe from the record"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:339
|
||
msgid "Display *Custom Action Buttons*: these buttons are calls to specific routes and allow you to make some useful actions directly available from the e-mail (i.e. converting a lead to an opportunity, validating an expense sheet for an Expense Manager, etc.)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:344
|
||
msgid "These buttons settings can be applied to different groups that you can define yourself by overriding the function ``_notification_recipients``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:352
|
||
msgid "``mail.message`` record currently being sent"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:353
|
||
msgid "list of tuple of the form (group_name, group_func,group_data) where: group_name is an identifier used only to be able to override and manipulate groups. Default groups are ``user`` (recipients linked to an employee user), ``portal`` (recipients linked to a portal user) and ``customer`` (recipients not linked to any user). An example of override use would be to add a group linked to a res.groups like Hr Officers to set specific action buttons to them. group_func is a function pointer taking a partner record as parameter. This method will be applied on recipients to know whether they belong to a given group or not. Only first matching group is kept. Evaluation order is the list order. group_data is a dict containing parameters for the notification email with the following possible keys - values: - has_button_access whether to display Access <Document> in email. True by default for new groups, False for portal / customer. - button_access dict with url and title of the button - has_button_follow whether to display Follow in email (if recipient is not currently following the thread). True by default for new groups, False for portal / customer. - button_follow dict with url adn title of the button - has_button_unfollow whether to display Unfollow in email (if recipient is currently following the thread). True by default for new groups, False for portal / customer. - button_unfollow dict with url and title of the button - actions list of action buttons to display in the notification email. Each action is a dict containing url and title of the button."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:353
|
||
msgid "list of tuple of the form (group_name, group_func,group_data) where:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:360
|
||
msgid "group_name"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:356
|
||
msgid "is an identifier used only to be able to override and manipulate groups. Default groups are ``user`` (recipients linked to an employee user), ``portal`` (recipients linked to a portal user) and ``customer`` (recipients not linked to any user). An example of override use would be to add a group linked to a res.groups like Hr Officers to set specific action buttons to them."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:365
|
||
msgid "group_func"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:363
|
||
msgid "is a function pointer taking a partner record as parameter. This method will be applied on recipients to know whether they belong to a given group or not. Only first matching group is kept. Evaluation order is the list order."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:389
|
||
msgid "group_data"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:368
|
||
msgid "is a dict containing parameters for the notification email with the following possible keys - values:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:372
|
||
msgid "has_button_access"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:372
|
||
msgid "whether to display Access <Document> in email. True by default for new groups, False for portal / customer."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:374
|
||
msgid "button_access"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:375
|
||
#: ../../content/developer/reference/mixins.rst:386
|
||
msgid "dict with url and title of the button"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:378
|
||
msgid "has_button_follow"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:377
|
||
msgid "whether to display Follow in email (if recipient is not currently following the thread). True by default for new groups, False for portal / customer."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:380
|
||
msgid "button_follow"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:381
|
||
msgid "dict with url adn title of the button"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:383
|
||
msgid "has_button_unfollow"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:383
|
||
msgid "whether to display Unfollow in email (if recipient is currently following the thread). True by default for new groups, False for portal / customer."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:385
|
||
msgid "button_unfollow"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:389
|
||
msgid "actions"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:388
|
||
msgid "list of action buttons to display in the notification email. Each action is a dict containing url and title of the button."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:394
|
||
msgid "The urls in the actions list can be generated automatically by calling the ``_notification_link_helper()`` function:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:400
|
||
msgid "Generate a link for the given type on the current record (or on a specific record if the kwargs ``model`` and ``res_id`` are set)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:403
|
||
msgid "link type to be generated; can be any of these values: ``view`` link to form view of the record ``assign`` assign the logged user to the ``user_id`` field of the record (if it exists) ``follow`` self-explanatory ``unfollow`` self-explanatory ``method`` call a method on the record; the method's name should be provided as the kwarg ``method`` ``new`` open an empty form view for a new record; you can specify a specific action by providing its id (database id or fully resolved external id) in the kwarg ``action_id``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:403
|
||
msgid "link type to be generated; can be any of these values:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:405
|
||
#: ../../content/developer/reference/views.rst:579
|
||
msgid "``view``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:406
|
||
msgid "link to form view of the record"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:408
|
||
msgid "``assign``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:408
|
||
msgid "assign the logged user to the ``user_id`` field of the record (if it exists)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:410
|
||
msgid "``follow``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:411
|
||
#: ../../content/developer/reference/mixins.rst:413
|
||
#: ../../content/developer/reference/views.rst:1276
|
||
#: ../../content/developer/reference/views.rst:1278
|
||
msgid "self-explanatory"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:412
|
||
msgid "``unfollow``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:415
|
||
msgid "``method``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:415
|
||
msgid "call a method on the record; the method's name should be provided as the kwarg ``method``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:420
|
||
msgid "``new``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:418
|
||
msgid "open an empty form view for a new record; you can specify a specific action by providing its id (database id or fully resolved external id) in the kwarg ``action_id``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:422
|
||
msgid "link of the type selected for the record"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:427
|
||
msgid "Let's add a custom button to the Business Trip state change notification; this button will reset the state to Draft and will be only visible to a member of the (imaginary) group Travel Manager (``business.group_trip_manager``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:466
|
||
msgid "Note that that I could have defined my evaluation function outside of this method and define a global function to do it instead of a lambda, but for the sake of being more brief and less verbose in these documentation files that can sometimes be boring, I choose the former instead of the latter."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:472
|
||
msgid "Overriding defaults"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:474
|
||
msgid "There are several ways you can customize the behaviour of ``mail.thread`` models, including (but not limited to):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:479
|
||
msgid "``_mail_post_access`` - :class:`~odoo.models.Model` attribute"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:478
|
||
msgid "the required access rights to be able to post a message on the model; by default a ``write`` access is needed, can be set to ``read`` as well"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:499
|
||
msgid "Context keys:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:482
|
||
msgid "These context keys can be used to somewhat control ``mail.thread`` features like auto-subscription or field tracking during calls to ``create()`` or ``write()`` (or any other method where it may be useful)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:486
|
||
msgid "``mail_create_nosubscribe``: at create or message_post, do not subscribe the current user to the record thread"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:488
|
||
msgid "``mail_create_nolog``: at create, do not log the automatic '<Document> created' message"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:490
|
||
msgid "``mail_notrack``: at create and write, do not perform the value tracking creating messages"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:492
|
||
msgid "``tracking_disable``: at create and write, perform no MailThread features (auto subscription, tracking, post, ...)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:494
|
||
msgid "``mail_auto_delete``: auto delete mail notifications; True by default"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:495
|
||
msgid "``mail_notify_force_send``: if less than 50 email notifications to send, send them directly instead of using the queue; True by default"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:497
|
||
msgid "``mail_notify_user_signature``: add the current user signature in email notifications; True by default"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:504
|
||
msgid "Mail alias"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:506
|
||
msgid "Aliases are configurable email addresses that are linked to a specific record (which usually inherits the ``mail.alias.mixin`` model) that will create new records when contacted via e-mail. They are an easy way to make your system accessible from the outside, allowing users or customers to quickly create records in your database without needing to connect to Odoo directly."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:513
|
||
msgid "Aliases vs. Incoming Mail Gateway"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:515
|
||
msgid "Some people use the Incoming Mail Gateway for this same purpose. You still need a correctly configured mail gateway to use aliases, however a single catchall domain will be sufficient since all routing will be done inside Odoo. Aliases have several advantages over Mail Gateways:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:523
|
||
msgid "Easier to configure"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:521
|
||
msgid "A single incoming gateway can be used by many aliases; this avoids having to configure multiple emails on your domain name (all configuration is done inside Odoo)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:524
|
||
msgid "No need for System access rights to configure aliases"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:525
|
||
msgid "More coherent"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:526
|
||
msgid "Configurable on the related record, not in a Settings submenu"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:531
|
||
msgid "Easier to override server-side"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:528
|
||
msgid "Mixin model is built to be extended from the start, allowing you to extract useful data from incoming e-mails more easily than with a mail gateway."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:534
|
||
msgid "Alias support integration"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:536
|
||
msgid "Aliases are usually configured on a parent model which will then create specific record when contacted by e-mail. For example, Project have aliases to create tasks or issues, Sales Team have aliases to generate Leads."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:540
|
||
msgid "The model that will be created by the alias **must** inherit the ``mail_thread`` model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:543
|
||
msgid "Alias support is added by inheriting ``mail.alias.mixin``; this mixin will generate a new ``mail.alias`` record for each record of the parent class that gets created (for example, every ``project.project`` record having its ``mail.alias`` record initialized on creation)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:548
|
||
msgid "Aliases can also be created manually and supported by a simple :class:`~odoo.fields.Many2one` field. This guide assumes you wish a more complete integration with automatic creation of the alias, record-specific default values, etc."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:553
|
||
msgid "Unlike ``mail.thread`` inheritance, the ``mail.alias.mixin`` **requires** some specific overrides to work correctly. These overrides will specify the values of the created alias, like the kind of record it must create and possibly some default values these records may have depending on the parent object:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:560
|
||
msgid "Return the model name for the alias. Incoming emails that are not replies to existing records will cause the creation of a new record of this alias model. The value may depend on ``vals``, the dict of values passed to ``create`` when a record of this model is created."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:565
|
||
msgid "values of the newly created record that will holding the alias"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:567
|
||
msgid "model name"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:572
|
||
msgid "Return values to create an alias, or to write on the alias after its creation. While not completely mandatory, it is usually required to make sure that newly created records will be linked to the alias' parent (i.e. tasks getting created in the right project) by setting a dictionary of default values in the alias' ``alias_defaults`` field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:578
|
||
msgid "dictionnary of values that will be written to the new alias"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:581
|
||
msgid "The ``_get_alias_values()`` override is particularly interesting as it allows you to modify the behaviour of your aliases easily. Among the fields that can be set on the alias, the following are of particular interest:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:586
|
||
msgid "``alias_name`` - :class:`~odoo.fields.Char`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:586
|
||
msgid "name of the email alias, e.g. 'jobs' if you want to catch emails for <jobs@example.odoo.com>"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:591
|
||
msgid "``alias_user_id`` - :class:`~odoo.fields.Many2one` (``res.users``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:589
|
||
msgid "owner of records created upon receiving emails on this alias; if this field is not set the system will attempt to find the right owner based on the sender (From) address, or will use the Administrator account if no system user is found for that address"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:594
|
||
msgid "``alias_defaults`` - :class:`~odoo.fields.Text`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:594
|
||
msgid "Python dictionary that will be evaluated to provide default values when creating new records for this alias"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:598
|
||
msgid "``alias_force_thread_id`` - :class:`~odoo.fields.Integer`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:597
|
||
msgid "optional ID of a thread (record) to which all incoming messages will be attached, even if they did not reply to it; if set, this will disable the creation of new records completely"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:605
|
||
msgid "``alias_contact`` - :class:`~odoo.fields.Selection`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:601
|
||
msgid "Policy to post a message on the document using the mailgateway"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:603
|
||
msgid "*everyone*: everyone can post"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:604
|
||
msgid "*partners*: only authenticated partners"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:605
|
||
msgid "*followers*: only followers of the related document or members of following channels"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:607
|
||
msgid "Note that aliases make use of :ref:`delegation inheritance <reference/orm/inheritance>`, which means that while the alias is stored in another table, you have access to all these fields directly from your parent object. This allows you to make your alias easily configurable from the record's form view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:614
|
||
msgid "Let's add aliases on our business trip class to create expenses on the fly via e-mail."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:662
|
||
msgid "We would like our alias to be easily configurable from the form view of our business trips, so let's add the following to our form view:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:687
|
||
msgid "Now we can change the alias address directly from the form view and change who can send e-mails to the alias."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:690
|
||
msgid "We can then override ``message_new()`` on our expense model to fetch the values from our email when the expense will be created:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:727
|
||
msgid "Activities tracking"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:729
|
||
msgid "Activities are actions users have to take on a document like making a phone call or organizing a meeting. Activities come with the mail module as they are integrated in the Chatter but are *not bundled with mail.thread*. Activities are records of the ``mail.activity`` class, which have a type (``mail.activity.type``), name, description, scheduled time (among others). Pending activities are visible above the message history in the chatter widget."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:736
|
||
msgid "You can integrate activities using the ``mail.activity.mixin`` class on your object and the specific widgets to display them (via the field ``activity_ids``) in the form view and kanban view of your records (``mail_activity`` and ``kanban_activity`` widgets, respectively)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:743
|
||
msgid "Organizing a business trip is a tedious process and tracking needed activities like ordering plane tickets or a cab for the airport could be useful. To do so, we will add the activities mixin on our model and display the next planned activities in the message history of our trip."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:758
|
||
msgid "We modify the form view of our trips to display their next activites:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:777
|
||
#: ../../content/developer/reference/mixins.rst:853
|
||
#: ../../content/developer/reference/mixins.rst:1072
|
||
msgid "You can find concrete examples of integration in the following models:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:779
|
||
#: ../../content/developer/reference/mixins.rst:855
|
||
msgid "``crm.lead`` in the CRM (*crm*) Application"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:780
|
||
msgid "``sale.order`` in the Sales (*sale*) Application"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:781
|
||
msgid "``project.task`` in the Project (*poject*) Application"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:787
|
||
msgid "Website features"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:792
|
||
msgid "Visitor tracking"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:794
|
||
msgid "The ``utm.mixin`` class can be used to track online marketing/communication campaigns through arguments in links to specified resources. The mixin adds 3 fields to your model:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:798
|
||
msgid "``campaign_id``: :class:`~odoo.fields.Many2one` field to a ``utm.campaign`` object (i.e. Christmas_Special, Fall_Collection, etc.)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:800
|
||
msgid "``source_id``: :class:`~odoo.fields.Many2one` field to a ``utm.source`` object (i.e. Search Engine, mailing list, etc.)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:802
|
||
msgid "``medium_id``: :class:`~odoo.fields.Many2one` field to a ``utm.medium`` object (i.e. Snail Mail, e-Mail, social network update, etc.)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:805
|
||
msgid "These models have a single field ``name`` (i.e. they are simply there to distinguish campaigns but don't have any specific behaviour)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:808
|
||
msgid "Once a customer visits your website with these parameters set in the url (i.e. https://www.odoo.com/?campaign_id=mixin_talk&source_id=www.odoo.com&medium_id=website), three cookies are set in the visitor's website for these parameters. Once a object that inherits the utm.mixin is created from the website (i.e. lead form, job application, etc.), the utm.mixin code kicks in and fetches the values from the cookies to set them in the new record. Once this is done, you can then use the campaign/source/medium fields as any other field when defining reports and views (group by, etc.)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:817
|
||
msgid "To extend this behaviour, simply add a relational field to a simple model (the model should support the *quick create* (i.e. call to ``create()`` with a single ``name`` value) and extend the function ``tracking_fields()``:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:846
|
||
msgid "This will tell the system to create a cookie named *odoo_utm_my_field* with the value found in the url parameter ``my_field``; once a new record of this model is created by a call from a website form, the generic override of the ``create()`` method of ``utm.mixin`` will fetch the default values for this field from the cookie (and the ``my_module.my_track`` record will be creatwed on the fly if it does not exist yet)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:856
|
||
msgid "``hr.applicant`` in the Recruitment Process (*hr_recruitment*) Application"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:857
|
||
#: ../../content/developer/reference/mixins.rst:1075
|
||
msgid "``helpdesk.ticket`` in the Helpdesk (*helpdesk* - Odoo Enterprise only) Application"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:862
|
||
msgid "Website visibility"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:864
|
||
msgid "You can quite easily add a website visibility toggle on any of your record. While this mixin is quite easy to implement manually, it is the most often-used after the ``mail.thread`` inheritance; a testament to its usefulness. The typical use case for this mixin is any object that has a frontend-page; being able to control the visibility of the page allows you to take your time while editing the page and only publish it when you're satisfied."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:871
|
||
msgid "To include the functionnality, you only need to inherit ``website.published.mixin``:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:880
|
||
msgid "This mixin adds 2 fields on your model:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:882
|
||
msgid "``website_published``: :class:`~odoo.fields.Boolean` field which represents the status of the publication"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:884
|
||
msgid "``website_url``: :class:`~odoo.fields.Char` field which represents the URL through which the object is accessed"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:887
|
||
msgid "Note that this last field is a computed field and must be implemented for your class:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:895
|
||
msgid "Once the mechanism is in place, you just have to adapt your frontend and backend views to make it accessible. In the backend, adding a button in the button box is usually the way to go:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:906
|
||
msgid "In the frontend, some security checks are needed to avoid showing 'Editing' buttons to website visitors:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:920
|
||
msgid "Note that you must pass your object as the variable ``object`` to the template; in this example, the ``blog.post`` record was passed as the ``blog_post`` variable to the ``qweb`` rendering engine, it is necessary to specify this to the publish management template. The ``publish_edit`` variable allow the frontend button to link to the backend (allowing you to switch from frontend to backend and vice-versa easily); if set, you must specify the full external id of the action you want to call in the backend in the ``action`` variable (note that a Form View must exist for the model)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:929
|
||
msgid "The action ``website_publish_button`` is defined in the mixin and adapts its behaviour to your object: if the class has a valid ``website_url`` compute function, the user is redirected to the frontend when he clicks on the button; the user can then publish the page directly from the frontend. This ensures that no online publication can happen by accident. If there is not compute function, the boolean ``website_published`` is simply triggered."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:939
|
||
msgid "Website metadata"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:941
|
||
msgid "This simple mixin simply allows you to easily inject metadata in your frontend pages."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:951
|
||
msgid "This mixin adds 3 fields on your model:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:953
|
||
msgid "``website_meta_title``: :class:`~odoo.fields.Char` field that allow you to set an additional title to your page"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:955
|
||
msgid "``website_meta_description``: :class:`~odoo.fields.Char` field that contains a short description of the page (sometimes used in search engines results)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:957
|
||
msgid "``website_meta_keywords``: :class:`~odoo.fields.Char` field that contains some keywords to help your page to be classified more precisely by search engines; the \"Promote\" tool will help you select lexically-related keywords easily"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:961
|
||
msgid "These fields are editable in the frontend using the \"Promote\" tool from the Editor toolbar. Setting these fields can help search engines to better index your pages. Note that search engines do not base their results only on these metadata; the best SEO practice should still be to get referenced by reliable sources."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:969
|
||
msgid "Others"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:974
|
||
msgid "Customer Rating"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:976
|
||
msgid "The rating mixin allows sending email to ask for customer rating, automatic transitioning in a kanban processes and aggregating statistics on your ratings."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:980
|
||
msgid "Adding rating on your model"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:982
|
||
msgid "To add rating support, simply inherit the ``rating.mixin`` model:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:993
|
||
msgid "The behaviour of the mixin adapts to your model:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:995
|
||
msgid "The ``rating.rating`` record will be linked to the ``partner_id`` field of your model (if the field is present)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:998
|
||
msgid "this behaviour can be overridden with the function ``rating_get_partner_id()`` if you use another field than ``partner_id``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:1001
|
||
msgid "The ``rating.rating`` record will be linked to the partner of the ``user_id`` field of your model (if the field is present) (i.e. the partner who is rated)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:1004
|
||
msgid "this behaviour can be overridden with the function ``rating_get_rated_partner_id()`` if you use another field than ``user_id`` (note that the function must return a ``res.partner``, for ``user_id`` the system automatically fetches the partner of the user)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:1009
|
||
msgid "The chatter history will display the rating event (if your model inherits from ``mail.thread``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:1013
|
||
msgid "Send rating requests by e-mail"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:1015
|
||
msgid "If you wish to send emails to request a rating, simply generate an e-mail with links to the rating object. A very basic email template could look like this:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:1039
|
||
msgid "Your customer will then receive an e-mail with links to a simple webpage allowing them to provide a feedback on their interaction with your users (including a free-text feedback message)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:1043
|
||
msgid "You can then quite easily integrate your ratings with your form view by defining an action for the ratings:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:1069
|
||
msgid "Note that there are default views (kanban,pivot,graph) for ratings which allow you a quick bird's eye view of your customer ratings."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mixins.rst:1074
|
||
msgid "``project.task`` in the Project (*rating_project*) Application"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:6
|
||
msgid "Mobile JavaScript"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:11
|
||
msgid "In Odoo 10.0 we released a mobile app which allows you to access all **Odoo apps** (even your customized modules)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:14
|
||
msgid "The application is a combination of **Odoo Web** and **Native Mobile components**. In other words it is a Odoo Web instance loaded inside a native, mobile, WebView container."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:17
|
||
msgid "This page documents how you can access mobile native components like Camera, Vibration, Notification and Toast through Odoo Web (via JavaScript). For this, you do not need to be a mobile developer, if you know Odoo JavaScript API you can access all available mobile features."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:22
|
||
msgid "These features work with **Odoo Enterprise 10.0+** only"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:25
|
||
msgid "How does it work?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:27
|
||
msgid "Internal workings of the mobile application:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:31
|
||
msgid "Of course, it is a web page that loads on a Mobile Native Web container. But it is integrated in such a way that you can access native resources from your web JavaScript."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:35
|
||
msgid "WebPages (Odoo Web) is on the top of each layer, where the second layer is a Bridge between Odoo Web (JS) and the native mobile components."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:38
|
||
msgid "When any call from JavaScript is triggered it passes through Bridge and Bridge passes it to the native invoker to perform that action."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:41
|
||
msgid "When the native component has done its work, it is passed to the Bridge again and you get the output in JavaScript."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:44
|
||
msgid "Process time taken by the Native component depends on what you are requesting from the Native resources. For example the Camera or GPS Location."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:48
|
||
msgid "How to use it?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:50
|
||
msgid "Just like the Odoo Web Framework, the Mobile API can be used anywhere by getting the object from **web_mobile.rpc**"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:55
|
||
msgid "The mobile RPC object provides a list of methods that are available (this only works with the mobile app)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:58
|
||
msgid "Check if the method is available and then execute it."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:61
|
||
msgid "Methods"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:63
|
||
msgid "Each of the methods returns a JQuery Deffered object which returns a data JSON dictionary"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:67
|
||
msgid "Show Toast in device"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:71
|
||
msgid "**message** text to display"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:73
|
||
msgid "A toast provides simple feedback about an operation in a small popup. It only fills the amount of space required for the message and the current activity remains visible and interactive."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:85
|
||
msgid "Vibrating device"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:90
|
||
msgid "Vibrates constantly for the specified period of time (in milliseconds)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:93
|
||
msgid "Vibrate mobile device with given duration."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:100
|
||
msgid "Show snackbar with action"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:104
|
||
msgid "(*required*) **Message** to show in snackbar and action **button label** in Snackbar (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:105
|
||
msgid "``True`` if the user clicks on the Action button, ``False`` if SnackBar auto dismissed after some time."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:107
|
||
msgid "Snackbars provide lightweight feedback about an operation. They show a brief message at the bottom of the screen on mobile or in the lower left corner on larger devices. Snackbars appear above all the other elements on the screen and only one can be displayed at a time."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:125
|
||
msgid "Showing notification"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:129
|
||
msgid "**title** (first row) of the notification, **message** (second row) of the notification, in a standard notification."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:131
|
||
msgid "A notification is a message you can display to the user outside of your application's normal UI. When you tell the system to issue a notification, it first appears as an icon in the notification area. To see the details of the notification, the user opens the notification drawer. Both the notification area and the notification drawer are system-controlled areas that the user can view at any time."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:146
|
||
msgid "Create contact in device"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:150
|
||
msgid "Dictionary with contact details. Possible keys (name, mobile, phone, fax, email, website, street, street2, country_id, state_id, city, zip, parent_id, function and image)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:152
|
||
msgid "Create a new device contact with the given contact details."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:179
|
||
msgid "Scanning barcodes"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:183
|
||
msgid "Scanned ``code`` from any barcode"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:185
|
||
msgid "The barcode API detects barcodes in real-time, on the device, in any orientation."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:187
|
||
msgid "The barcode API can read the following barcode formats:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:189
|
||
msgid "1D barcodes: EAN-13, EAN-8, UPC-A, UPC-E, Code-39, Code-93, Code-128, ITF, Codabar"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:190
|
||
msgid "2D barcodes: QR Code, Data Matrix, PDF-417, AZTEC"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:201
|
||
msgid "Switching account in device"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/mobile.rst:205
|
||
msgid "Use switchAccount to switch from one account to another on the device."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:4
|
||
msgid "Module Manifests"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:11
|
||
msgid "Manifest"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:13
|
||
msgid "The manifest file serves to declare a python package as an Odoo module and to specify module metadata."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:16
|
||
msgid "It is a file called ``__manifest__.py`` and contains a single Python dictionary, where each key specifies module metadatum."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:40
|
||
msgid "Available manifest fields are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:42
|
||
msgid "``name`` (``str``, required)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:43
|
||
msgid "the human-readable name of the module"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:44
|
||
msgid "``version`` (``str``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:45
|
||
msgid "this module's version, should follow `semantic versioning`_ rules"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:46
|
||
msgid "``description`` (``str``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:47
|
||
msgid "extended description for the module, in reStructuredText"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:48
|
||
msgid "``author`` (``str``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:49
|
||
msgid "name of the module author"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:50
|
||
msgid "``website`` (``str``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:51
|
||
msgid "website URL for the module author"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:65
|
||
msgid "``license`` (``str``, defaults: ``LGPL-3``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:53
|
||
msgid "distribution license for the module. Possible values:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:56
|
||
msgid "`GPL-2`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:57
|
||
msgid "`GPL-2 or any later version`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:58
|
||
msgid "`GPL-3`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:59
|
||
msgid "`GPL-3 or any later version`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:60
|
||
msgid "`AGPL-3`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:61
|
||
msgid "`LGPL-3`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:62
|
||
msgid "`Other OSI approved licence`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:63
|
||
msgid "`OEEL-1` (Odoo Enterprise Edition License v1.0)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:64
|
||
msgid "`OPL-1` (Odoo Proprietary License v1.0)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:65
|
||
msgid "`Other proprietary`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:73
|
||
msgid "``category`` (``str``, default: ``Uncategorized``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:68
|
||
msgid "classification category within Odoo, rough business domain for the module."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:70
|
||
msgid "Although using `existing categories`_ is recommended, the field is freeform and unknown categories are created on-the-fly. Category hierarchies can be created using the separator ``/`` e.g. ``Foo / Bar`` will create a category ``Foo``, a category ``Bar`` as child category of ``Foo``, and will set ``Bar`` as the module's category."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:80
|
||
msgid "``depends`` (``list(str)``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:76
|
||
msgid "Odoo modules which must be loaded before this one, either because this module uses features they create or because it alters resources they define."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:80
|
||
msgid "When a module is installed, all of its dependencies are installed before it. Likewise dependencies are loaded before a module is loaded."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:83
|
||
msgid "``data`` (``list(str)``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:83
|
||
msgid "List of data files which must always be installed or updated with the module. A list of paths from the module root directory"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:86
|
||
msgid "``demo`` (``list(str)``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:86
|
||
msgid "List of data files which are only installed or updated in *demonstration mode*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:97
|
||
msgid "``auto_install`` (``bool``, default: ``False``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:89
|
||
msgid "If ``True``, this module will automatically be installed if all of its dependencies are installed."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:92
|
||
msgid "It is generally used for \"link modules\" implementing synergic integration between two otherwise independent modules."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:95
|
||
msgid "For instance ``sale_crm`` depends on both ``sale`` and ``crm`` and is set to ``auto_install``. When both ``sale`` and ``crm`` are installed, it automatically adds CRM campaigns tracking to sale orders without either ``sale`` or ``crm`` being aware of one another"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:110
|
||
msgid "``external_dependencies`` (``dict(key=list(str))``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:100
|
||
msgid "A dictionary containing python and/or binary dependencies."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:102
|
||
msgid "For python dependencies, the ``python`` key must be defined for this dictionary and a list of python modules to be imported should be assigned to it."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:106
|
||
msgid "For binary dependencies, the ``bin`` key must be defined for this dictionary and a list of binary executable names should be assigned to it."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:109
|
||
msgid "The module won't be installed if either the python module is not installed in the host machine or the binary executable is not found within the host machine's PATH environment variable."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:114
|
||
msgid "``application`` (``bool``, default: ``False``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:113
|
||
msgid "Whether the module should be considered as a fully-fledged application (``True``) or is just a technical module (``False``) that provides some extra functionality to an existing application module."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:117
|
||
msgid "``css`` (``list(str)``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:117
|
||
msgid "Specify css files with custom rules to be imported, these files should be located in ``static/src/css`` inside the module."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:119
|
||
msgid "``images`` (``list(str)``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:120
|
||
msgid "Specify image files to be used by the module."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:121
|
||
msgid "``installable`` (``bool`` default: ``True``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:122
|
||
msgid "Whether a user should be able to install the module from the Web UI or not."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:124
|
||
msgid "``maintainer`` (``str``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:124
|
||
msgid "Person or entity in charge of the maintenance of this module, by default it is assumed that the author is the maintainer."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:140
|
||
msgid "``{pre_init, post_init, uninstall}_hook`` (``str``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:127
|
||
msgid "Hooks for module installation/uninstallation, their value should be a string representing the name of a function defined inside the module's ``__init__.py``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:131
|
||
msgid "``pre_init_hook`` takes a cursor as its only argument, this function is executed prior to the module's installation."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:134
|
||
msgid "``post_init_hook`` takes a cursor and a registry as its arguments, this function is executed right after the module's installation."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:137
|
||
msgid "``uninstall_hook`` takes a cursor and a registry as its arguments, this function is executed after the module's uninstallation."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:140
|
||
msgid "These hooks should only be used when setup/cleanup required for this module is either extremely difficult or impossible through the api."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:143
|
||
msgid "``active`` (``bool``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/module.rst:143
|
||
msgid "This indicates whether this module must install automatically or not."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:6
|
||
msgid "ORM API"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:14
|
||
msgid "Models"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:16
|
||
msgid "Model fields are defined as attributes on the model itself::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:24
|
||
msgid "this means you cannot define a field and a method with the same name, the last one will silently overwrite the former ones."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:27
|
||
msgid "By default, the field's label (user-visible name) is a capitalized version of the field name, this can be overridden with the ``string`` parameter. ::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:32
|
||
msgid "For the list of field types and parameters, see :ref:`the fields reference <reference/fields>`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:35
|
||
msgid "Default values are defined as parameters on fields, either as a value::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:39
|
||
msgid "or as a function called to compute the default value, which should return that value::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:85
|
||
msgid "AbstractModel"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:90
|
||
msgid "Model"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:99
|
||
msgid "TransientModel"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:111
|
||
#: ../../content/developer/reference/views.rst:36
|
||
msgid "Fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:123
|
||
msgid "Basic Fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:136
|
||
msgid "Advanced Fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:153
|
||
msgid "Date(time) Fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:155
|
||
msgid ":class:`Dates <odoo.fields.Date>` and :class:`Datetimes <odoo.fields.Datetime>` are very important fields in any kind of business application. Their misuse can create invisible yet painful bugs, this section aims to provide Odoo developers with the knowledge required to avoid misusing these fields."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:161
|
||
msgid "When assigning a value to a Date/Datetime field, the following options are valid:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:163
|
||
msgid "A `date` or `datetime` object."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:164
|
||
msgid "A string in the proper server format:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:166
|
||
msgid "``YYYY-MM-DD`` for :class:`~odoo.fields.Date` fields,"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:167
|
||
msgid "``YYYY-MM-DD HH:MM:SS`` for :class:`~odoo.fields.Datetime` fields."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:169
|
||
msgid "`False` or `None`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:171
|
||
msgid "The Date and Datetime fields class have helper methods to attempt conversion into a compatible type:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:174
|
||
msgid ":func:`~odoo.fields.Date.to_date` will convert to a :class:`datetime.date`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:175
|
||
msgid ":func:`~odoo.fields.Datetime.to_datetime` will convert to a :class:`datetime.datetime`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:179
|
||
msgid "To parse date/datetimes coming from external sources::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:183
|
||
msgid "Date / Datetime comparison best practices:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:185
|
||
msgid "Date fields can **only** be compared to date objects."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:186
|
||
msgid "Datetime fields can **only** be compared to datetime objects."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:188
|
||
msgid "Strings representing dates and datetimes can be compared between each other, however the result may not be the expected result, as a datetime string will always be greater than a date string, therefore this practice is **heavily** discouraged."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:194
|
||
msgid "Common operations with dates and datetimes such as addition, substraction or fetching the start/end of a period are exposed through both :class:`~odoo.fields.Date` and :class:`~odoo.fields.Datetime`. These helpers are also available by importing `odoo.tools.date_utils`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:199
|
||
msgid "Timezones"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:201
|
||
msgid "Datetime fields are stored as `timestamp without timezone` columns in the database and are stored in the UTC timezone. This is by design, as it makes the Odoo database independent from the timezone of the hosting server system. Timezone conversion is managed entirely by the client side."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:214
|
||
msgid "Relational Fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:223
|
||
msgid "Pseudo-relational fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:232
|
||
msgid "Computed Fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:234
|
||
msgid "Fields can be computed (instead of read straight from the database) using the ``compute`` parameter. **It must assign the computed value to the field**. If it uses the values of other *fields*, it should specify those fields using :func:`~odoo.api.depends`. ::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:247
|
||
msgid "dependencies can be dotted paths when using sub-fields::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:254
|
||
msgid "computed fields are not stored by default, they are computed and returned when requested. Setting ``store=True`` will store them in the database and automatically enable searching."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:257
|
||
msgid "searching on a computed field can also be enabled by setting the ``search`` parameter. The value is a method name returning a :ref:`reference/orm/domains`. ::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:268
|
||
msgid "The search method is invoked when processing domains before doing an actual search on the model. It must return a domain equivalent to the condition: ``field operator value``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:274
|
||
msgid "Computed fields are readonly by default. To allow *setting* values on a computed field, use the ``inverse`` parameter. It is the name of a function reversing the computation and setting the relevant fields::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:290
|
||
msgid "multiple fields can be computed at the same time by the same method, just use the same method on all fields and set all of them::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:306
|
||
msgid "While it is possible to use the same compute method for multiple fields, it is not recommended to do the same for the inverse method."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:310
|
||
msgid "During the computation of the inverse, **all** fields that use said inverse are protected, meaning that they can't be computed, even if their value is not in the cache."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:314
|
||
msgid "If any of those fields is accessed and its value is not in cache, the ORM will simply return a default value of `False` for these fields. This means that the value of the inverse fields (other than the one triggering the inverse method) may not give their correct value and this will probably break the expected behavior of the inverse method."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:323
|
||
msgid "Related fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:325
|
||
msgid "A special case of computed fields are *related* (proxy) fields, which provide the value of a sub-field on the current record. They are defined by setting the ``related`` parameter and like regular computed fields they can be stored::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:332
|
||
msgid "The value of a related field is given by following a sequence of relational fields and reading a field on the reached model. The complete sequence of fields to traverse is specified by the ``related`` attribute."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:336
|
||
msgid "Some field attributes are automatically copied from the source field if they are not redefined: ``string``, ``help``, ``readonly``, ``required`` (only if all fields in the sequence are required), ``groups``, ``digits``, ``size``, ``translate``, ``sanitize``, ``selection``, ``comodel_name``, ``domain``, ``context``. All semantic-free attributes are copied from the source field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:343
|
||
msgid "By default, the values of related fields are not stored to the database. Add the attribute ``store=True`` to make it stored, just like computed fields. Related fields are automatically recomputed when their dependencies are modified."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:348
|
||
msgid "The related fields are computed in sudo mode."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:352
|
||
msgid "You cannot chain :class:`~odoo.fields.Many2many` or :class:`~odoo.fields.One2many` fields in ``related`` fields dependencies."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:354
|
||
msgid "``related`` can be used to refer to a :class:`~odoo.fields.One2many` or :class:`~odoo.fields.Many2many` field on another model on the condition that it's done through a ``Many2one`` relation on the current model. ``One2many`` and ``Many2many`` are not supported and the results will not be aggregated correctly::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:375
|
||
msgid "Automatic fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:379
|
||
msgid "Identifier :class:`field <odoo.fields.Field>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:381
|
||
msgid "If length of current recordset is 1, return id of unique record in it."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:383
|
||
msgid "Raise an Error otherwise."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:388
|
||
msgid "Access Log fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:390
|
||
msgid "These fields are automatically set and updated if :attr:`~odoo.models.BaseModel._log_access` is enabled. It can be disabled to avoid creating or updating those fields on tables for which they are not useful."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:395
|
||
msgid "By default, :attr:`~odoo.models.BaseModel._log_access` is set to the same value as :attr:`~odoo.models.BaseModel._auto`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:400
|
||
msgid "Stores when the record was created, :class:`~odoo.fields.Datetime`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:404
|
||
msgid "Stores *who* created the record, :class:`~odoo.fields.Many2one` to a ``res.users``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:409
|
||
msgid "Stores when the record was last updated, :class:`~odoo.fields.Datetime`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:413
|
||
msgid "Stores who last updated the record, :class:`~odoo.fields.Many2one` to a ``res.users``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:416
|
||
msgid ":attr:`~odoo.models.BaseModel._log_access` *must* be enabled on :class:`~odoo.models.TransientModel`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:422
|
||
msgid "Reserved Field names"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:424
|
||
msgid "A few field names are reserved for pre-defined behaviors beyond that of automated fields. They should be defined on a model when the related behavior is desired:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:430
|
||
msgid "default value for :attr:`~odoo.models.BaseModel._rec_name`, used to display records in context where a representative \"naming\" is necessary."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:434
|
||
#: ../../content/developer/reference/orm.rst:472
|
||
msgid ":class:`~odoo.fields.Char`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:438
|
||
msgid "toggles the global visibility of the record, if ``active`` is set to ``False`` the record is invisible in most searches and listing."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:441
|
||
msgid ":class:`~odoo.fields.Boolean`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:452
|
||
msgid "lifecycle stages of the object, used by the ``states`` attribute on :class:`fields <odoo.fields.Field>`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:455
|
||
msgid ":class:`~odoo.fields.Selection`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:459
|
||
msgid "default_value of :attr:`~._parent_name`, used to organize records in a tree structure and enables the ``child_of`` and ``parent_of`` operators in domains."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:463
|
||
msgid ":class:`~odoo.fields.Many2one`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:467
|
||
msgid "When :attr:`~._parent_store` is set to True, used to store a value reflecting the tree structure of :attr:`~._parent_name`, and to optimize the operators ``child_of`` and ``parent_of`` in search domains. It must be declared with ``index=True`` for proper operation."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:476
|
||
msgid "Main field name used for Odoo multi-company behavior."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:478
|
||
msgid "Used by `:meth:~odoo.models._check_company` to check multi company consistency. Defines whether a record is shared between companies (no value) or only accessible by the users of a given company."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:482
|
||
msgid ":class:`~odoo.fields.Many2one` :type: :class:`~odoo.addons.base.models.res_company`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:486
|
||
msgid "Recordsets"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:488
|
||
msgid "Interactions with models and records are performed through recordsets, an ordered collection of records of the same model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:491
|
||
msgid "Contrary to what the name implies, it is currently possible for recordsets to contain duplicates. This may change in the future."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:494
|
||
msgid "Methods defined on a model are executed on a recordset, and their ``self`` is a recordset::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:504
|
||
msgid "Iterating on a recordset will yield new sets of *a single record* (\"singletons\"), much like iterating on a Python string yields strings of a single characters::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:514
|
||
msgid "Field access"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:516
|
||
msgid "Recordsets provide an \"Active Record\" interface: model fields can be read and written directly from the record as attributes."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:521
|
||
msgid "When accessing non-relational fields on a recordset of potentially multiple records, use :meth:`~odoo.models.BaseModel.mapped`::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:526
|
||
msgid "Field values can also be accessed like dict items, which is more elegant and safer than ``getattr()`` for dynamic field names. Setting a field's value triggers an update to the database::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:541
|
||
msgid "Trying to read a field on multiple records will raise an error for non relational fields."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:544
|
||
msgid "Accessing a relational field (:class:`~odoo.fields.Many2one`, :class:`~odoo.fields.One2many`, :class:`~odoo.fields.Many2many`) *always* returns a recordset, empty if the field is not set."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:549
|
||
msgid "Record cache and prefetching"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:551
|
||
msgid "Odoo maintains a cache for the fields of the records, so that not every field access issues a database request, which would be terrible for performance. The following example queries the database only for the first statement::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:558
|
||
msgid "To avoid reading one field on one record at a time, Odoo *prefetches* records and fields following some heuristics to get good performance. Once a field must be read on a given record, the ORM actually reads that field on a larger recordset, and stores the returned values in cache for later use. The prefetched recordset is usually the recordset from which the record comes by iteration. Moreover, all simple stored fields (boolean, integer, float, char, text, date, datetime, selection, many2one) are fetched altogether; they correspond to the columns of the model's table, and are fetched efficiently in the same query."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:567
|
||
msgid "Consider the following example, where ``partners`` is a recordset of 1000 records. Without prefetching, the loop would make 2000 queries to the database. With prefetching, only one query is made::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:576
|
||
msgid "The prefetching also works on *secondary records*: when relational fields are read, their values (which are records) are subscribed for future prefetching. Accessing one of those secondary records prefetches all secondary records from the same model. This makes the following example generate only two queries, one for partners and one for countries::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:591
|
||
msgid "Method decorators"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:605
|
||
msgid "With sphinx 2.0 : autodecorator"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:607
|
||
msgid "Add in Views reference * It is possible to suppress the trigger from a specific field by adding ``on_change=\"0\"`` in a view::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:613
|
||
msgid "will not trigger any interface update when the field is edited by the user, even if there are function fields or explicit onchange depending on that field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:620
|
||
msgid "Environment"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:622
|
||
msgid "The :class:`~odoo.api.Environment` stores various contextual data used by the ORM: the database cursor (for database queries), the current user (for access rights checking) and the current context (storing arbitrary metadata). The environment also stores caches."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:627
|
||
msgid "All recordsets have an environment, which is immutable, can be accessed using :attr:`~odoo.models.Model.env` and gives access to:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:630
|
||
msgid "the current user (:attr:`~odoo.api.Environment.user`)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:631
|
||
msgid "the cursor (:attr:`~odoo.api.Environment.cr`)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:632
|
||
msgid "the superuser flag (:attr:`~odoo.api.Environment.su`)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:633
|
||
msgid "or the context (:attr:`~odoo.api.Environment.context`)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:644
|
||
msgid "When creating a recordset from an other recordset, the environment is inherited. The environment can be used to get an empty recordset in an other model, and query that model::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:668
|
||
msgid "Altering the environment"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:685
|
||
msgid "SQL Execution"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:687
|
||
msgid "The :attr:`~odoo.api.Environment.cr` attribute on environments is the cursor for the current database transaction and allows executing SQL directly, either for queries which are difficult to express using the ORM (e.g. complex joins) or for performance reasons::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:694
|
||
msgid "Because models use the same cursor and the :class:`~odoo.api.Environment` holds various caches, these caches must be invalidated when *altering* the database in raw SQL, or further uses of models may become incoherent. It is necessary to clear caches when using ``CREATE``, ``UPDATE`` or ``DELETE`` in SQL, but not ``SELECT`` (which simply reads the database)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:701
|
||
msgid "Clearing caches can be performed using the :meth:`~odoo.models.Model.invalidate_cache` method."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:707
|
||
msgid "Executing raw SQL bypasses the ORM, and by consequent, Odoo security rules. Please make sure your queries are sanitized when using user input and prefer using ORM utilities if you don't really need to use SQL queries."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:715
|
||
msgid "Common ORM methods"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:720
|
||
msgid "Create/update"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:722
|
||
msgid "api.model_create_multi information"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:737
|
||
msgid "Search/Read"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:752
|
||
msgid "Fields/Views"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:761
|
||
msgid "Search domains"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:763
|
||
msgid "A domain is a list of criteria, each criterion being a triple (either a ``list`` or a ``tuple``) of ``(field_name, operator, value)`` where:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:769
|
||
msgid "``field_name`` (``str``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:767
|
||
msgid "a field name of the current model, or a relationship traversal through a :class:`~odoo.fields.Many2one` using dot-notation e.g. ``'street'`` or ``'partner_id.country'``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:823
|
||
msgid "``operator`` (``str``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:772
|
||
msgid "an operator used to compare the ``field_name`` with the ``value``. Valid operators are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:775
|
||
msgid "``=``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:776
|
||
msgid "equals to"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:777
|
||
msgid "``!=``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:778
|
||
msgid "not equals to"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:779
|
||
msgid "``>``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:780
|
||
msgid "greater than"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:781
|
||
msgid "``>=``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:782
|
||
msgid "greater than or equal to"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:783
|
||
msgid "``<``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:784
|
||
msgid "less than"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:785
|
||
msgid "``<=``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:786
|
||
msgid "less than or equal to"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:788
|
||
msgid "``=?``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:788
|
||
msgid "unset or equals to (returns true if ``value`` is either ``None`` or ``False``, otherwise behaves like ``=``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:792
|
||
msgid "``=like``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:791
|
||
msgid "matches ``field_name`` against the ``value`` pattern. An underscore ``_`` in the pattern stands for (matches) any single character; a percent sign ``%`` matches any string of zero or more characters."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:795
|
||
msgid "``like``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:795
|
||
msgid "matches ``field_name`` against the ``%value%`` pattern. Similar to ``=like`` but wraps ``value`` with '%' before matching"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:797
|
||
msgid "``not like``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:798
|
||
msgid "doesn't match against the ``%value%`` pattern"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:799
|
||
msgid "``ilike``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:800
|
||
msgid "case insensitive ``like``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:801
|
||
msgid "``not ilike``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:802
|
||
msgid "case insensitive ``not like``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:803
|
||
msgid "``=ilike``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:804
|
||
msgid "case insensitive ``=like``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:806
|
||
msgid "``in``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:806
|
||
msgid "is equal to any of the items from ``value``, ``value`` should be a list of items"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:808
|
||
msgid "``not in``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:809
|
||
msgid "is unequal to all of the items from ``value``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:815
|
||
msgid "``child_of``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:811
|
||
msgid "is a child (descendant) of a ``value`` record (value can be either one item or a list of items)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:814
|
||
#: ../../content/developer/reference/orm.rst:821
|
||
msgid "Takes the semantics of the model into account (i.e following the relationship field named by :attr:`~odoo.models.Model._parent_name`)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:823
|
||
msgid "``parent_of``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:818
|
||
msgid "is a parent (ascendant) of a ``value`` record (value can be either one item or a list of items)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:826
|
||
msgid "variable type, must be comparable (through ``operator``) to the named field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:829
|
||
msgid "Domain criteria can be combined using logical operators in *prefix* form:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:832
|
||
msgid "``'&'``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:832
|
||
msgid "logical *AND*, default operation to combine criteria following one another. Arity 2 (uses the next 2 criteria or combinations)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:834
|
||
msgid "``'|'``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:835
|
||
msgid "logical *OR*, arity 2."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:841
|
||
msgid "``'!'``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:837
|
||
msgid "logical *NOT*, arity 1."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:839
|
||
msgid "Mostly to negate combinations of criteria Individual criterion generally have a negative form (e.g. ``=`` -> ``!=``, ``<`` -> ``>=``) which is simpler than negating the positive."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:845
|
||
msgid "To search for partners named *ABC*, from belgium or germany, whose language is not english::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:853
|
||
msgid "This domain is interpreted as:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:862
|
||
msgid "Unlink"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:869
|
||
msgid "Record(set) information"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:875
|
||
msgid "Returns the environment of the given recordset."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:0
|
||
msgid "type"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:877
|
||
msgid ":class:`~odoo.api.Environment`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:879
|
||
msgid "Environment documentation"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:892
|
||
msgid "Operations"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:894
|
||
msgid "Recordsets are immutable, but sets of the same model can be combined using various set operations, returning new recordsets."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:899
|
||
msgid "``record in set`` returns whether ``record`` (which must be a 1-element recordset) is present in ``set``. ``record not in set`` is the inverse operation"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:902
|
||
msgid "``set1 <= set2`` and ``set1 < set2`` return whether ``set1`` is a subset of ``set2`` (resp. strict)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:904
|
||
msgid "``set1 >= set2`` and ``set1 > set2`` return whether ``set1`` is a superset of ``set2`` (resp. strict)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:906
|
||
msgid "``set1 | set2`` returns the union of the two recordsets, a new recordset containing all records present in either source"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:908
|
||
msgid "``set1 & set2`` returns the intersection of two recordsets, a new recordset containing only records present in both sources"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:910
|
||
msgid "``set1 - set2`` returns a new recordset containing only records of ``set1`` which are *not* in ``set2``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:913
|
||
msgid "Recordsets are iterable so the usual Python tools are available for transformation (:func:`python:map`, :func:`python:sorted`, :func:`~python:itertools.ifilter`, ...) however these return either a :class:`python:list` or an :term:`python:iterator`, removing the ability to call methods on their result, or to use set operations."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:919
|
||
msgid "Recordsets therefore provide the following operations returning recordsets themselves (when possible):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:923
|
||
msgid "Filter"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:930
|
||
#: ../../content/developer/reference/views.rst:1639
|
||
msgid "Map"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:936
|
||
msgid "Since V13, multi-relational field access is supported and works like a mapped call:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:945
|
||
msgid "Sort"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:952
|
||
msgid "Inheritance and extension"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:954
|
||
msgid "Odoo provides three different mechanisms to extend models in a modular way:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:956
|
||
msgid "creating a new model from an existing one, adding new information to the copy but leaving the original module as-is"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:958
|
||
msgid "extending models defined in other modules in-place, replacing the previous version"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:960
|
||
msgid "delegating some of the model's fields to records it contains"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:966
|
||
msgid "Classical inheritance"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:968
|
||
msgid "When using the :attr:`~odoo.models.Model._inherit` and :attr:`~odoo.models.Model._name` attributes together, Odoo creates a new model using the existing one (provided via :attr:`~odoo.models.Model._inherit`) as a base. The new model gets all the fields, methods and meta-information (defaults & al) from its base."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:996
|
||
msgid "and using them::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:1004
|
||
msgid "will yield:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:1006
|
||
msgid "\"This is model 0 record A\" \"This is model 1 record B\""
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:1009
|
||
msgid "the second model has inherited from the first model's ``check`` method and its ``name`` field, but overridden the ``call`` method, as when using standard :ref:`Python inheritance <python:tut-inheritance>`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:1014
|
||
msgid "Extension"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:1016
|
||
msgid "When using :attr:`~odoo.models.Model._inherit` but leaving out :attr:`~odoo.models.Model._name`, the new model replaces the existing one, essentially extending it in-place. This is useful to add new fields or methods to existing models (created in other modules), or to customize or reconfigure them (e.g. to change their default sort order)::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:1038
|
||
msgid "will yield::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:1045
|
||
msgid "It will also yield the various :ref:`automatic fields <reference/fields/automatic>` unless they've been disabled"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:1049
|
||
msgid "Delegation"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:1051
|
||
msgid "The third inheritance mechanism provides more flexibility (it can be altered at runtime) but less power: using the :attr:`~odoo.models.Model._inherits` a model *delegates* the lookup of any field not found on the current model to \"children\" models. The delegation is performed via :class:`~odoo.fields.Reference` fields automatically set up on the parent model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:1058
|
||
msgid "The main difference is in the meaning. When using Delegation, the model **has one** instead of **is one**, turning the relationship in a composition instead of inheritance::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:1100
|
||
#: ../../content/developer/reference/qweb.rst:26
|
||
#: ../../content/developer/reference/qweb.rst:36
|
||
#: ../../content/developer/reference/qweb.rst:324
|
||
msgid "will result in::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:1105
|
||
msgid "and it's possible to write directly on the delegated field::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:1109
|
||
msgid "when using delegation inheritance, methods are *not* inherited, only fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:1114
|
||
msgid "`_inherits` is more or less implemented, avoid it if you can;"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:1115
|
||
msgid "chained `_inherits` is essentially not implemented, we cannot guarantee anything on the final behavior."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:1119
|
||
msgid "Fields Incremental Definition"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:1121
|
||
msgid "A field is defined as class attribute on a model class. If the model is extended, one can also extend the field definition by redefining a field with the same name and same type on the subclass. In that case, the attributes of the field are taken from the parent class and overridden by the ones given in subclasses."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:1127
|
||
msgid "For instance, the second class below only adds a tooltip on the field ``state``::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/orm.rst:1141
|
||
msgid "Error management"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:8
|
||
#: ../../content/developer/reference/views.rst:1774
|
||
msgid "QWeb"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:10
|
||
msgid "QWeb is the primary templating_ engine used by Odoo\\ [#othertemplates]_. It is an XML templating engine\\ [#genshif]_ and used mostly to generate HTML_ fragments and pages."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:14
|
||
msgid "Template directives are specified as XML attributes prefixed with ``t-``, for instance ``t-if`` for :ref:`reference/qweb/conditionals`, with elements and other attributes being rendered directly."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:18
|
||
msgid "To avoid element rendering, a placeholder element ``<t>`` is also available, which executes its directive but doesn't generate any output in and of itself::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:30
|
||
msgid "if ``condition`` is true, but::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:45
|
||
msgid "Data output"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:47
|
||
msgid "QWeb has a primary output directive which automatically HTML-escape its content limiting XSS_ risks when displaying user-provided content: ``esc``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:50
|
||
msgid "``esc`` takes an expression, evaluates it and prints the content::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:54
|
||
msgid "rendered with the value ``value`` set to ``42`` yields::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:58
|
||
msgid "There is one other output directive ``raw`` which behaves the same as respectively ``esc`` but *does not HTML-escape its output*. It can be useful to display separately constructed markup (e.g. from functions) or already sanitized user-provided markup."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:68
|
||
msgid "QWeb has a conditional directive ``if``, which evaluates an expression given as attribute value::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:77
|
||
msgid "The element is rendered if the condition is true::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:83
|
||
msgid "but if the condition is false it is removed from the result::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:88
|
||
msgid "The conditional rendering applies to the bearer of the directive, which does not have to be ``<t>``::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:95
|
||
msgid "will give the same results as the previous example."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:97
|
||
msgid "Extra conditional branching directives ``t-elif`` and ``t-else`` are also available::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:110
|
||
msgid "Loops"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:112
|
||
msgid "QWeb has an iteration directive ``foreach`` which take an expression returning the collection to iterate on, and a second parameter ``t-as`` providing the name to use for the \"current item\" of the iteration::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:120
|
||
#: ../../content/developer/reference/qweb.rst:209
|
||
#: ../../content/developer/reference/qweb.rst:223
|
||
#: ../../content/developer/reference/qweb.rst:234
|
||
#: ../../content/developer/reference/qweb.rst:244
|
||
msgid "will be rendered as::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:126
|
||
msgid "Like conditions, ``foreach`` applies to the element bearing the directive's attribute, and"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:135
|
||
msgid "is equivalent to the previous example."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:137
|
||
msgid "``foreach`` can iterate on an array (the current item will be the current value) or a mapping (the current item will be the current key). Iterating on an integer (equivalent to iterating on an array between 0 inclusive and the provided integer exclusive) is still supported but deprecated."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:142
|
||
msgid "In addition to the name passed via ``t-as``, ``foreach`` provides a few other variables for various data points:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:145
|
||
msgid "``$as`` will be replaced by the name passed to ``t-as``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:150
|
||
msgid ":samp:`{$as}_all` (deprecated)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:148
|
||
msgid "the object being iterated over"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:150
|
||
msgid "This variable is only available on JavaScript QWeb, not Python."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:153
|
||
msgid ":samp:`{$as}_value`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:153
|
||
msgid "the current iteration value, identical to ``$as`` for lists and integers, but for mappings it provides the value (where ``$as`` provides the key)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:155
|
||
msgid ":samp:`{$as}_index`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:156
|
||
msgid "the current iteration index (the first item of the iteration has index 0)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:157
|
||
msgid ":samp:`{$as}_size`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:158
|
||
msgid "the size of the collection if it is available"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:160
|
||
msgid ":samp:`{$as}_first`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:160
|
||
msgid "whether the current item is the first of the iteration (equivalent to :samp:`{$as}_index == 0`)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:164
|
||
msgid ":samp:`{$as}_last`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:163
|
||
msgid "whether the current item is the last of the iteration (equivalent to :samp:`{$as}_index + 1 == {$as}_size`), requires the iteratee's size be available"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:166
|
||
msgid ":samp:`{$as}_parity` (deprecated)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:167
|
||
msgid "either ``\"even\"`` or ``\"odd\"``, the parity of the current iteration round"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:169
|
||
msgid ":samp:`{$as}_even` (deprecated)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:169
|
||
msgid "a boolean flag indicating that the current iteration round is on an even index"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:173
|
||
msgid ":samp:`{$as}_odd` (deprecated)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:172
|
||
msgid "a boolean flag indicating that the current iteration round is on an odd index"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:175
|
||
msgid "These extra variables provided and all new variables created into the ``foreach`` are only available in the scope of the``foreach``. If the variable exists outside the context of the ``foreach``, the value is copied at the end of the foreach into the global context."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:197
|
||
msgid "attributes"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:199
|
||
msgid "QWeb can compute attributes on-the-fly and set the result of the computation on the output node. This is done via the ``t-att`` (attribute) directive which exists in 3 different forms:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:210
|
||
msgid ":samp:`t-att-{$name}`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:204
|
||
msgid "an attribute called ``$name`` is created, the attribute value is evaluated and the result is set as the attribute's value::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:226
|
||
msgid ":samp:`t-attf-{$name}`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:213
|
||
msgid "same as previous, but the parameter is a :term:`format string` instead of just an expression, often useful to mix literal and non-literal string (e.g. classes)::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:235
|
||
msgid ":samp:`t-att=mapping`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:229
|
||
msgid "if the parameter is a mapping, each (key, value) pair generates a new attribute and its value::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:246
|
||
msgid ":samp:`t-att=pair`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:238
|
||
msgid "if the parameter is a pair (tuple or array of 2 element), the first item of the pair is the name of the attribute and the second item is the value::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:249
|
||
msgid "setting variables"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:251
|
||
msgid "QWeb allows creating variables from within the template, to memoize a computation (to use it multiple times), give a piece of data a clearer name, ..."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:255
|
||
msgid "This is done via the ``set`` directive, which takes the name of the variable to create. The value to set can be provided in two ways:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:258
|
||
msgid "a ``t-value`` attribute containing an expression, and the result of its evaluation will be set::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:264
|
||
msgid "will print ``3``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:265
|
||
msgid "if there is no ``t-value`` attribute, the node's body is rendered and set as the variable's value::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:273
|
||
msgid "will generate ``<li>ok</li>`` (the content is escaped as we used the ``esc`` directive)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:276
|
||
msgid "using the result of this operation is a significant use-case for the ``raw`` directive."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:280
|
||
msgid "calling sub-templates"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:282
|
||
msgid "QWeb templates can be used for top-level rendering, but they can also be used from within another template (to avoid duplication or give names to parts of templates) using the ``t-call`` directive::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:288
|
||
msgid "This calls the named template with the execution context of the parent, if ``other_template`` is defined as::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:293
|
||
msgid "the call above will be rendered as ``<p/>`` (no content), but::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:298
|
||
msgid "will be rendered as ``<p>1</p>``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:300
|
||
msgid "However this has the problem of being visible from outside the ``t-call``. Alternatively, content set in the body of the ``call`` directive will be evaluated *before* calling the sub-template, and can alter a local context::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:309
|
||
msgid "The body of the ``call`` directive can be arbitrarily complex (not just ``set`` directives), and its rendered form will be available within the called template as a magical ``0`` variable::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:318
|
||
msgid "being called thus::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:335
|
||
#: ../../content/developer/reference/qweb.rst:436
|
||
msgid "Exclusive directives"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:338
|
||
msgid "Asset bundles"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:340
|
||
msgid "have fme write these up because I've no idea how they work"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:343
|
||
msgid "\"smart records\" fields formatting"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:345
|
||
msgid "The ``t-field`` directive can only be used when performing field access (``a.b``) on a \"smart\" record (result of the ``browse`` method). It is able to automatically format based on field type, and is integrated in the website's rich text editing."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:350
|
||
msgid "``t-options`` can be used to customize fields, the most common option is ``widget``, other options are field- or widget-dependent."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:354
|
||
msgid "Debugging"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:362
|
||
#: ../../content/developer/reference/qweb.rst:563
|
||
msgid "``t-debug``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:357
|
||
msgid "invokes a debugger using PDB's ``set_trace`` API. The parameter should be the name of a module, on which a ``set_trace`` method is called::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:362
|
||
msgid "is equivalent to ``importlib.import_module(\"pdb\").set_trace()``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:365
|
||
#: ../../content/developer/reference/qweb.rst:576
|
||
msgid "Helpers"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:368
|
||
msgid "Request-based"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:370
|
||
msgid "Most Python-side uses of QWeb are in controllers (and during HTTP requests), in which case templates stored in the database (as :ref:`views <reference/views/qweb>`) can be trivially rendered by calling :meth:`odoo.http.HttpRequest.render`:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:381
|
||
msgid "This automatically creates a :class:`~odoo.http.Response` object which can be returned from the controller (or further customized to suit)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:385
|
||
msgid "View-based"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:387
|
||
msgid "At a deeper level than the previous helper is the ``render`` method on ``ir.ui.view``:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:392
|
||
msgid "Renders a QWeb view/template by database id or :term:`external id`. Templates are automatically loaded from ``ir.ui.view`` records."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:395
|
||
msgid "Sets up a number of default values in the rendering context:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:397
|
||
#: ../../content/developer/webservices/upgrade.rst:113
|
||
#: ../../content/developer/webservices/upgrade.rst:320
|
||
msgid "``request``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:398
|
||
msgid "the current :class:`~odoo.http.WebRequest` object, if any"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:399
|
||
msgid "``debug``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:400
|
||
msgid "whether the current request (if any) is in ``debug`` mode"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:401
|
||
msgid ":func:`quote_plus <werkzeug.urls.url_quote_plus>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:402
|
||
msgid "url-encoding utility function"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:403
|
||
msgid ":mod:`json`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:404
|
||
#: ../../content/developer/reference/qweb.rst:406
|
||
#: ../../content/developer/reference/qweb.rst:408
|
||
msgid "the corresponding standard library module"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:405
|
||
msgid ":mod:`time`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:407
|
||
msgid ":mod:`datetime`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:409
|
||
msgid "`relativedelta <https://labix.org/python-dateutil#head-ba5ffd4df8111d1b83fc194b97ebecf837add454>`_"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:410
|
||
msgid "see module"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:412
|
||
msgid "``keep_query``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:412
|
||
msgid "the ``keep_query`` helper function"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:414
|
||
msgid "context values to pass to QWeb for rendering"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:415
|
||
msgid "name of the Odoo model to use for rendering, can be used to expand or customize QWeb locally (by creating a \"new\" qweb based on ``ir.qweb`` with alterations)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:421
|
||
msgid "the members below are no longer relevant, section to rewrite"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:433
|
||
#: ../../content/developer/reference/security.rst:356
|
||
#: ../../content/developer/reference/security.rst:358
|
||
msgid "Javascript"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:439
|
||
msgid "Defining templates"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:441
|
||
msgid "The ``t-name`` directive can only be placed at the top-level of a template file (direct children to the document root)::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:450
|
||
msgid "It takes no other parameter, but can be used with a ``<t>`` element or any other. With a ``<t>`` element, the ``<t>`` should have a single child."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:453
|
||
msgid "The template name is an arbitrary string, although when multiple templates are related (e.g. called sub-templates) it is customary to use dot-separated names to indicate hierarchical relationships."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:458
|
||
msgid "Template inheritance"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:460
|
||
msgid "Template inheritance is used to either:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:461
|
||
msgid "Alter existing templates in-place, e.g. to add information to templates"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:463
|
||
msgid "created by other modules."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:463
|
||
msgid "Create a new template from a given parent template"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:469
|
||
msgid "Template inheritance is performed via the use of two directives:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:466
|
||
msgid "``t-inherit`` which is the name of the template to inherit from,"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:467
|
||
msgid "``t-inherit-mode`` which is the behaviour of the inheritance: it can either be set to ``primary`` to create a new child template from the parented one or to ``extension`` to alter the parent template in place."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:471
|
||
msgid "An optional ``t-name`` directive can also be specified. It will be the name of the newly created template if used in primary mode, else it will be added as a comment on the transformed template to help retrace inheritances."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:475
|
||
msgid "For the inheritance itself, the changes are done using xpaths directives. See the XPATH_ documentation for the complete set of available instructions."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:478
|
||
msgid "Primary inheritance (child template)::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:486
|
||
msgid "Extension inheritance (in-place transformation)::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:495
|
||
msgid "Old inheritance mechanism (deprecated)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:497
|
||
msgid "Template inheritance is performed via the ``t-extend`` directive which takes the name of the template to alter as parameter."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:500
|
||
msgid "The directive ``t-extend`` will act as a primary inheritance when combined with ``t-name`` and as an extension one when used alone."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:503
|
||
msgid "In both cases the alteration is then performed with any number of ``t-jquery`` sub-directives::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:512
|
||
msgid "The ``t-jquery`` directives takes a `CSS selector`_. This selector is used on the extended template to select *context nodes* to which the specified ``t-operation`` is applied:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:517
|
||
msgid "``append``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:517
|
||
msgid "the node's body is appended at the end of the context node (after the context node's last child)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:520
|
||
msgid "``prepend``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:520
|
||
msgid "the node's body is prepended to the context node (inserted before the context node's first child)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:523
|
||
msgid "the node's body is inserted right before the context node"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:525
|
||
msgid "the node's body is inserted right after the context node"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:526
|
||
msgid "``inner``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:527
|
||
msgid "the node's body replaces the context node's children"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:529
|
||
msgid "the node's body is used to replace the context node itself"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:531
|
||
msgid "the nodes's body should be any number of ``attribute`` elements, each with a ``name`` attribute and some textual content, the named attribute of the context node will be set to the specified value (either replaced if it already existed or added if not)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:541
|
||
msgid "No operation"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:536
|
||
msgid "if no ``t-operation`` is specified, the template body is interpreted as javascript code and executed with the context node as ``this``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:539
|
||
msgid "while much more powerful than other operations, this mode is also much harder to debug and maintain, it is recommended to avoid it"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:544
|
||
msgid "debugging"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:546
|
||
msgid "The javascript QWeb implementation provides a few debugging hooks:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:554
|
||
msgid "``t-log``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:549
|
||
msgid "takes an expression parameter, evaluates the expression during rendering and logs its result with ``console.log``::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:555
|
||
msgid "will print ``42`` to the console"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:557
|
||
msgid "triggers a debugger breakpoint during template rendering::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:563
|
||
msgid "will stop execution if debugging is active (exact condition depend on the browser and its development tools)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:573
|
||
msgid "``t-js``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:566
|
||
msgid "the node's body is javascript code executed during template rendering. Takes a ``context`` parameter, which is the name under which the rendering context will be available in the ``t-js``'s body::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:580
|
||
msgid "(core is the ``web.core`` module) An instance of :js:class:`QWeb2.Engine` with all module-defined template files loaded, and references to standard helper objects ``_`` (underscore), ``_t`` (translation function) and JSON_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:584
|
||
msgid ":js:func:`core.qweb.render <QWeb2.Engine.render>` can be used to easily render basic module templates"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:594
|
||
msgid "The QWeb \"renderer\", handles most of QWeb's logic (loading, parsing, compiling and rendering templates)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:597
|
||
msgid "Odoo Web instantiates one for the user in the core module, and exports it to ``core.qweb``. It also loads all the template files of the various modules into that QWeb instance."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:601
|
||
msgid "A :js:class:`QWeb2.Engine` also serves as a \"template namespace\"."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:605
|
||
msgid "Renders a previously loaded template to a String, using ``context`` (if provided) to find the variables accessed during template rendering (e.g. strings to display)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:609
|
||
msgid "the name of the template to render"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:610
|
||
msgid "the basic namespace to use for template rendering"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:612
|
||
msgid "String"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:614
|
||
msgid "The engine exposes an other method which may be useful in some cases (e.g. if you need a separate template namespace with, in Odoo Web, Kanban views get their own :js:class:`QWeb2.Engine` instance so their templates don't collide with more general \"module\" templates):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:622
|
||
msgid "Loads a template file (a collection of templates) in the QWeb instance. The templates can be specified as:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:627
|
||
msgid "An XML string"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:626
|
||
msgid "QWeb will attempt to parse it to an XML document then load it."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:631
|
||
msgid "A URL"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:630
|
||
msgid "QWeb will attempt to download the URL content, then load the resulting XML string."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:636
|
||
msgid "A ``Document`` or ``Node``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:634
|
||
msgid "QWeb will traverse the first level of the document (the child nodes of the provided root) and load any named template or template override."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:640
|
||
msgid "A :js:class:`QWeb2.Engine` also exposes various attributes for behavior customization:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:645
|
||
msgid "Prefix used to recognize directives during parsing. A string. By default, ``t``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:650
|
||
msgid "Boolean flag putting the engine in \"debug mode\". Normally, QWeb intercepts any error raised during template execution. In debug mode, it leaves all exceptions go through without intercepting them."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:657
|
||
msgid "The jQuery instance used during template inheritance processing. Defaults to ``window.jQuery``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:662
|
||
msgid "A ``Function``. If present, called before compiling each DOM node to template code. In Odoo Web, this is used to automatically translate text content and some attributes in templates. Defaults to ``null``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:667
|
||
msgid "it is similar in that to Genshi_, although it does not use (and has no support for) `XML namespaces`_"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/qweb.rst:670
|
||
msgid "although it uses a few others, either for historical reasons or because they remain better fits for the use case. Odoo 9.0 still depends on Jinja_ and Mako_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:10
|
||
msgid "QWeb Reports"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:12
|
||
msgid "Reports are written in HTML/QWeb, like website views in Odoo. You can use the usual :ref:`QWeb control flow tools <reference/qweb>`. The PDF rendering itself is performed by wkhtmltopdf_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:16
|
||
msgid "Reports are declared using a :ref:`report action <reference/actions/report>`, and a :ref:`reference/reports/templates` for the action to use."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:19
|
||
msgid "If useful or necessary, it is possible to specify a :ref:`reference/reports/paper_formats` for the report report."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:25
|
||
msgid "Report template"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:27
|
||
msgid "Report templates will always provide the following variables:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:29
|
||
msgid "``time``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:30
|
||
msgid "a reference to :mod:`python:time` from the Python standard library"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:32
|
||
msgid "``res.user`` record for the user printing the report"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:33
|
||
msgid "``res_company``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:34
|
||
msgid "record for the current ``user``'s company"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:35
|
||
msgid "``website``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:36
|
||
msgid "the current website object, if any (this item can be present but ``None``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:37
|
||
msgid "``web_base_url``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:38
|
||
msgid "the base url for the webserver"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:41
|
||
msgid "``context_timestamp``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:40
|
||
msgid "a function taking :class:`python:datetime.datetime` in UTC\\ [#unzoned]_ and converting it to the timezone of the user printing the report"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:44
|
||
msgid "Minimal viable template"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:46
|
||
msgid "A minimal template would look like::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:61
|
||
msgid "Calling ``external_layout`` will add the default header and footer on your report. The PDF body will be the content inside the ``<div class=\"page\">``. The template's ``id`` must be the name specified in the report declaration; for example ``account.report_invoice`` for the above report. Since this is a QWeb template, you can access all the fields of the ``docs`` objects received by the template."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:68
|
||
msgid "By default, the rendering context will also expose the following items:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:71
|
||
msgid "records for the current report"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:72
|
||
msgid "``doc_ids``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:73
|
||
msgid "list of ids for the ``docs`` records"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:75
|
||
msgid "``doc_model``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:75
|
||
msgid "model for the ``docs`` records"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:77
|
||
msgid "If you wish to access other records/models in the template, you will need :ref:`a custom report <reference/reports/custom_reports>`, however in that case you will have to provide the items above if you need them."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:82
|
||
msgid "Translatable Templates"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:84
|
||
msgid "If you wish to translate reports (to the language of a partner, for example), you need to define two templates:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:87
|
||
msgid "The main report template"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:88
|
||
msgid "The translatable document"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:90
|
||
msgid "You can then call the translatable document from your main template with the attribute ``t-lang`` set to a language code (for example ``fr`` or ``en_US``) or to a record field. You will also need to re-browse the related records with the proper context if you use fields that are translatable (like country names, sales conditions, etc.)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:97
|
||
msgid "If your report template does not use translatable record fields, re-browsing the record in another language is *not* necessary and will impact performances."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:100
|
||
msgid "For example, let's look at the Sale Order report from the Sale module::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:130
|
||
msgid "The main template calls the translatable template with ``doc.partner_id.lang`` as a ``t-lang`` parameter, so it will be rendered in the language of the partner. This way, each Sale Order will be printed in the language of the corresponding customer. If you wish to translate only the body of the document, but keep the header and footer in a default language, you could call the report's external layout this way::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:140
|
||
msgid "Please take note that this works only when calling external templates, you will not be able to translate part of a document by setting a ``t-lang`` attribute on an xml node other than ``t-call``. If you wish to translate part of a template, you can create an external template with this partial template and call it from the main one with the ``t-lang`` attribute."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:148
|
||
msgid "Barcodes"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:150
|
||
msgid "Barcodes are images returned by a controller and can easily be embedded in reports thanks to the QWeb syntax (e.g. see :ref:`reference/qweb/attributes`):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:157
|
||
msgid "More parameters can be passed as a query string"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:166
|
||
msgid "Useful Remarks"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:167
|
||
msgid "Twitter Bootstrap and FontAwesome classes can be used in your report template"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:169
|
||
msgid "Local CSS can be put directly in the template"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:170
|
||
msgid "Global CSS can be inserted in the main report layout by inheriting its template and inserting your CSS::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:183
|
||
msgid "If it appears that your PDF report is missing the styles, please check :ref:`these instructions <reference/backend/reporting/printed-reports/pdf-without-styles>`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:189
|
||
msgid "Paper Format"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:191
|
||
msgid "Paper formats are records of ``report.paperformat`` and can contain the following attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:195
|
||
msgid "only useful as a mnemonic/description of the report when looking for one in a list of some sort"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:197
|
||
#: ../../content/developer/webservices/iap.rst:441
|
||
msgid "``description``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:198
|
||
msgid "a small description of your format"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:201
|
||
msgid "``format``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:200
|
||
msgid "either a predefined format (A0 to A9, B0 to B10, Legal, Letter, Tabloid,...) or ``custom``; A4 by default. You cannot use a non-custom format if you define the page dimensions."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:203
|
||
msgid "``dpi``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:204
|
||
msgid "output DPI; 90 by default"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:205
|
||
msgid "``margin_top``, ``margin_bottom``, ``margin_left``, ``margin_right``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:206
|
||
msgid "margin sizes in mm"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:207
|
||
msgid "``page_height``, ``page_width``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:208
|
||
msgid "page dimensions in mm"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:209
|
||
msgid "``orientation``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:210
|
||
msgid "Landscape or Portrait"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:211
|
||
msgid "``header_line``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:212
|
||
msgid "boolean to display a header line"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:214
|
||
msgid "``header_spacing``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:214
|
||
msgid "header spacing in mm"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:216
|
||
#: ../../content/developer/reference/reports.rst:283
|
||
#: ../../content/developer/reference/reports.rst:293
|
||
msgid "Example::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:237
|
||
msgid "Custom Reports"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:239
|
||
msgid "By default, the reporting system builds rendering values based on the target model specified through the ``model`` field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:242
|
||
msgid "However, it will first look for a model named :samp:`report.{module.report_name}` and call that model's ``_get_report_values(doc_ids, data)`` in order to prepare the rendering data for the template."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:247
|
||
msgid "This can be used to include arbitrary items to use or display while rendering the template, such as data from additional models:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:269
|
||
msgid "When using a custom report, the \"default\" document-related items (``doc_ids``, ``doc_model`` and ``docs``) will *not* be included. If you want them, you will need to include them yourself."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:273
|
||
msgid "In the example above, the rendering context will contain the \"global\" values as well as the ``lines`` we put in there but nothing else."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:279
|
||
msgid "Custom fonts"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:280
|
||
msgid "If you want to use custom fonts you will need to add your custom font and the related less/CSS to the ``web.reports_assets_common`` assets bundle. Adding your custom font(s) to ``web.assets_common`` or ``web.assets_backend`` will not make your font available in QWeb reports."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:291
|
||
msgid "You will need to define your ``@font-face`` within this less file, even if you've used in another assets bundle (other than ``web.reports_assets_common``)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:306
|
||
msgid "After you've added the less into your assets bundle you can use the classes - in this example ``h1-title-big`` - in your custom QWeb report."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:309
|
||
msgid "Reports are web pages"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:311
|
||
msgid "Reports are dynamically generated by the report module and can be accessed directly via URL:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:314
|
||
msgid "For example, you can access a Sale Order report in html mode by going to \\http://<server-address>/report/html/sale.report_saleorder/38"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:317
|
||
msgid "Or you can access the pdf version at \\http://<server-address>/report/pdf/sale.report_saleorder/38"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/reports.rst:320
|
||
msgid "it does not matter what timezone the :class:`python:datetime` object is actually in (including no timezone), its timezone will unconditionally be *set* to UTC before being adjusted to the user's"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:6
|
||
msgid "Security in Odoo"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:8
|
||
msgid "Aside from manually managing access using custom code, Odoo provides two main data-driven mechanisms to manage or restrict access to data."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:11
|
||
msgid "Both mechanisms are linked to specific users through *groups*: a user belongs to any number of groups, and security mechanisms are associated to groups, thus applying security mechamisms to users."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:18
|
||
msgid "Access Control"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:20
|
||
msgid "Managed by the ``ir.model.access`` records, defines access to a whole model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:22
|
||
msgid "Each access control has a model to which it grants permissions, the permissions it grants and optionally a group."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:25
|
||
msgid "Access controls are additive, for a given model a user has access all permissions granted to any of its groups: if the user belongs to one group which allows writing and another which allows deleting, they can both write and delete."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:30
|
||
msgid "If no group is specified, the access control applies to all users, otherwise it only applies to the members of the given group."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:33
|
||
msgid "Available permissions are creation (``perm_create``), searching and reading (``perm_read``), updating existing records (``perm_write``) and deleting existing records (``perm_unlink``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:40
|
||
msgid "Record Rules"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:42
|
||
msgid "Record rules are conditions that records must satisfy for an operation (create, read, update or delete) to be allowed. It is applied record-by-record after access control has been applied."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:46
|
||
msgid "A record rule has:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:48
|
||
msgid "a model on which it applies"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:49
|
||
msgid "a set of permissions to which it applies (e.g. if ``perm_read`` is set, the rule will only be checked when reading a record)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:51
|
||
msgid "a set of user groups to which the rule applies, if no group is specified the rule is *global*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:53
|
||
msgid "a :ref:`domain <reference/orm/domains>` used to check whether a given record matches the rule (and is accessible) or does not (and is not accessible). The domain is evaluated with two variables in context: ``user`` is the current user's record and ``time`` is the `time module`_"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:58
|
||
msgid "Global rules and group rules (rules restricted to specific groups versus groups applying to all users) are used quite differently:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:61
|
||
msgid "Global rules are subtractive, they *must all* be matched for a record to be accessible"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:63
|
||
msgid "Group rules are additive, if *any* of them matches (and all global rules match) then the record is accessible"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:66
|
||
msgid "This means the first *group rule* restricts access, but any further *group rule* expands it, while *global rules* can only ever restrict access (or have no effect)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:70
|
||
msgid "record rules do not apply to the Superuser account"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:76
|
||
msgid "Field Access"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:78
|
||
msgid "An ORM :class:`~odoo.fields.Field` can have a ``groups`` attribute providing a list of groups (as a comma-separated string of :term:`external identifiers`)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:82
|
||
msgid "If the current user is not in one of the listed groups, he will not have access to the field:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:85
|
||
msgid "restricted fields are automatically removed from requested views"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:86
|
||
msgid "restricted fields are removed from :meth:`~odoo.models.Model.fields_get` responses"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:88
|
||
msgid "attempts to (explicitly) read from or write to restricted fields results in an access error"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:93
|
||
msgid "field access groups apply to the Superuser in fields_get but not in read/write..."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:102
|
||
msgid "Security Pitfalls"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:104
|
||
msgid "As a developer, it is important to understand the security mechanisms and avoid common mistakes leading to insecure code."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:108
|
||
msgid "Unsafe Public Methods"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:110
|
||
msgid "Any public method can be executed via a :ref:`RPC call <webservices/odoo/calling_methods>` with the chosen parameters. The methods starting with a ``_`` are not callable from an action button or external API."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:114
|
||
msgid "On public methods, the record on which a method is executed and the parameters can not be trusted, ACL being only verified during CRUD operations."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:128
|
||
msgid "Making a method private is obviously not enough and care must be taken to use it properly."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:132
|
||
msgid "Bypassing the ORM"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:133
|
||
msgid "You should never use the database cursor directly when the ORM can do the same thing! By doing so you are bypassing all the ORM features, possibly the automated behaviours like translations, invalidation of fields, ``active``, access rights and so on."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:138
|
||
msgid "And chances are that you are also making the code harder to read and probably less secure."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:157
|
||
msgid "SQL injections"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:158
|
||
msgid "Care must be taken not to introduce SQL injections vulnerabilities when using manual SQL queries. The vulnerability is present when user input is either incorrectly filtered or badly quoted, allowing an attacker to introduce undesirable clauses to a SQL query (such as circumventing filters or executing ``UPDATE`` or ``DELETE`` commands)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:164
|
||
msgid "The best way to be safe is to never, NEVER use Python string concatenation (+) or string parameters interpolation (%) to pass variables to a SQL query string."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:167
|
||
msgid "The second reason, which is almost as important, is that it is the job of the database abstraction layer (psycopg2) to decide how to format query parameters, not your job! For example psycopg2 knows that when you pass a list of values it needs to format them as a comma-separated list, enclosed in parentheses !"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:187
|
||
msgid "This is very important, so please be careful also when refactoring, and most importantly do not copy these patterns!"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:190
|
||
msgid "Here is a memorable example to help you remember what the issue is about (but do not copy the code there). Before continuing, please be sure to read the online documentation of pyscopg2 to learn of to use it properly:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:194
|
||
msgid "`The problem with query parameters <http://initd.org/psycopg/docs/usage.html#the-problem-with-the-query-parameters>`_"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:195
|
||
msgid "`How to pass parameters with psycopg2 <http://initd.org/psycopg/docs/usage.html#passing-parameters-to-sql-queries>`_"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:196
|
||
msgid "`Advanced parameter types <http://initd.org/psycopg/docs/usage.html#adaptation-of-python-values-to-sql-types>`_"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:197
|
||
msgid "`Psycopg documentation <https://www.psycopg.org/docs/sql.html>`_"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:200
|
||
msgid "Unescaped field content"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:202
|
||
msgid "When rendering content using JavaScript and XML, one may be tempted to use a ``t-raw`` to display rich-text content. This should be avoided as a frequent `XSS <https://en.wikipedia.org/wiki/Cross-site_scripting>`_ vector."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:206
|
||
msgid "It is very hard to control the integrity of the data from the computation until the final integration in the browser DOM. A ``t-raw`` that is correctly escaped at the time of introduction may no longer be safe at the next bugfix or refactoring."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:223
|
||
msgid "The above code may feel safe as the message content is controlled but is a bad practice that may lead to unexpected security vulnerabilities once this code evolves in the future."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:235
|
||
msgid "While formatting the template differently would prevent such vulnerabilities."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:260
|
||
msgid "Escaping vs Sanitizing"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:264
|
||
msgid "Escaping is always 100% mandatory when you mix data and code, no matter how safe the data"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:267
|
||
msgid "**Escaping** converts *TEXT* to *CODE*. It is absolutely mandatory to do it every time you mix *DATA/TEXT* with *CODE* (e.g. generating HTML or python code to be evaluated inside a `safe_eval`), because *CODE* always requires *TEXT* to be encoded. It is critical for security, but it's also a question of correctness. Even when there is no security risk (because the text is 100% guarantee to be safe or trusted), it is still required (e.g. to avoid breaking the layout in generated HTML)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:275
|
||
msgid "Escaping will never break any feature, as long as the developer identifies which variable contains *TEXT* and which contains *CODE*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:291
|
||
msgid "**Sanitizing** converts *CODE* to *SAFER CODE* (but not necessary *safe* code). It does not work on *TEXT*. Sanitizing is only necessary when *CODE* is untrusted, because it comes in full or in part from some user-provided data. If the user-provided data is in the form of *TEXT* (e.g. the content from a form filled by a user), and if that data was correctly escaped before putting it in *CODE*, then sanitizing is useless (but can still be done). If however, the user-provided data was **not escaped**, then sanitizing will **not** work as expected."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:310
|
||
msgid "Sanitizing can break features, depending on whether the *CODE* is expected to contain patterns that are not safe. That's why `fields.Html` and `tools.html_sanitize()` have options to fine-tune the level of sanitization for styles, etc. Those options have to be carefully considered depending on where the data comes from, and the desired features. The sanitization safety is balanced against sanitization breakages: the safer the sanitisation the more likely it is to break things."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:327
|
||
msgid "Evaluating content"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:328
|
||
msgid "Some may want to ``eval`` to parse user provided content. Using ``eval`` should be avoided at all cost. A safer, sandboxed, method :class:`~odoo.tools.safe_eval` can be used instead but still gives tremendous capabilities to the user running it and must be reserved for trusted privileged users only as it breaks the barrier between code and data."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:350
|
||
msgid "Parsing content does not need ``eval``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:353
|
||
msgid "Language"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:353
|
||
msgid "Data type"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:353
|
||
msgid "Suitable parser"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:355
|
||
#: ../../content/developer/reference/security.rst:356
|
||
msgid "int, float, etc."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:355
|
||
msgid "int(), float()"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:356
|
||
msgid "parseInt(), parseFloat()"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:357
|
||
msgid "dict"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:357
|
||
msgid "json.loads(), ast.literal_eval()"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:358
|
||
msgid "object, list, etc."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:358
|
||
msgid "JSON.parse()"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:362
|
||
msgid "Accessing object attributes"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:364
|
||
msgid "If the values of a record needs to be retrieved or modified dynamically, one may want to use the ``getattr`` and ``setattr`` methods."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:374
|
||
msgid "This code is however not safe as it allows to access any property of the record, including private attributes or methods."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:377
|
||
msgid "The ``__getitem__`` of a recordset has been defined and accessing a dynamic field value can be easily achieved safely:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/security.rst:387
|
||
msgid "The above method is obviously still too optimistic and additional verifications on the record id and field value must be done."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:7
|
||
msgid "Testing Odoo"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:9
|
||
msgid "There are many ways to test an application. In Odoo, we have three kinds of tests"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:12
|
||
msgid "Python unit tests (see `Testing Python code`_): useful for testing model business logic"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:13
|
||
msgid "JS unit tests (see `Testing JS code`_): useful to test the javascript code in isolation"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:14
|
||
msgid "Tours (see `Integration Testing`_): tours simulate a real situation. They ensures that the python and the javascript parts properly talk to each other."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:18
|
||
msgid "Testing Python code"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:20
|
||
msgid "Odoo provides support for testing modules using unittest."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:22
|
||
msgid "To write tests, simply define a ``tests`` sub-package in your module, it will be automatically inspected for test modules. Test modules should have a name starting with ``test_`` and should be imported from ``tests/__init__.py``, e.g."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:36
|
||
msgid "and ``__init__.py`` contains::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:42
|
||
msgid "test modules which are not imported from ``tests/__init__.py`` will not be run"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:45
|
||
msgid "The test runner will simply run any test case, as described in the official `unittest documentation`_, but Odoo provides a number of utilities and helpers related to testing Odoo content (modules, mainly):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:62
|
||
msgid "By default, tests are run once right after the corresponding module has been installed. Test cases can also be configured to run after all modules have been installed, and not run right after the module installation::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:75
|
||
msgid "The most common situation is to use :class:`~odoo.tests.common.TransactionCase` and test a property of a model in each method::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:91
|
||
msgid "Test methods must start with ``test_``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:103
|
||
msgid "Running tests"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:105
|
||
msgid "Tests are automatically run when installing or updating modules if :option:`--test-enable <odoo-bin --test-enable>` was enabled when starting the Odoo server."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:114
|
||
msgid "Test selection"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:116
|
||
msgid "In Odoo, Python tests can be tagged to facilitate the test selection when running tests."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:119
|
||
msgid "Subclasses of :class:`odoo.tests.common.BaseCase` (usually through :class:`~odoo.tests.common.TransactionCase`, :class:`~odoo.tests.common.SavepointCase` or :class:`~odoo.tests.common.HttpCase`) are automatically tagged with ``standard``, ``at_install`` and their source module's name by default."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:126
|
||
msgid "Invocation"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:128
|
||
msgid ":option:`--test-tags <odoo-bin --test-tags>` can be used to select/filter tests to run on the command-line."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:131
|
||
msgid "This option defaults to ``+standard`` meaning tests tagged ``standard`` (explicitly or implicitly) will be run by default when starting Odoo with :option:`--test-enable <odoo-bin --test-enable>`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:135
|
||
msgid "When writing tests, the :func:`~odoo.tests.common.tagged` decorator can be used on **test classes** to add or remove tags."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:138
|
||
msgid "The decorator's arguments are tag names, as strings."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:140
|
||
msgid ":func:`~odoo.tests.common.tagged` is a class decorator, it has no effect on functions or methods"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:143
|
||
msgid "Tags can be prefixed with the minus (``-``) sign, to *remove* them instead of add or select them e.g. if you don't want your test to be executed by default you can remove the ``standard`` tag:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:155
|
||
msgid "This test will not be selected by default, to run it the relevant tag will have to be selected explicitely:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:162
|
||
msgid "Note that only the tests tagged ``nice`` are going to be executed. To run *both* ``nice`` and ``standard`` tests, provide multiple values to :option:`--test-tags <odoo-bin --test-tags>`: on the command-line, values are *additive* (you're selecting all tests with *any* of the specified tags)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:171
|
||
msgid "The config switch parameter also accepts the ``+`` and ``-`` prefixes. The ``+`` prefix is implied and therefore, totaly optional. The ``-`` (minus) prefix is made to deselect tests tagged with the prefixed tags, even if they are selected by other specified tags e.g. if there are ``standard`` tests which are also tagged as ``slow`` you can run all standard tests *except* the slow ones:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:182
|
||
msgid "When you write a test that does not inherit from the :class:`~odoo.tests.common.BaseCase`, this test will not have the default tags, you have to add them explicitely to have the test included in the default test suite. This is a common issue when using a simple ``unittest.TestCase`` as they're not going to get run:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:198
|
||
msgid "Special tags"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:200
|
||
msgid "``standard``: All Odoo tests that inherit from :class:`~odoo.tests.common.BaseCase` are implicitely tagged standard. :option:`--test-tags <odoo-bin --test-tags>` also defaults to ``standard``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:204
|
||
msgid "That means untagged test will be executed by default when tests are enabled."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:205
|
||
msgid "``at_install``: Means that the test will be executed right after the module installation and before other modules are installed. This is a default implicit tag."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:208
|
||
msgid "``post_install``: Means that the test will be executed after all the modules are installed. This is what you want for HttpCase tests most of the time."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:211
|
||
msgid "Note that this is *not exclusive* with ``at_install``, however since you will generally not want both ``post_install`` is usually paired with ``-at_install`` when tagging a test class."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:214
|
||
msgid "*module_name*: Odoo tests classes extending :class:`~odoo.tests.common.BaseCase` are implicitely tagged with the technical name of their module. This allows easily selecting or excluding specific modules when testing e.g. if you want to only run tests from ``stock_account``:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:225
|
||
msgid "Examples"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:229
|
||
msgid "Tests will be executed only in the installed or updated modules. So modules have to be selected with the :option:`-u <odoo-bin -u>` or :option:`-i <odoo-bin -i>` switches. For simplicity, those switches are not specified in the examples below."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:234
|
||
msgid "Run only the tests from the sale module:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:240
|
||
msgid "Run the tests from the sale module but not the ones tagged as slow:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:246
|
||
msgid "Run only the tests from stock or tagged as slow:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:252
|
||
msgid "``-standard`` is implicit (not required), and present for clarity"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:255
|
||
msgid "Testing JS code"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:257
|
||
msgid "Testing a complex system is an important safeguard to prevent regressions and to guarantee that some basic functionality still works. Since Odoo has a non trivial codebase in Javascript, it is necessary to test it. In this section, we will discuss the practice of testing JS code in isolation: these tests stay in the browser, and are not supposed to reach the server."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:264
|
||
msgid "Qunit test suite"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:266
|
||
msgid "The Odoo framework uses the QUnit_ library testing framework as a test runner. QUnit defines the concepts of *tests* and *modules* (a set of related tests), and gives us a web based interface to execute the tests."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:270
|
||
msgid "For example, here is what a pyUtils test could look like:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:285
|
||
msgid "The main way to run the test suite is to have a running Odoo server, then navigate a web browser to ``/web/tests``. The test suite will then be executed by the web browser Javascript engine."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:292
|
||
msgid "The web UI has many useful features: it can run only some submodules, or filter tests that match a string. It can show every assertions, failed or passed, rerun specific tests, ..."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:298
|
||
msgid "While the test suite is running, make sure that:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:300
|
||
msgid "your browser window is focused,"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:301
|
||
msgid "it is not zoomed in/out. It needs to have exactly 100% zoom level."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:303
|
||
msgid "If this is not the case, some tests will fail, without a proper explanation."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:306
|
||
msgid "Testing Infrastructure"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:308
|
||
msgid "Here is a high level overview of the most important parts of the testing infrastructure:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:311
|
||
msgid "there is an asset bundle named `web.qunit_suite`_. This bundle contains the main code (assets common + assets backend), some libraries, the QUnit test runner and the test bundles listed below."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:315
|
||
msgid "a bundle named `web.tests_assets`_ includes most of the assets and utils required by the test suite: custom QUnit asserts, test helpers, lazy loaded assets, etc."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:318
|
||
msgid "another asset bundle, `web.qunit_suite_tests`_, contains all the test scripts. This is typically where the test files are added to the suite."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:321
|
||
msgid "there is a `controller`_ in web, mapped to the route */web/tests*. This controller simply renders the *web.qunit_suite* template."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:324
|
||
msgid "to execute the tests, one can simply point its browser to the route */web/tests*. In that case, the browser will download all assets, and QUnit will take over."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:327
|
||
msgid "there is some code in `qunit_config.js`_ which logs in the console some information when a test passes or fails."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:330
|
||
msgid "we want the runbot to also run these tests, so there is a test (in `test_js.py`_) which simply spawns a browser and points it to the *web/tests* url. Note that the browser_js method spawns a Chrome headless instance."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:336
|
||
msgid "Modularity and testing"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:338
|
||
msgid "With the way Odoo is designed, any addon can modify the behaviour of other parts of the system. For example, the *voip* addon can modify the *FieldPhone* widget to use extra features. This is not really good from the perspective of the testing system, since this means that a test in the addon web will fail whenever the voip addon is installed (note that the runbot runs the tests with all addons installed)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:345
|
||
msgid "At the same time, our testing sytem is good, because it can detect whenever another module breaks some core functionality. There is no complete solution to this issue. For now, we solve this on a case by case basis."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:349
|
||
msgid "Usually, it is not a good idea to modify some other behaviour. For our voip example, it is certainly cleaner to add a new *FieldVOIPPhone* widget and modify the few views that needs it. This way, the *FieldPhone* widget is not impacted, and both can be tested."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:355
|
||
msgid "Adding a new test case"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:357
|
||
msgid "Let us assume that we are maintaining an addon *my_addon*, and that we want to add a test for some javascript code (for example, some utility function myFunction, located in *my_addon.utils*). The process to add a new test case is the following:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:362
|
||
msgid "create a new file *my_addon/static/tests/utils_tests.js*. This file contains the basic code to add a QUnit module *my_addon > utils*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:380
|
||
msgid "In *my_addon/assets.xml*, add the file to the main test assets:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:393
|
||
msgid "Restart the server and update *my_addon*, or do it from the interface (to make sure the new test file is loaded)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:396
|
||
msgid "Add a test case after the definition of the *utils* sub test suite:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:407
|
||
msgid "Visit */web/tests/* to make sure the test is executed"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:410
|
||
msgid "Helper functions and specialized assertions"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:412
|
||
msgid "Without help, it is quite difficult to test some parts of Odoo. In particular, views are tricky, because they communicate with the server and may perform many rpcs, which needs to be mocked. This is why we developed some specialized helper functions, located in `test_utils.js`_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:417
|
||
msgid "Mock test functions: these functions help setting up a test environment. The most important use case is mocking the answers given by the Odoo server. These functions use a `mock server`_. This is a javascript class that simulates answers to the most common model methods: read, search_read, nameget, ..."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:422
|
||
msgid "DOM helpers: useful to simulate events/actions on some specific target. For example, testUtils.dom.click performs a click on a target. Note that it is safer than doing it manually, because it also checks that the target exists, and is visible."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:427
|
||
msgid "create helpers: they are probably the most important functions exported by `test_utils.js`_. These helpers are useful to create a widget, with a mock environment, and a lot of small detail to simulate as much as possible the real conditions. The most important is certainly `createView`_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:432
|
||
msgid "`qunit assertions`_: QUnit can be extended with specialized assertions. For Odoo, we frequently test some DOM properties. This is why we made some assertions to help with that. For example, the *containsOnce* assertion takes a widget/jQuery/HtmlElement and a selector, then checks if the target contains exactly one match for the css selector."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:438
|
||
msgid "For example, with these helpers, here is what a simple form test could look like:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:462
|
||
msgid "Notice the use of the testUtils.createView helper and of the containsOnce assertion. Also, the form controller was properly destroyed at the end of the test."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:467
|
||
msgid "Best Practices"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:469
|
||
msgid "In no particular order:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:471
|
||
msgid "all test files should be added in *some_addon/static/tests/*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:472
|
||
msgid "for bug fixes, make sure that the test fails without the bug fix, and passes with it. This ensures that it actually works."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:474
|
||
msgid "try to have the minimal amount of code necessary for the test to work."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:475
|
||
msgid "usually, two small tests are better than one large test. A smaller test is easier to understand and to fix."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:477
|
||
msgid "always cleanup after a test. For example, if your test instantiates a widget, it should destroy it at the end."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:479
|
||
msgid "no need to have full and complete code coverage. But adding a few tests helps a lot: it makes sure that your code is not completely broken, and whenever a bug is fixed, it is really much easier to add a test to an existing test suite."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:482
|
||
msgid "if you want to check some negative assertion (for example, that a HtmlElement does not have a specific css class), then try to add the positive assertion in the same test (for example, by doing an action that changes the state). This will help avoid the test to become dead in the future (for example, if the css class is changed)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:489
|
||
msgid "Tips"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:491
|
||
msgid "running only one test: you can (temporarily!) change the *QUnit.test(...)* definition into *QUnit.only(...)*. This is useful to make sure that QUnit only runs this specific test."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:494
|
||
msgid "debug flag: most create utility functions have a debug mode (activated by the debug: true parameter). In that case, the target widget will be put in the DOM instead of the hidden qunit specific fixture, and more information will be logged. For example, all mocked network communications will be available in the console."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:499
|
||
msgid "when working on a failing test, it is common to add the debug flag, then comment the end of the test (in particular, the destroy call). With this, it is possible to see the state of the widget directly, and even better, to manipulate the widget by clicking/interacting with it."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:506
|
||
#: ../../content/developer/webservices/extract_api.rst:538
|
||
msgid "Integration Testing"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:508
|
||
msgid "Testing Python code and JS code separately is very useful, but it does not prove that the web client and the server work together. In order to do that, we can write another kind of test: tours. A tour is a mini scenario of some interesting business flow. It explains a sequence of steps that should be followed. The test runner will then create a Chrome headless browser, point it to the proper url and simulate the click and inputs, according to the scenario."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:516
|
||
msgid "Screenshots and screencasts during browser_js tests"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:518
|
||
msgid "When running tests that use HttpCase.browser_js from the command line, the Chrome browser is used in headless mode. By default, if a test fails, a PNG screenshot is taken at the moment of the failure and written in"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:526
|
||
msgid "Two new command line arguments were added since Odoo 13.0 to control this behavior: :option:`--screenshots <odoo-bin --screenshots>` and :option:`--screencasts <odoo-bin --screencasts>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:531
|
||
msgid "Performance Testing"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:534
|
||
msgid "Query counts"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:536
|
||
msgid "One of the ways to test performance is to measure database queries. Manually, this can be tested with the `--log-sql` CLI parameter. If you want to establish the maximum number of queries for an operation, you can use the :meth:`~odoo.tests.common.BaseCase.assertQueryCount` method, integrated in Odoo test classes."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:548
|
||
msgid "Database population"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:550
|
||
msgid "Odoo CLI offers a :ref:`database population<reference/cmdline/populate>` feature."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:556
|
||
msgid "Instead of the tedious manual, or programmatic, specification of test data, one can use this feature to fill a database on demand with the desired number of test data. This can be used to detect diverse bugs or performance issues in tested flows."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:562
|
||
msgid "To specify this feature for a given model, the following methods and attributes can be defined."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:573
|
||
msgid "You have to define at least :meth:`~odoo.models.Model._populate` or :meth:`~odoo.models.Model._populate_factories` on the model to enable database population."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:577
|
||
msgid "Example model"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:621
|
||
msgid "Population tools"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/testing.rst:623
|
||
msgid "Multiple population tools are available to easily create the needed data generators."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:7
|
||
msgid "Translating Modules"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:9
|
||
msgid "This section explains how to provide translation abilities to your module."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:11
|
||
msgid "If you want to contribute to the translation of Odoo itself, please refer to the `Odoo Wiki page <https://github.com/odoo/odoo/wiki/Translations>`_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:15
|
||
msgid "Exporting translatable term"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:17
|
||
msgid "A number of terms in your modules are \"implicitly translatable\" as a result, even if you haven't done any specific work towards translation you can export your module's translatable terms and may find content to work with."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:21
|
||
msgid "needs technical features"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:23
|
||
msgid "Translations export is performed via the administration interface by logging into the backend interface and opening :menuselection:`Settings --> Translations --> Import / Export --> Export Translations`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:27
|
||
msgid "leave the language to the default (new language/empty template)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:28
|
||
msgid "select the `PO File`_ format"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:29
|
||
msgid "select your module"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:30
|
||
msgid "click :guilabel:`Export` and download the file"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:36
|
||
msgid "This gives you a file called :file:`{yourmodule}.pot` which should be moved to the :file:`{yourmodule}/i18n/` directory. The file is a *PO Template* which simply lists translatable strings and from which actual translations (PO files) can be created. PO files can be created using msginit_, with a dedicated translation tool like POEdit_ or by simply copying the template to a new file called :file:`{language}.po`. Translation files should be put in :file:`{yourmodule}/i18n/`, next to :file:`{yourmodule}.pot`, and will be automatically loaded by Odoo when the corresponding language is installed (via :menuselection:`Settings --> Translations --> Languages`)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:46
|
||
msgid "translations for all loaded languages are also installed or updated when installing or updating a module"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:50
|
||
msgid "Implicit exports"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:52
|
||
msgid "Odoo automatically exports translatable strings from \"data\"-type content:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:54
|
||
msgid "in non-QWeb views, all text nodes are exported as well as the content of the ``string``, ``help``, ``sum``, ``confirm`` and ``placeholder`` attributes"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:57
|
||
msgid "QWeb templates (both server-side and client-side), all text nodes are exported except inside ``t-translation=\"off\"`` blocks, the content of the ``title``, ``alt``, ``label`` and ``placeholder`` attributes are also exported"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:61
|
||
msgid "for :class:`~odoo.fields.Field`, unless their model is marked with ``_translate = False``:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:64
|
||
msgid "their ``string`` and ``help`` attributes are exported"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:65
|
||
msgid "if ``selection`` is present and a list (or tuple), it's exported"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:66
|
||
msgid "if their ``translate`` attribute is set to ``True``, all of their existing values (across all records) are exported"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:68
|
||
msgid "help/error messages of :attr:`~odoo.models.Model._constraints` and :attr:`~odoo.models.Model._sql_constraints` are exported"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:72
|
||
msgid "Explicit exports"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:74
|
||
msgid "When it comes to more \"imperative\" situations in Python code or Javascript code, Odoo cannot automatically export translatable terms so they must be marked explicitly for export. This is done by wrapping a literal string in a function call."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:79
|
||
msgid "In Python, the wrapping function is :func:`odoo._`::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:83
|
||
msgid "In JavaScript, the wrapping function is generally :js:func:`odoo.web._t`:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:91
|
||
msgid "Only literal strings can be marked for exports, not expressions or variables. For situations where strings are formatted, this means the format string must be marked, not the formatted string"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:95
|
||
msgid "The lazy version of `_` and `_t` is :func:`odoo._lt` in python and :js:func:`odoo.web._lt` in javascript. The translation lookup is executed only at rendering and can be used to declare translatable properties in class methods of global variables."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:101
|
||
msgid "Variables"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:102
|
||
msgid "**Don't** the extract may work but it will not translate the text correctly::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:106
|
||
msgid "**Do** set the dynamic variables as a parameter of the translation lookup (this will fallback on source in case of missing placeholder in the translation)::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:113
|
||
msgid "Blocks"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:114
|
||
msgid "**Don't** split your translation in several blocks or multiples lines::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:124
|
||
msgid "**Do** keep in one block, giving the full context to translators::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:135
|
||
msgid "Plural"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:136
|
||
msgid "**Don't** pluralize terms the English-way::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:142
|
||
msgid "**Do** keep in mind every language has different plural forms::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:150
|
||
msgid "Read vs Run Time"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:152
|
||
msgid "**Don't** invoke translation lookup at server launch::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:165
|
||
msgid "**Don't** invoke translation lookup when the javascript file is read::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:176
|
||
msgid "**Do** use lazy translation lookup method::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:190
|
||
msgid "or **do** evaluate dynamically the translatable content::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/translations.rst:199
|
||
msgid "**Do** in the case where the translation lookup is done when the JS file is *read*, use `_lt` instead of `_t` to translate the term when it is *used*::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:8
|
||
msgid "Views are what define how records should be displayed to end-users. They are specified in XML which means that they can be edited independently from the models that they represent. They are flexible and allow a high level of customization of the screens that they control. There exist various types of views. Each of them represents a mode of visualization: *form*, *list*, *kanban*, etc."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:13
|
||
msgid "Build doc of ir_ui_view.py ?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:18
|
||
#: ../../content/developer/reference/views.rst:906
|
||
msgid "Generic structure"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:20
|
||
msgid "Basic views generally share the common structure defined below. Placeholders are denoted in all caps."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:38
|
||
msgid "View objects expose a number of fields. They are optional unless specified otherwise."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:40
|
||
msgid "``name`` (mandatory) :class:`~odoo.fields.Char`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:42
|
||
msgid "Only useful as a mnemonic/description of the view when looking for one in a list of some sort."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:44
|
||
msgid "``model`` :class:`~odoo.fields.Char`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:46
|
||
msgid "The model linked to the view, if applicable."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:48
|
||
msgid "``priority`` :class:`~odoo.fields.Integer`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:50
|
||
msgid "When a view is requested by ``(model, type)``, the view matching the model and the type, with the lowest priority will be returned (it is the default view)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:53
|
||
msgid "It also defines the order of views application during :ref:`view inheritance <reference/views/inheritance>`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:56
|
||
msgid "``groups_id`` :class:`~odoo.fields.Many2many` -> :class:`odoo.addons.base.models.res_users.Groups`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:58
|
||
msgid "The groups allowed to use/access the current view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:60
|
||
msgid "If the view extends an existing view, the extension will only be applied for a given user if the user has access to the provided ``groups_id``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:63
|
||
msgid "``arch`` :class:`~odoo.fields.Text`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:65
|
||
msgid "The description of the view layout."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:68
|
||
msgid "Attributes"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:72
|
||
msgid "view attributes & view element attributes attrs & states attributes are missing generic information"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:75
|
||
msgid "The different view types have a wide variety of attributes allowing customizations of the generic behaviors. Some main attributes will be explained here. They do not all have an impact on all view types."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:79
|
||
msgid "The current context and user access rights may also impact the view abilities."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:81
|
||
msgid "info on create/... in the context ?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:83
|
||
#: ../../content/developer/reference/views.rst:1606
|
||
msgid "``create``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:85
|
||
msgid "Disable/enable record creation on the view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:87
|
||
msgid "``edit`` (``form`` & ``list`` & ``gantt``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:89
|
||
msgid "Disable/enable record editing on the view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:91
|
||
msgid "``delete`` (``form`` & ``list``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:93
|
||
msgid "Disable/enable record deletion on the view through the **Action** dropdown."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:95
|
||
msgid "``duplicate`` (``form`` & ``list``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:97
|
||
msgid "Disable/enable record duplication on the view through the **Action** dropdown."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:99
|
||
msgid "``decoration-{$name}`` (``list`` & ``gantt``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:101
|
||
msgid "Define a conditional display of a record in the style of a row's text based on the corresponding record's attributes."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:123
|
||
msgid "Supported values differ for the two view types. The Gantt view only supports ``success``, ``info``, ``warning``, ``danger`` and ``secondary`` displays. The list view supports ``bf``, ``it``, ``success``, ``info``, ``warning``, ``danger``, ``muted`` and ``primary`` displays."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:127
|
||
msgid "``sample`` (``kanban`` & ``list`` & ``gantt`` & ``graph`` & ``pivot`` & ``cohort`` & ``dashboard``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:129
|
||
msgid "Populate the view with a set of sample records if none are found for the current model. This attribute is false by default."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:132
|
||
msgid "These fake records will have heuristics for certain field names/models. For example, a field 'display_name' on the model 'res.users' will be populated with sample people names while an 'email' field will be in the form 'firstname.lastname@sample.demo'."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:136
|
||
msgid "The user will not be able to interact with these data and they will be discarded as soon as an action is performed (record created, column added, etc.)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:139
|
||
msgid "``banner_route`` a route address to be fetched and prepended to the view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:142
|
||
msgid "If this attribute is set, the :ref:`controller route url<reference/controllers>` will be fetched and displayed above the view. The json response from the controller should contain an \"html\" key."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:147
|
||
msgid "If the html contains a stylesheet <link> tag, it will be removed and appended to <head>."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:150
|
||
msgid "To interact with the backend you can use <a type=\"action\"> tags. Please take a look at the documentation of the _onActionClicked method of AbstractController (*addons/web/static/src/js/views/abstract_controller.js*) for more details."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:155
|
||
msgid "Only views extending AbstractView and AbstractController can use this attribute, like :ref:`reference/views/form`, :ref:`reference/views/kanban`, :ref:`reference/views/list`, ..."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:159
|
||
#: ../../content/developer/reference/views.rst:1901
|
||
#: ../../content/developer/reference/views.rst:1938
|
||
#: ../../content/developer/reference/views.rst:1964
|
||
msgid "Example:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:179
|
||
msgid "Views main content section, with field, group & separator ?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:187
|
||
msgid "Inheritance fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:189
|
||
msgid "The two following :class:`~odoo.addons.base.ir_ui_view.View` fields are used to specify inherited views."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:192
|
||
msgid "``inherit_id`` :class:`~odoo.fields.Many2one`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:194
|
||
msgid "the current view's parent view, unset by default. Specify the parent using the `ref` attribute:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:201
|
||
msgid "``mode`` :class:`~odoo.fields.Selection`: `extension / primary`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:203
|
||
msgid "inheritance mode, ``extension`` by default if ``inherit_id`` is set, ``primary`` otherwise."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:206
|
||
msgid "An example of where you would want to override ``mode`` while using ``inherit_id`` is delegation inheritance. In that case your derived model will be separate from its parent and views matching with one won't match with the other. Suppose you inherit from a view associated with the parent model and want to customize the derived view to show data from the derived model. The ``mode`` of the derived view needs to be set to ``primary``, because it's the base (and maybe only) view for that derived model. Otherwise the :ref:`view matching <reference/views/inheritance/view-matching>` rules won't apply."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:219
|
||
msgid "View matching"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:221
|
||
msgid "if a view is requested by ``(model, type)``, the view with the right model and type, ``mode=primary`` and the lowest priority is matched."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:223
|
||
msgid "when a view is requested by ``id``, if its mode is not ``primary`` its *closest* parent with mode ``primary`` is matched."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:227
|
||
msgid "View resolution"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:229
|
||
msgid "Resolution generates the final ``arch`` for a requested/matched ``primary`` view:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:232
|
||
msgid "if the view has a parent, the parent is fully resolved then the current view's inheritance specs are applied"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:234
|
||
msgid "if the view has no parent, its ``arch`` is used as-is"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:235
|
||
msgid "the current view's children with mode ``extension`` are looked up and their inheritance specs are applied depth-first (a child view is applied, then its children, then its siblings)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:239
|
||
msgid "The result of applying children views yields the final ``arch``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:241
|
||
msgid "NOTE on fields_view_get and link to ORM ?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:244
|
||
msgid "Inheritance specs"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:246
|
||
msgid "Inheritance specs are comprised of an element locator, to match the inherited element in the parent view, and children element that will be used to modify the inherited element."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:250
|
||
msgid "There are three types of element locators for matching a target element:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:252
|
||
msgid "An ``xpath`` element with an ``expr`` attribute. ``expr`` is an XPath_ expression\\ [#hasclass]_ applied to the current ``arch``, the first node it finds is the match"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:255
|
||
msgid "a ``field`` element with a ``name`` attribute, matches the first ``field`` with the same ``name``. All other attributes are ignored during matching"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:257
|
||
msgid "any other element: the first element with the same name and identical attributes (ignoring ``position`` and ``version`` attributes) is matched"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:274
|
||
msgid "The inheritance spec may have an optional ``position`` attribute specifying how the matched node should be altered:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:277
|
||
msgid "``inside`` (default)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:278
|
||
msgid "the content of the inheritance spec is appended to the matched node"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:280
|
||
msgid "the content of the inheritance spec replaces the matched node. Any text node containing only ``$0`` within the contents of the spec will be replaced by a complete copy of the matched node, effectively wrapping the matched node."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:285
|
||
msgid "the content of the inheritance spec is added to the matched node's parent, after the matched node"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:288
|
||
msgid "the content of the inheritance spec is added to the matched node's parent, before the matched node"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:291
|
||
msgid "the content of the inheritance spec should be ``attribute`` elements with a ``name`` attribute and an optional body:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:294
|
||
msgid "if the ``attribute`` element has a body, a new attributed named after its ``name`` is created on the matched node with the ``attribute`` element's text as value"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:297
|
||
msgid "if the ``attribute`` element has no body, the attribute named after its ``name`` is removed from the matched node. If no such attribute exists, an error is raised"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:324
|
||
msgid "``move``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:311
|
||
msgid "can be used as a direct child of a inheritance spec with a ``inside``, ``replace``, ``after`` or ``before`` ``position`` attribute to move a node."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:326
|
||
msgid "A view's specs are applied sequentially."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:328
|
||
msgid "an extension function is added for simpler matching in QWeb views: ``hasclass(*classes)`` matches if the context node has all the specified classes"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:335
|
||
msgid "View types"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:340
|
||
msgid "Activity"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:342
|
||
msgid "The Activity view is used to display the activities linked to the records. The data are displayed in a chart with the records forming the rows and the activity types the columns. The first cell of each row displays a (customizable, see ``templates``, quite similarly to :ref:`reference/views/kanban`) card representing the corresponding record. When clicking on others cells, a detailed description of all activities of the same type for the record is displayed."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:351
|
||
msgid "The Activity view is only available when the ``mail`` module is installed, and for the models that inherit from the ``mail.activity.mixin``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:354
|
||
msgid "The root element of the Activity view is ``<activity>``, it accepts the following attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:358
|
||
#: ../../content/developer/reference/views.rst:487
|
||
msgid "``string`` (mandatory)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:358
|
||
#: ../../content/developer/reference/views.rst:487
|
||
msgid "A title, which should describe the view"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:360
|
||
#: ../../content/developer/reference/views.rst:1223
|
||
msgid "Possible children of the view element are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:363
|
||
msgid "declares fields to use in activity *logic*. If the field is simply displayed in the activity view, it does not need to be pre-declared."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:366
|
||
#: ../../content/developer/reference/views.rst:1229
|
||
#: ../../content/developer/reference/views.rst:1237
|
||
msgid "Possible attributes are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:369
|
||
#: ../../content/developer/reference/views.rst:520
|
||
#: ../../content/developer/reference/views.rst:1137
|
||
#: ../../content/developer/reference/views.rst:1232
|
||
#: ../../content/developer/reference/views.rst:1723
|
||
msgid "``name`` (required)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:369
|
||
#: ../../content/developer/reference/views.rst:1232
|
||
msgid "the name of the field to fetch"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:387
|
||
#: ../../content/developer/reference/views.rst:1081
|
||
#: ../../content/developer/reference/views.rst:1319
|
||
msgid "``templates``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:372
|
||
msgid "defines the :ref:`reference/qweb` templates. Cards definition may be split into multiple templates for clarity, but activity views *must* define at least one root template ``activity-box``, which will be rendered once for each record."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:377
|
||
msgid "The activity view uses mostly-standard :ref:`javascript qweb <reference/qweb/javascript>` and provides the following context variables (see :ref:`reference/views/kanban` for more details):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:383
|
||
#: ../../content/developer/reference/views.rst:723
|
||
#: ../../content/developer/reference/views.rst:820
|
||
#: ../../content/developer/reference/views.rst:1077
|
||
#: ../../content/developer/reference/views.rst:1263
|
||
#: ../../content/developer/reference/views.rst:1509
|
||
msgid "``widget``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:382
|
||
msgid "the current :js:class:`ActivityRecord`, can be used to fetch some meta-information. These methods are also available directly in the template context and don't need to be accessed via ``widget``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:386
|
||
msgid "an object with all the requested fields as its attributes. Each field has two attributes ``value`` and ``raw_value``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:392
|
||
#: ../../content/developer/reference/views.rst:1324
|
||
msgid "Calendar"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:394
|
||
msgid "Calendar views display records as events in a daily, weekly, monthly or yearly calendar. Their root element is ``<calendar>``. Available attributes on the calendar view are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:398
|
||
#: ../../content/developer/reference/views.rst:957
|
||
#: ../../content/developer/reference/views.rst:1330
|
||
msgid "``date_start`` (required)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:399
|
||
#: ../../content/developer/reference/views.rst:1331
|
||
msgid "name of the record's field holding the start date for the event"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:402
|
||
#: ../../content/developer/reference/views.rst:1334
|
||
msgid "``date_stop``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:401
|
||
#: ../../content/developer/reference/views.rst:1333
|
||
msgid "name of the record's field holding the end date for the event, if ``date_stop`` is provided records become movable (via drag and drop) directly in the calendar"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:405
|
||
#: ../../content/developer/reference/views.rst:1337
|
||
msgid "``date_delay``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:405
|
||
#: ../../content/developer/reference/views.rst:1337
|
||
msgid "alternative to ``date_stop``, provides the duration of the event instead of its end date (unit: day)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:408
|
||
#: ../../content/developer/reference/views.rst:1340
|
||
msgid "name of a record field to use for *color segmentation*. Records in the same color segment are allocated the same highlight color in the calendar, colors are allocated semi-randomly. Displayed the display_name/avatar of the visible record in the sidebar"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:414
|
||
#: ../../content/developer/reference/views.rst:1086
|
||
#: ../../content/developer/reference/views.rst:1346
|
||
msgid "``form_view_id``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:413
|
||
#: ../../content/developer/reference/views.rst:1345
|
||
msgid "view to open when the user create or edit an event. Note that if this attribute is not set, the calendar view will fall back to the id of the form view in the current action, if any."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:418
|
||
#: ../../content/developer/reference/views.rst:1350
|
||
msgid "``event_open_popup``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:417
|
||
#: ../../content/developer/reference/views.rst:1349
|
||
msgid "If the option 'event_open_popup' is set to true, then the calendar view will open events (or records) in a FormViewDialog. Otherwise, it will open events in a new form view (with a do_action)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:422
|
||
#: ../../content/developer/reference/views.rst:1354
|
||
msgid "``quick_add``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:421
|
||
#: ../../content/developer/reference/views.rst:1353
|
||
msgid "enables quick-event creation on click: only asks the user for a ``name`` and tries to create a new event with just that and the clicked event time. Falls back to a full form dialog if the quick creation fails"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:425
|
||
#: ../../content/developer/reference/views.rst:1357
|
||
msgid "``all_day``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:425
|
||
#: ../../content/developer/reference/views.rst:1357
|
||
msgid "name of a boolean field on the record indicating whether the corresponding event is flagged as day-long (and duration is irrelevant)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:428
|
||
#: ../../content/developer/reference/views.rst:869
|
||
#: ../../content/developer/reference/views.rst:1360
|
||
msgid "``mode``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:428
|
||
msgid "Default display mode when loading the calendar. Possible attributes are: ``day``, ``week``, ``month``, ``year``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:432
|
||
#: ../../content/developer/reference/views.rst:1065
|
||
msgid "``scales``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:431
|
||
msgid "Comma-separated list of scales to provide. By default, all scales are available. See mode for possible scale values."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:452
|
||
#: ../../content/developer/reference/views.rst:1367
|
||
msgid "``<field>``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:435
|
||
#: ../../content/developer/reference/views.rst:1366
|
||
msgid "declares fields to aggregate or to use in kanban *logic*. If the field is simply displayed in the calendar cards."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:438
|
||
msgid "Fields can have additional attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:440
|
||
msgid "``invisible`` use \"True\" to hide the value in the cards"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:442
|
||
msgid "``avatar_field`` only for x2many field, to display the avatar instead of the display_name in the cards"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:445
|
||
msgid "``write_model`` and ``write_field``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:447
|
||
msgid "you can add a filter and save the result in the defined model, the filter is added in the sidebar"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:449
|
||
msgid "``filter`` and ``color``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:451
|
||
msgid "use \"True\" to add this field in filter in the sidebar. You can specify a ``color`` field used to colorize the checkbox."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:457
|
||
msgid "Cohort"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:463
|
||
msgid "The cohort view is used to display and understand the way some data changes over a period of time. For example, imagine that for a given business, clients can subscribe to some service. The cohort view can then display the total number of subscriptions each month, and study the rate at which client leave the service (churn). When clicking on a cell, the cohort view will redirect you to a new action in which you will only see the records contained in the cell's time interval; this action contains a list view and a form view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:471
|
||
msgid "By default the cohort view will use the same list and form views as those defined on the action. You can pass a list view and a form view to the context of the action in order to set/override the views that will be used (the context keys to use being `form_view_id` and `list_view_id`)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:476
|
||
msgid "For example, here is a very simple cohort view:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:482
|
||
msgid "The root element of the Cohort view is <cohort>, it accepts the following attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:491
|
||
msgid "``date_start`` (mandatory)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:490
|
||
msgid "A valid date or datetime field. This field is understood by the view as the beginning date of a record"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:495
|
||
msgid "``date_stop`` (mandatory)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:494
|
||
msgid "A valid date or datetime field. This field is understood by the view as the end date of a record. This is the field that will determine the churn."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:500
|
||
msgid "``mode`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:498
|
||
msgid "A string to describe the mode. It should be either 'churn' or 'retention' (default). Churn mode will start at 0% and accumulate over time whereas retention will start at 100% and decrease over time."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:506
|
||
msgid "``timeline`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:503
|
||
msgid "A string to describe the timeline. It should be either 'backward' or 'forward' (default). Forward timeline will display data from date_start to date_stop, whereas backward timeline will display data from date_stop to date_start (when the date_start is in future / greater than date_stop)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:510
|
||
msgid "``interval`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:509
|
||
msgid "A string to describe a time interval. It should be 'day', 'week', 'month'' (default) or 'year'."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:514
|
||
#: ../../content/developer/reference/views.rst:663
|
||
msgid "``measure`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:513
|
||
msgid "A field that can be aggregated. This field will be used to compute the values for each cell. If not set, the cohort view will count the number of occurrences."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:518
|
||
msgid "``<field>`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:517
|
||
msgid "allows to specify a particular field in order to manage it from the available measures, it's main use is for hiding a field from the selectable measures:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:521
|
||
msgid "the name of the field to use in the view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:523
|
||
#: ../../content/developer/reference/views.rst:588
|
||
#: ../../content/developer/reference/views.rst:620
|
||
#: ../../content/developer/reference/views.rst:693
|
||
msgid "``string`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:523
|
||
msgid "the name that would be used to display the field in the cohort view, overrides the default python String attribute of the field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:528
|
||
#: ../../content/developer/reference/views.rst:1144
|
||
msgid "``invisible`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:526
|
||
#: ../../content/developer/reference/views.rst:1745
|
||
msgid "if true, the field will not appear either in the active measures nor in the selectable measures (useful for fields that do not make sense aggregated, such as fields in different units, e.g. € and $)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:533
|
||
msgid "Dashboard"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:539
|
||
msgid "Like pivot and graph view, The dashboard view is used to display aggregate data. However, the dashboard can embed sub views, which makes it possible to have a more complete and interesting look on a given dataset."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:543
|
||
msgid "The dashboard view can display sub views, aggregates for some fields (over a domain), or even *formulas* (expressions which involves one or more aggregates). For example, here is a very simple dashboard:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:560
|
||
msgid "The root element of the Dashboard view is <dashboard>, it does not accept any attributes."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:563
|
||
msgid "There are 5 possible type of tags in a dashboard view:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:566
|
||
msgid "declares a sub view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:568
|
||
#: ../../content/developer/reference/views.rst:585
|
||
#: ../../content/developer/reference/views.rst:605
|
||
#: ../../content/developer/reference/views.rst:681
|
||
#: ../../content/developer/reference/views.rst:715
|
||
msgid "Admissible attributes are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:571
|
||
msgid "``type`` (mandatory)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:571
|
||
msgid "The type of the sub view. For example, *graph* or *pivot*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:575
|
||
msgid "``ref`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:574
|
||
msgid "An xml id for a view. If not given, the default view for the model will be used."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:579
|
||
#: ../../content/developer/reference/views.rst:690
|
||
#: ../../content/developer/webservices/extract_api.rst:308
|
||
msgid "``name`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:578
|
||
msgid "A string which identifies this element. It is mostly useful to be used as a target for an xpath."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:596
|
||
#: ../../content/developer/reference/views.rst:766
|
||
#: ../../content/developer/reference/views.rst:2015
|
||
msgid "``group``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:582
|
||
msgid "defines a column layout. This is actually very similar to the group element in a form view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:588
|
||
msgid "A description which will be displayed as a group title."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:591
|
||
msgid "``colspan`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:591
|
||
msgid "The number of subcolumns in this group tag. By default, 6."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:596
|
||
#: ../../content/developer/reference/views.rst:647
|
||
#: ../../content/developer/reference/views.rst:697
|
||
#: ../../content/developer/reference/views.rst:723
|
||
msgid "``col`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:594
|
||
msgid "The number of columns spanned by this group tag (only makes sense inside another group). By default, 6."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:673
|
||
msgid "``aggregate``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:599
|
||
msgid "declares an aggregate. This is the value of an aggregate for a given field over the current domain."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:602
|
||
msgid "Note that aggregates are supposed to be used inside a group tag (otherwise the style will not be properly applied)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:613
|
||
msgid "``field`` (mandatory)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:608
|
||
msgid "The field name to use for computing the aggregate. Possible field types are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:611
|
||
msgid "``integer`` (default group operator is sum)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:612
|
||
msgid "``float`` (default group operator is sum)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:613
|
||
msgid "``many2one`` (default group operator is count distinct)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:616
|
||
msgid "A string to identify this aggregate (useful for formulas)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:619
|
||
msgid "A short description that will be displayed above the value. If not given, it will fall back to the field string."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:623
|
||
msgid "An additional restriction on the set of records that we want to aggregate. This domain will be combined with the current domain."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:629
|
||
msgid "``domain_label`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:627
|
||
msgid "When the user clicks on an aggregate with a domain, it will be added to the search view as a facet. The string displayed for this facet can be customized with this attribute."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:643
|
||
msgid "``group_operator`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:632
|
||
msgid "A valid postgreSQL aggregate function identifier to use when aggregating values (see https://www.postgresql.org/docs/9.5/static/functions-aggregate.html). If not provided, By default, the group_operator from the field definition is used. Note that no aggregation of field values is achieved if the group_operator value is \"\"."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:637
|
||
msgid "The special aggregate function ``count_distinct`` (defined in odoo) can also be used here"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:646
|
||
#: ../../content/developer/reference/views.rst:696
|
||
#: ../../content/developer/reference/views.rst:722
|
||
msgid "The number of columns spanned by this tag (only makes sense inside a group). By default, 1."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:651
|
||
#: ../../content/developer/reference/views.rst:701
|
||
msgid "``widget`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:650
|
||
msgid "A widget to format the value (like the widget attribute for fields). For example, monetary."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:654
|
||
#: ../../content/developer/reference/views.rst:704
|
||
msgid "``help`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:654
|
||
#: ../../content/developer/reference/views.rst:704
|
||
msgid "A help message to dipslay in a tooltip (equivalent of help for a field in python)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:657
|
||
msgid "This attribute is the name of a field describing the measure that has to be used in the graph and pivot views when clicking on the aggregate. The special value __count__ can be used to use the count measure."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:668
|
||
msgid "``clickable`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:666
|
||
msgid "A boolean indicating if this aggregate should be clickable or not (default to true). Clicking on a clickable aggregate will change the measures used by the subviews and add the value of the domain attribute (if any) to the search view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:673
|
||
#: ../../content/developer/reference/views.rst:709
|
||
msgid "``value_label`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:671
|
||
msgid "A string put on the right of the aggregate value. For example, it can be useful to indicate the unit of measure of the aggregate value."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:709
|
||
msgid "``formula``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:676
|
||
msgid "declares a derived value. Formulas are values computed from aggregates."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:678
|
||
msgid "Note that like aggregates, formulas are supposed to be used inside a group tag (otherwise the style will not be properly applied)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:687
|
||
msgid "``value`` (mandatory)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:684
|
||
msgid "A string expression that will be evaluated, with the builtin python evaluator (in the web client). Every aggregate can be used in the context, in the ``record`` variable. For example, ``record.price_total / record.order_id``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:690
|
||
msgid "A string to identify this formula"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:693
|
||
msgid "A short description that will be displayed above the formula."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:700
|
||
msgid "A widget to format the value (like the widget attribute for fields). For example, monetary. By default, it is 'float'."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:707
|
||
msgid "A string put on the right of the formula value. For example, it can be useful to indicate the unit of measure of the formula value."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:712
|
||
msgid "Declares a specialized widget to be used to display the information. This is a mechanism similar to the widgets in the form view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:718
|
||
msgid "A string to identify which widget should be instantiated. The view will look into the ``widget_registry`` to get the proper class."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:728
|
||
msgid "Form"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:730
|
||
msgid "Form views are used to display the data from a single record. Their root element is ``<form>``. They are composed of regular HTML_ with additional structural and semantic components."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:735
|
||
#: ../../content/developer/reference/views.rst:1663
|
||
msgid "Structural components"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:737
|
||
msgid "Structural components provide structure or \"visual\" features with little logic. They are used as elements or sets of elements in form views."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:751
|
||
msgid "``notebook``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:741
|
||
msgid "defines a tabbed section. Each tab is defined through a ``page`` child element. Pages can have the following attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:744
|
||
msgid "``string`` (required) the title of the tab"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:746
|
||
msgid "``accesskey`` an HTML accesskey_"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:748
|
||
msgid "``attrs`` standard dynamic attributes based on record values"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:751
|
||
msgid "Note that ``notebook`` should not be placed within ``group``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:754
|
||
msgid "used to define column layouts in forms. By default, groups define 2 columns and most direct children of groups take a single column. ``field`` direct children of groups display a label by default, and the label and the field itself have a colspan of 1 each."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:759
|
||
msgid "The number of columns in a ``group`` can be customized using the ``col`` attribute, the number of columns taken by an element can be customized using ``colspan``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:763
|
||
msgid "Children are laid out horizontally (tries to fill the next column before changing row)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:766
|
||
msgid "Groups can have a ``string`` attribute, which is displayed as the group's title"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:770
|
||
msgid "``newline``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:769
|
||
msgid "only useful within ``group`` elements, ends the current row early and immediately switches to a new row (without filling any remaining column beforehand)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:773
|
||
#: ../../content/developer/reference/views.rst:2011
|
||
msgid "``separator``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:773
|
||
msgid "small horizontal spacing, with a ``string`` attribute behaves as a section title"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:776
|
||
msgid "``sheet``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:776
|
||
msgid "can be used as a direct child to ``form`` for a narrower and more responsive form layout"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:780
|
||
msgid "``header``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:779
|
||
msgid "combined with ``sheet``, provides a full-width location above the sheet itself, generally used to display workflow buttons and status widgets"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:783
|
||
msgid "Semantic components"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:785
|
||
msgid "Semantic components tie into and allow interaction with the Odoo system. Available semantic components are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:798
|
||
#: ../../content/developer/reference/views.rst:1483
|
||
msgid "``button``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:789
|
||
msgid "call into the Odoo system, similar to :ref:`list view buttons <reference/views/list/button>`. In addition, the following attribute can be specified:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:794
|
||
msgid "``special``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:794
|
||
msgid "for form views opened in dialogs: ``save`` to save the record and close the dialog, ``cancel`` to close the dialog without saving."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:798
|
||
msgid "``confirm``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:797
|
||
msgid "confirmation message to display (and for the user to accept) before performing the button's Odoo call (also works in Kanban views)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:801
|
||
msgid "renders (and allow editing of, possibly) a single field of the current record. Using several times a field in a form view is supported and the fields can receive different values for modifiers 'invisible' and 'readonly'. However, the behavior is not guaranteed when several fields exist with different values for modifier 'required'. Possible attributes of the field node are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:808
|
||
msgid "the name of the field to render"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:810
|
||
msgid "the node id. Useful when there are several occurrences of the same field in the view (see ``label`` component below). Default is the field name."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:813
|
||
msgid "fields have a default rendering based on their type (e.g. :class:`~odoo.fields.Char`, :class:`~odoo.fields.Many2one`). The ``widget`` attributes allows using a different rendering method and context."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:818
|
||
msgid "list of widgets"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:820
|
||
msgid "& options & specific attributes (e.g. widget=statusbar statusbar_visible clickable)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:823
|
||
msgid "``options``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:823
|
||
msgid "JSON object specifying configuration option for the field's widget (including default widgets)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:835
|
||
#: ../../content/developer/reference/views.rst:899
|
||
#: ../../content/developer/reference/views.rst:1197
|
||
msgid "``class``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:826
|
||
msgid "HTML class to set on the generated element, common field classes are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:828
|
||
msgid "``oe_inline``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:829
|
||
msgid "prevent the usual line break following fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:830
|
||
msgid "``oe_left``, ``oe_right``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:831
|
||
msgid "floats_ the field to the corresponding direction"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:832
|
||
msgid "``oe_read_only``, ``oe_edit_only``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:833
|
||
msgid "only displays the field in the corresponding form mode"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:835
|
||
msgid "``oe_avatar``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:835
|
||
msgid "for image fields, displays images as \"avatar\" (square, 90x90 maximum size, some image decorations)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:838
|
||
msgid "only displays the field for specific users"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:845
|
||
msgid "``on_change``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:840
|
||
msgid "calls the specified method when this field's value is edited, can generate update other fields or display warnings for the user"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:845
|
||
msgid "Use :func:`odoo.api.onchange` on the model"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:847
|
||
#: ../../content/developer/reference/views.rst:903
|
||
#: ../../content/developer/reference/views.rst:1466
|
||
#: ../../content/developer/reference/views.rst:1518
|
||
msgid "``attrs``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:848
|
||
msgid "dynamic meta-parameters based on record values"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:850
|
||
msgid "for relational fields only, filters to apply when displaying existing records for selection"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:853
|
||
msgid "for relational fields only, context to pass when fetching possible values"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:855
|
||
msgid "``readonly``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:855
|
||
msgid "display the field in both readonly and edit mode, but never make it editable"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:858
|
||
msgid "``required``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:858
|
||
msgid "generates an error and prevents saving the record if the field doesn't have a value"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:861
|
||
#: ../../content/developer/reference/views.rst:1536
|
||
msgid "``nolabel``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:861
|
||
msgid "don't automatically display the field's label, only makes sense if the field is a direct child of a ``group`` element"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:865
|
||
msgid "``placeholder``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:864
|
||
msgid "help message to display in *empty* fields. Can replace field labels in complex forms. *Should not* be an example of data as users are liable to confuse placeholder text with filled fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:868
|
||
msgid "for :class:`~odoo.fields.One2many`, display mode (view type) to use for the field's linked records. One of ``tree``, ``form``, ``kanban`` or ``graph``. The default is ``tree`` (a list display)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:871
|
||
#: ../../content/developer/reference/views.rst:1980
|
||
msgid "``help``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:872
|
||
msgid "tooltip displayed for users when hovering the field or its label"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:874
|
||
#: ../../content/developer/webservices/upgrade.rst:541
|
||
msgid "``filename``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:874
|
||
msgid "for binary fields, name of the related field providing the name of the file"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:877
|
||
msgid "``password``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:877
|
||
msgid "indicates that a :class:`~odoo.fields.Char` field stores a password and that its data shouldn't be displayed"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:881
|
||
msgid "``kanban_view_ref``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:880
|
||
msgid "for opening specific kanban view when selecting records from m2o/m2m in mobile environment"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:903
|
||
msgid "``label``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:884
|
||
msgid "when a ``field`` component isn't placed directly inside a ``group``, or when its ``nolabel`` attribute is set, the field's label isn't automatically displayed alongside its value. The ``label`` component is the manual alternative of displaying the label of a field. Possible attributes are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:894
|
||
msgid "``for`` (mandatory)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:890
|
||
msgid "the reference to the field associated with the label. Can be either the name of a field, or its id (``id`` attribute set on the ``field``). When there are several occurrences of the same field in the view, and there are several ``label`` components associated with these ``field`` nodes, those labels must have unique ``for`` attributes (in this case referencing the ``id`` attribute of the corresponding ``field`` nodes)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:897
|
||
msgid "the label to display. Display the field's label (coming from the field definition in the model) by default."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:900
|
||
#: ../../content/developer/reference/views.rst:902
|
||
msgid "same as for ``field`` component."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:938
|
||
msgid "classes for forms"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:940
|
||
msgid "widgets?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:951
|
||
msgid "Gantt views appropriately display Gantt charts (for scheduling)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:953
|
||
msgid "The root element of gantt views is ``<gantt/>``, it has no children but can take the following attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:957
|
||
msgid "name of the field providing the start datetime of the event for each record."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:960
|
||
msgid "``date_stop`` (required)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:960
|
||
msgid "name of the field providing the end duration of the event for each record."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:963
|
||
msgid "name of the field used to color the pills according to its value"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:978
|
||
msgid "``{$name}`` can be one of the following `bootstrap contextual color`_ (``danger``, ``info``, ``secondary``, ``success`` or ``warning``)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:980
|
||
#: ../../content/developer/reference/views.rst:1192
|
||
msgid "``default_group_by``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:981
|
||
msgid "name of a field to group tasks by"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:982
|
||
msgid "``consolidation``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:983
|
||
msgid "field name to display consolidation value in record cell"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:986
|
||
msgid "``consolidation_max``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:985
|
||
msgid "dictionnary with the \"group by\" field as key and the maximum consolidation value that can be reached before displaying the cell in red (e.g. ``{\"user_id\": 100}``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:990
|
||
msgid "``consolidation_exclude``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:989
|
||
msgid "name of the field that describes if the task has to be excluded from the consolidation if set to true it displays a striped zone in the consolidation line"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1007
|
||
msgid "``create``, ``cell_create``, ``edit``, ``delete``, ``plan``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:993
|
||
msgid "allows *dis*\\ abling the corresponding action in the view by setting the corresponding attribute to ``false`` (default: ``true``)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:996
|
||
msgid "``create``: If enabled, an ``Add`` button will be available in the control panel to create records."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:998
|
||
msgid "``cell_create``: If enabled and ``create`` enabled, a \"**+**\" button will be displayed while hovering on a time slot cell to create a new record on that slot."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1000
|
||
msgid "``edit``: If enabled, the opened records will be in edit mode (thus editable)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1001
|
||
msgid "``plan``: If enabled and ``edit`` enabled, a \"magnifying glass\" button will be displayed on time slots to plan unassigned records into that time slot."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1006
|
||
msgid "When you do not want to create records on the gantt view and the beginning and end dates are required on the model, the planning feature should be disabled because no record will ever be found."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1012
|
||
msgid "``offset``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1010
|
||
msgid "Depending on the scale, the number of units to add to today to compute the default period. Examples: An offset of +1 in default_scale week will open the gantt view for next week, and an offset of -2 in default_scale month will open the gantt view of 2 months ago."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1015
|
||
msgid "``progress``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1015
|
||
msgid "name of a field providing the completion percentage for the record's event, between 0 and 100"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1018
|
||
msgid "title of the gantt view"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1043
|
||
msgid "``precision``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1020
|
||
msgid "JSON object specifying snapping precisions for the pills in each scale."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1022
|
||
msgid "Possible values for scale ``day`` are (default: ``hour``):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1024
|
||
msgid "``hour``: records times snap to full hours (ex: 7:12 becomes 8:00)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1026
|
||
msgid "``hour:half``: records times snap to half hours (ex: 7:12 becomes 7:30)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1028
|
||
msgid "``hour:quarter``: records times snap to half hours (ex: 7:12 becomes 7:15)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1030
|
||
msgid "Possible values for scale ``week`` are (default: ``day:half``):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1032
|
||
#: ../../content/developer/reference/views.rst:1038
|
||
msgid "``day``: records times snap to full days (ex: 7:28 AM becomes 11:59:59 PM of the previous day, 10:32 PM becomes 12:00 PM of the current day)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1034
|
||
#: ../../content/developer/reference/views.rst:1040
|
||
msgid "``day:half``: records times snap to half hours (ex: 7:28 AM becomes 12:00 PM)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1036
|
||
msgid "Possible values for scale ``month`` are (default: ``day:half``):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1042
|
||
msgid "Scale ``year`` always snap to full day."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1044
|
||
msgid "Example of precision attribute: ``{\"day\": \"hour:quarter\", \"week\": \"day:half\", \"month\": \"day\"}``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1046
|
||
msgid "``total_row``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1046
|
||
msgid "boolean to control whether the row containing the total count of records should be displayed. (default: ``false``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1049
|
||
msgid "``collapse_first_level``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1049
|
||
msgid "boolean to control whether it is possible to collapse each row if grouped by one field. (default: ``false``, the collapse starts when grouping by two fields)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1053
|
||
msgid "``display_unavailability``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1052
|
||
msgid "boolean to mark the dates returned by the ``gantt_unavailability`` function of the model as available inside the gantt view. Records can still be scheduled in them, but their unavailability is visually displayed. (default: ``false``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1061
|
||
msgid "``default_scale``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1056
|
||
msgid "default scale when rendering the view. Possible values are (default: ``month``):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1058
|
||
msgid "``day``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1059
|
||
msgid "``week``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1060
|
||
msgid "``month``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1061
|
||
msgid "``year``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1064
|
||
msgid "comma-separated list of allowed scales for this view. By default, all scales are allowed. For possible scale values to use in this list, see ``default_scale``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1068
|
||
msgid "defines the :ref:`reference/qweb` template ``gantt-popover`` which is used when the user hovers over one of the records in the gantt view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1071
|
||
msgid "The gantt view uses mostly-standard :ref:`javascript qweb <reference/qweb/javascript>` and provides the following context variables:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1075
|
||
msgid "the current :js:class:`GanttRow`, can be used to fetch some meta-information. The ``getColor`` method to convert in a color integer is also available directly in the template context without using ``widget``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1079
|
||
msgid "``on_create`` If specified when clicking the add button on the view, instead of opening a generic dialog, launch a client action. this should hold the xmlid of the action (eg: ``on_create=\"%(my_module.my_wizard)d\"``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1084
|
||
msgid "view to open when the user create or edit a record. Note that if this attribute is not set, the gantt view will fall back to the id of the form view in the current action, if any."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1090
|
||
msgid "``dynamic_range``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1089
|
||
msgid "if set to true, the gantt view will start at the first record, instead of starting at the beginning of the year/month/day."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1109
|
||
msgid "``thumbnails``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1093
|
||
msgid "This allows to display a thumbnail next to groups name if the group is a relationnal field. This expects a python dict which keys are the name of the field on the active model. Values are the names of the field holding the thumbnail on the related model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1097
|
||
msgid "Example: tasks have a field user_id that reference res.users. The res.users model has a field image that holds the avatar, then:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1109
|
||
msgid "will display the users avatars next to their names when grouped by user_id."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1114
|
||
msgid "Graph"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1116
|
||
msgid "The graph view is used to visualize aggregations over a number of records or record groups. Its root element is ``<graph>`` which can take the following attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1121
|
||
msgid "one of ``bar`` (default), ``pie`` and ``line``, the type of graph to use"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1123
|
||
msgid "``stacked``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1123
|
||
msgid "only used for ``bar`` charts. If present and set to ``True``, stacks bars within a group"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1125
|
||
#: ../../content/developer/reference/views.rst:1704
|
||
msgid "``disable_linking``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1126
|
||
msgid "set to ``True`` to prevent from redirecting clicks on graph to list view"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1130
|
||
msgid "``order``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1128
|
||
msgid "if set, x-axis values will be sorted by default according their measure with respect to the given order (``asc`` or ``desc``). Only used for ``bar`` and ``pie`` charts."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1132
|
||
msgid "The only allowed element within a graph view is ``field`` which can have the following attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1136
|
||
#: ../../content/developer/reference/views.rst:1722
|
||
msgid "the name of a field to use in the view. If used for grouping (rather than aggregating)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1140
|
||
msgid "``title`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1140
|
||
msgid "string displayed on the top of the graph."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1143
|
||
msgid "if true, the field will not appear either in the active measures nor in the selectable measures."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1147
|
||
#: ../../content/developer/reference/views.rst:1730
|
||
msgid "indicates whether the field should be used as a grouping criteria or as an aggregated value within a group. Possible values are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1151
|
||
msgid "groups by the specified field. All graph types support at least one level of grouping, some may support more."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1153
|
||
#: ../../content/developer/reference/views.rst:1735
|
||
msgid "``col``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1154
|
||
msgid "authorized in graph views but only used by pivot tables"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1156
|
||
#: ../../content/developer/reference/views.rst:1738
|
||
msgid "field to aggregate within a group"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1161
|
||
#: ../../content/developer/reference/views.rst:1742
|
||
msgid "``interval``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1159
|
||
#: ../../content/developer/reference/views.rst:1740
|
||
msgid "on date and datetime fields, groups by the specified interval (``day``, ``week``, ``month``, ``quarter`` or ``year``) instead of grouping on the specific datetime (fixed second resolution) or date (fixed day resolution)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1163
|
||
#: ../../content/developer/reference/views.rst:1749
|
||
msgid "The measures are automatically generated from the model fields; only the aggregatable fields are used. Those measures are also alphabetically sorted on the string of the field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1169
|
||
msgid "graph view aggregations are performed on database content, non-stored function fields can not be used in graph views"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1177
|
||
msgid "The kanban view is a `kanban board`_ visualisation: it displays records as \"cards\", halfway between a :ref:`list view <reference/views/list>` and a non-editable :ref:`form view <reference/views/form>`. Records may be grouped in columns for use in workflow visualisation or manipulation (e.g. tasks or work-progress management), or ungrouped (used simply to visualize records)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1183
|
||
msgid "The kanban view will load and display a maximum of ten columns. Any column after that will be closed (but can still be opened by the user)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1187
|
||
msgid "The root element of the Kanban view is ``<kanban>``, it can use the following attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1191
|
||
msgid "whether the kanban view should be grouped if no grouping is specified via the action or the current search. Should be the name of the field to group by when no grouping is otherwise specified"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1195
|
||
#: ../../content/developer/reference/views.rst:1404
|
||
#: ../../content/developer/reference/views.rst:1669
|
||
#: ../../content/developer/reference/views.rst:1716
|
||
msgid "``default_order``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1195
|
||
msgid "cards sorting order used if the user has not already sorted the records (via the list view)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1198
|
||
msgid "adds HTML classes to the root HTML element of the Kanban view"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1199
|
||
msgid "``examples``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1200
|
||
msgid "if set to a key in the `KanbanExamplesRegistry`_, examples on column setups will be available in the grouped kanban view. `Here <https://github.com/odoo/odoo/blob/99821fdcf89aa66ac9561a972c6823135ebf65c0/addons/project/static/src/js/project_task_kanban_examples.js#L27>`_ is an example of how to define those setups."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1201
|
||
msgid "``group_create``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1202
|
||
msgid "whether the \"Add a new column\" bar is visible or not. Default: true."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1203
|
||
msgid "``group_delete``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1204
|
||
msgid "whether groups can be deleted via the context menu. Default: true."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1205
|
||
msgid "``group_edit``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1206
|
||
msgid "whether groups can be edited via the context menu. Default: true."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1208
|
||
msgid "``archivable``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1208
|
||
msgid "whether records belonging to a column can be archived / restored if an ``active`` field is defined on the model. Default: true."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1212
|
||
msgid "``quick_create``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1211
|
||
msgid "whether it should be possible to create records without switching to the form view. By default, ``quick_create`` is enabled when the Kanban view is grouped by many2one, selection, char or boolean fields, and disabled when not."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1214
|
||
msgid "``quick_create_view``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1215
|
||
msgid "``form`` view reference, specifying the view used for records quick creation."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1219
|
||
msgid "``records_draggable``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1217
|
||
msgid "whether it should be possible to drag records when kanban is grouped. Default: true."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1219
|
||
msgid "Set to ``true`` to always enable it, and to ``false`` to always disable it."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1221
|
||
msgid "VFE missing information on on_create attribute of kanban views."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1226
|
||
msgid "declares fields to use in kanban *logic*. If the field is simply displayed in the kanban view, it does not need to be pre-declared."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1250
|
||
#: ../../content/developer/reference/views.rst:1505
|
||
msgid "``progressbar``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1235
|
||
msgid "declares a progressbar element to put on top of kanban columns."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1241
|
||
msgid "``field`` (required)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1240
|
||
msgid "the name of the field whose values are used to subgroup column's records in the progressbar"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1245
|
||
msgid "``colors`` (required)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1244
|
||
msgid "JSON mapping the above field values to either \"danger\", \"warning\", \"success\" or \"muted\" colors"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1250
|
||
msgid "``sum_field`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1248
|
||
msgid "the name of the field whose column's records' values will be summed and displayed next to the progressbar (if omitted, displays the total number of records)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1253
|
||
msgid "defines a list of :ref:`reference/qweb` templates. Cards definition may be split into multiple templates for clarity, but kanban views *must* define at least one root template ``kanban-box``, which will be rendered once for each record."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1258
|
||
msgid "The kanban view uses mostly-standard :ref:`javascript qweb <reference/qweb/javascript>` and provides the following context variables:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1262
|
||
msgid "the current :js:class:`KanbanRecord`, can be used to fetch some meta-information. These methods are also available directly in the template context and don't need to be accessed via ``widget``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1266
|
||
msgid "an object with all the requested fields as its attributes. Each field has two attributes ``value`` and ``raw_value``, the former is formatted according to current user parameters, the latter is the direct value from a :meth:`~odoo.models.Model.read` (except for date and datetime fields that are `formatted according to user's locale <https://github.com/odoo/odoo/blob/a678bd4e/addons/web_kanban/static/src/js/kanban_record.js#L102>`_)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1273
|
||
msgid "the current context, coming from the action, and the one2many or many2many field in the case of a Kanban view embedded in a Form view"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1275
|
||
msgid "``user_context``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1277
|
||
msgid "``read_only_mode``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1319
|
||
msgid "``selection_mode``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1280
|
||
msgid "set to true when kanban view is opened in mobile environment from m2o/m2m field for selecting records."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1283
|
||
msgid "clicking on m2o/m2m field in mobile environment opens kanban view"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:0
|
||
msgid "buttons and fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1288
|
||
msgid "While most of the Kanban templates are standard :ref:`reference/qweb`, the Kanban view processes ``field``, ``button`` and ``a`` elements specially:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1291
|
||
msgid "by default fields are replaced by their formatted value, unless the ``widget`` attribute is specified, in which case their rendering and behavior depends on the corresponding widget. Possible values are (among others):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1298
|
||
#: ../../content/developer/reference/views.rst:1509
|
||
msgid "``handle``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1297
|
||
msgid "for ``sequence`` (or ``integer``) fields by which records are sorted, allows to drag&drop records to reorder them."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1300
|
||
msgid "list widgets?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1302
|
||
msgid "buttons and links with a ``type`` attribute become perform Odoo-related operations rather than their standard HTML function. Possible types are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1307
|
||
msgid "``action``, ``object``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1306
|
||
msgid "standard behavior for :ref:`Odoo buttons <reference/views/list/button>`, most attributes relevant to standard Odoo buttons can be used."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1309
|
||
msgid "``open``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1310
|
||
msgid "opens the card's record in the form view in read-only mode"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1311
|
||
msgid "``edit``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1312
|
||
msgid "opens the card's record in the form view in editable mode"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1314
|
||
msgid "deletes the card's record and removes the card"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1318
|
||
msgid "kanban-specific CSS"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1319
|
||
msgid "kanban structures/widgets (vignette, details, ...)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1321
|
||
msgid "If you need to extend the Kanban view, see :js:class::`the JS API <KanbanRecord>`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1326
|
||
msgid "Calendar views display records as events in a daily, weekly or monthly calendar. Their root element is ``<calendar>``. Available attributes on the calendar view are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1360
|
||
msgid "Default display mode when loading the calendar. Possible attributes are: ``day``, ``week``, ``month``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1363
|
||
msgid "``create``, ``delete``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1363
|
||
#: ../../content/developer/reference/views.rst:1414
|
||
msgid "allows *dis*\\ abling the corresponding action in the view by setting the corresponding attribute to ``false``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1372
|
||
msgid "List"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1374
|
||
msgid "The root element of list views is ``<tree>``\\ [#treehistory]_. The list view's root can have the following attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1378
|
||
msgid "by default, selecting a list view's row opens the corresponding :ref:`form view <reference/views/form>`. The ``editable`` attributes makes the list view itself editable in-place."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1382
|
||
msgid "Valid values are ``top`` and ``bottom``, making *new* records appear respectively at the top or bottom of the list."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1385
|
||
msgid "The architecture for the inline :ref:`form view <reference/views/form>` is derived from the list view. Most attributes valid on a :ref:`form view <reference/views/form>`'s fields and buttons are thus accepted by list views although they may not have any meaning if the list view is non-editable"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1391
|
||
msgid "if the ``edit`` attribute is set to ``false``, the ``editable`` option will be ignored."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1395
|
||
msgid "``multi_edit``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1394
|
||
msgid "editable or not editable list can activate the multi-editing feature by defining the `multi_edit=1`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1398
|
||
msgid "overrides the ordering of the view, replacing the model's order (:attr:`~odoo.models.BaseModel._order` model attribute). The value is a comma-separated list of fields, postfixed by ``desc`` to sort in reverse order:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1410
|
||
#: ../../content/developer/reference/views.rst:1531
|
||
msgid "``{$name}`` can be ``bf`` (``font-weight: bold``), ``it`` (``font-style: italic``), or any `bootstrap contextual color`_ (``danger``, ``info``, ``muted``, ``primary``, ``success`` or ``warning``)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1414
|
||
msgid "``create``, ``edit``, ``delete``, ``duplicate``, ``import``, ``export_xlsx``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1416
|
||
#: ../../content/developer/reference/views.rst:1685
|
||
msgid "``limit``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1417
|
||
msgid "the default size of a page. It must be a positive integer"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1419
|
||
msgid "``groups_limit``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1419
|
||
msgid "when the list view is grouped, the default number of groups of a page. It must be a position integer"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1423
|
||
msgid "``expand``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1422
|
||
msgid "when the list view is grouped, automatically open the first level of groups if set to true (default: false)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1425
|
||
msgid "Possible children elements of the list view are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1430
|
||
msgid "displays a button in a list cell"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1432
|
||
msgid "``icon``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1433
|
||
msgid "icon to use to display the button"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1435
|
||
msgid "if there is no ``icon``, the button's text"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1436
|
||
msgid "if there is an ``icon``, ``alt`` text for the icon"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1438
|
||
msgid "type of button, indicates how it clicking it affects Odoo:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1447
|
||
msgid "``object``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1441
|
||
msgid "call a method on the list's model. The button's ``name`` is the method, which is called with the current row's record id and the current context."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1450
|
||
msgid "load an execute an ``ir.actions``, the button's ``name`` is the database id of the action. The context is expanded with the list's model (as ``active_model``), the current row's record (``active_id``) and all the records currently loaded in the list (``active_ids``, may be just a subset of the database records matching the current search)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1457
|
||
#: ../../content/developer/reference/views.rst:1459
|
||
msgid "see ``type``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1461
|
||
msgid "dynamic attributes based on record values."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1463
|
||
msgid "A mapping of attributes to domains, domains are evaluated in the context of the current row's record, if ``True`` the corresponding attribute is set on the cell."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1467
|
||
msgid "Possible attribute is ``invisible`` (hides the button)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1478
|
||
msgid "``states``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1469
|
||
msgid "shorthand for ``invisible`` ``attrs``: a list of states, comma separated, requires that the model has a ``state`` field and that it is used in the view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1473
|
||
msgid "Makes the button ``invisible`` if the record is *not* in one of the listed states"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1478
|
||
msgid "Using ``states`` in combination with ``attrs`` may lead to unexpected results as domains are combined with a logical AND."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1481
|
||
msgid "merged into the view's context when performing the button's Odoo call"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1483
|
||
msgid "declared but unused: help"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1486
|
||
msgid "defines a column where the corresponding field should be displayed for each record. Can use the following attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1490
|
||
msgid "the name of the field to display in the current model. A given name can only be used once per view"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1493
|
||
msgid "the title of the field's column (by default, uses the ``string`` of the model's field)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1497
|
||
#: ../../content/developer/reference/views.rst:1747
|
||
msgid "``invisible``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1496
|
||
msgid "fetches and stores the field, but doesn't display the column in the table. Necessary for fields which shouldn't be displayed but are used by e.g. ``@colors``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1500
|
||
msgid "lists the groups which should be able to see the field"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1502
|
||
msgid "alternate representations for a field's display. Possible list view values are (among others):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1506
|
||
msgid "displays ``float`` fields as a progress bar."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1508
|
||
msgid "for ``sequence`` (or ``integer``) fields by which records are sorted, instead of displaying the field's value just displays a drag&drop icon to reorder records."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1514
|
||
msgid "``sum``, ``avg``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1512
|
||
msgid "displays the corresponding aggregate at the bottom of the column. The aggregation is only computed on *currently displayed* records. The aggregation operation must match the corresponding field's ``group_operator``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1517
|
||
msgid "dynamic attributes based on record values. Only effects the current field, so e.g. ``invisible`` will hide the field but leave the same field of other records visible, it will not hide the column itself"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1525
|
||
msgid "``width`` (for ``editable``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1521
|
||
msgid "when there is no data in the list, the width of a column can be forced by setting this attribute. The value can be an absolute width (e.g. '100px'), or a relative weight (e.g. '3', meaning that this column will be 3 times larger than the others). Note that when there are records in the list, we let the browser automatically adapt the column's widths according to their content, and this attribute is thus ignored."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1528
|
||
msgid "allow changing the style of a cell's text based on the corresponding record's attributes."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1535
|
||
msgid "if set to \"1\", the column header will remain empty. Also, the column won't be sortable."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1540
|
||
msgid "if the list view is ``editable``, any field attribute from the :ref:`form view <reference/views/form>` is also valid and will be used when setting up the inline form view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1546
|
||
msgid "In case of list sub-views (One2many/Many2many display in a form view), The attribute ``column_invisible`` can be useful to hide a column depending on the parent object."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1554
|
||
msgid "When a list view is grouped, numeric fields are aggregated and displayed for each group. Also, if there are too many records in a group, a pager will appear on the right of the group row. For this reason, it is not a good practice to have a numeric field in the last column, when the list view is in a situation where it can be grouped (it is however fine for x2manys field in a form view: they cannot be grouped)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1581
|
||
msgid "``groupby``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1563
|
||
msgid "defines custom headers (with buttons) for the current view when grouping records on many2one fields. It is also possible to add `field`, inside the `groupby` which can be used for modifiers. These fields thus belong on the many2one comodel. These extra fields will be fetched in batch."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1569
|
||
msgid "the name of a many2one field (on the current model). Custom header will be displayed when grouping the view on this field name."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1581
|
||
msgid "A special button (`type=\"edit\"`) can be defined to open the many2one form view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1631
|
||
msgid "``control``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1584
|
||
msgid "defines custom controls for the current view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1586
|
||
msgid "This makes sense if the parent ``tree`` view is inside a One2many field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1588
|
||
msgid "Does not support any attribute, but can have children:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1591
|
||
msgid "adds a button to create a new element on the current list."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1593
|
||
msgid "If any ``create`` is defined, it will overwrite the default \"add a line\" button."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1596
|
||
msgid "The following attributes are supported:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1599
|
||
#: ../../content/developer/reference/views.rst:1888
|
||
msgid "``string`` (required)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1599
|
||
msgid "The text displayed on the button."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1602
|
||
msgid "This context will be merged into the existing context when retrieving the default value of the new record."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1605
|
||
msgid "For example it can be used to override default values."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1608
|
||
msgid "The following example will override the default \"add a line\" button by replacing it with 3 new buttons: \"Add a product\", \"Add a section\" and \"Add a note\"."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1612
|
||
msgid "\"Add a product\" will set the field 'display_type' to its default value."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1614
|
||
msgid "The two other buttons will set the field 'display_type' to be respectively 'line_section' and 'line_note'."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1633
|
||
msgid "for historical reasons, it has its origin in tree-type views later repurposed to a more table/list-type display"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1645
|
||
msgid "This view is able to display records on a map and the routes between them. The record are represented by pins. It also allows the visualization of fields from the model in a popup tied to the record's pin."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1649
|
||
msgid "The model on which the view is applied should contains a res.partner many2one since the view relies on the res.partner's address and coordinates fields to localize the records."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1654
|
||
msgid "Api"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1656
|
||
msgid "The view uses location data platforms' api to fetch the tiles (the map's background), do the geoforwarding (converting addresses to a set of coordinates) and fetch the routes. The view implements two api, the default one, openstreet map is able to fetch `tiles`_ and do `geoforwarding`_. This api does not require a token. As soon as a valid `MapBox`_ token is provided in the general settings the view switches to the Mapbox api. This api is faster and allows the computation of routes. The token are available by `signing up`_ to MapBox"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1665
|
||
msgid "The view's root element is ``<map>`` multiple attributes are allowed"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1667
|
||
msgid "``res_partner``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1668
|
||
msgid "Contains the res.partner many2one. If not provided the view will resort to create an empty map."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1670
|
||
msgid "If a field is provided the view will override the model's default order. The field must be part of the model on which the view is applied not from res.partner"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1671
|
||
msgid "``routing``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1672
|
||
msgid "if ``true`` the routes between the records will be shown. The view still needs a valid MapBox token and at least two located records. (i.e the records has a res.partner many2one and the partner has a address or valid coordinates)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1673
|
||
msgid "``hide_name``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1674
|
||
msgid "if ``true`` hide a name from the marker's popup (default: false)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1676
|
||
msgid "``hide_address``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1676
|
||
msgid "if ``true`` hide a address from the marker's popup (default: false)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1678
|
||
msgid "The ``<map>`` element can contain multiple ``<field>`` elements. Each ``<field>`` element will be interpreted as a line in the marker's popup. The field's attributes are the following:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1681
|
||
msgid "The field to display."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1683
|
||
msgid "This string will be displayed before the field's content. It Can be used as a description."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1685
|
||
msgid "The size of a page (default: 80). It must be a positive integer."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1687
|
||
msgid "No attribute or element is mandatory but as stated above if no res.partner many2one is provided the view won't be able to locate records."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1694
|
||
msgid "For example here is a map:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1699
|
||
msgid "Pivot"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1701
|
||
msgid "The pivot view is used to visualize aggregations as a `pivot table`_. Its root element is ``<pivot>`` which can take the following attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1705
|
||
msgid "Set to ``True`` to remove table cell's links to list view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1706
|
||
msgid "``display_quantity``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1707
|
||
msgid "Set to ``true`` to display the Quantity column by default."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1709
|
||
msgid "The name of the measure and the order (asc or desc) to use as default order in the view."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1718
|
||
msgid "The only allowed element within a pivot view is ``field`` which can have the following attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1726
|
||
msgid "the name that will be used to display the field in the pivot view, overrides the default python String attribute of the field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1734
|
||
msgid "groups by the specified field, each group gets its own row."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1736
|
||
msgid "creates column-wise groups"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1755
|
||
msgid "like the graph view, the pivot aggregates data on database content which means that non-stored function fields can not be used in pivot views"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1759
|
||
msgid "In Pivot view a ``field`` can have a ``widget`` attribute to dictate its format. The widget should be a field formatter, of which the most interesting are ``date``, ``datetime``, ``float_time``, and ``monetary``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1763
|
||
msgid "For instance a timesheet pivot view could be defined as::"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1776
|
||
msgid "QWeb views are standard :ref:`reference/qweb` templates inside a view's ``arch``. They don't have a specific root element. Because QWeb views don't have a specific root element, their type must be specified explicitly (it can not be inferred from the root element of the ``arch`` field)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1781
|
||
msgid "QWeb views have two use cases:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1783
|
||
msgid "they can be used as frontend templates, in which case :ref:`reference/data/template` should be used as a shortcut."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1785
|
||
msgid "they can be used as actual qweb views (opened inside an action), in which case they should be defined as regular view with an explicit ``type`` (it can not be inferred) and a model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1789
|
||
msgid "The main additions of qweb-as-view to the basic qweb-as-template are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1791
|
||
msgid "qweb-as-view has a special case for a ``<nav>`` element bearing the CSS class ``o_qweb_cp_buttons``: its contents should be buttons and will be extracted and moved to the control panel's button area, the ``<nav>`` itself will be removed, this is a work-around to control panel views not existing yet"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1796
|
||
msgid "qweb-as-view rendering adds several items to the standard qweb rendering context:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1799
|
||
#: ../../content/developer/webservices/odoo.rst:1016
|
||
msgid "``model``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1800
|
||
msgid "the model to which the qweb view is bound"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1802
|
||
msgid "the domain provided by the search view"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1804
|
||
msgid "the context provided by the search view"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1807
|
||
msgid "``records``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1806
|
||
msgid "a lazy proxy to ``model.search(domain)``, this can be used if you just want to iterate the records and not perform more complex operations (e.g. grouping)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1809
|
||
msgid "qweb-as-view also provides additional rendering hooks:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1811
|
||
msgid "``_qweb_prepare_context(view_id, domain)`` prepares the rendering context specific to qweb-as-view"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1813
|
||
msgid "``qweb_render_view(view_id, domain)`` is the method called by the client and will call the context-preparation methods and ultimately ``env['ir.qweb'].render()``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1820
|
||
msgid "Search"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1822
|
||
msgid "Search views are a break from previous view types in that they don't display *content*: although they apply to a specific model, they are used to filter other view's content (generally aggregated views e.g. :ref:`reference/views/list` or :ref:`reference/views/graph`). Beyond that difference in use case, they are defined the same way."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1828
|
||
msgid "The root element of search views is ``<search>``. It takes no attributes."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1832
|
||
msgid "Possible children elements of the search view are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1835
|
||
msgid "fields define domains or contexts with user-provided values. When search domains are generated, field domains are composed with one another and with filters using **AND**."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1839
|
||
msgid "Fields can have the following attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1842
|
||
msgid "the name of the field to filter on"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1844
|
||
msgid "the field's label"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1853
|
||
msgid "``operator``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1846
|
||
msgid "by default, fields generate domains of the form :samp:`[({name}, {operator}, {provided_value})]` where ``name`` is the field's name and ``provided_value`` is the value provided by the user, possibly filtered or transformed (e.g. a user is expected to provide the *label* of a selection field's value, not the value itself)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1852
|
||
msgid "The ``operator`` attribute allows overriding the default operator, which depends on the field's type (e.g. ``=`` for float fields but ``ilike`` for char fields)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1861
|
||
msgid "``filter_domain``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1856
|
||
msgid "complete domain to use as the field's search domain, can use a ``self`` variable to inject the provided value in the custom domain. Can be used to generate significantly more flexible domains than ``operator`` alone (e.g. searches on multiple fields at once)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1861
|
||
msgid "If both ``operator`` and ``filter_domain`` are provided, ``filter_domain`` takes precedence."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1864
|
||
msgid "allows adding context keys, including the user-provided values (which as for ``domain`` are available as a ``self`` variable, an array of values e.g. ``[id_1, id_2]`` for a :class:`~odoo.fields.Many2one` field). By default, fields don't generate domains."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1869
|
||
msgid "the domain and context are inclusive and both are generated if a ``context`` is specified. To only generate context values, set ``filter_domain`` to an empty list: ``filter_domain=\"[]\"``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1874
|
||
msgid "make the field only available to specific users"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1876
|
||
msgid "if the field can provide an auto-completion (e.g. :class:`~odoo.fields.Many2one`), filters the possible completion results."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2008
|
||
msgid "``filter``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1881
|
||
msgid "a filter is a predefined toggle in the search view, it can only be enabled or disabled. Its main purposes are to add data to the search context (the context passed to the data view for searching/filtering), or to append new sections to the search filter."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1886
|
||
msgid "Filters can have the following attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1889
|
||
msgid "the label of the filter"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1891
|
||
msgid "an Odoo :ref:`domain <reference/orm/domains>`, will be appended to the action's domain as part of the search domain."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1925
|
||
msgid "``date`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1894
|
||
msgid "the name of a field of type ``date`` or ``datetime``. Using this attribute has the effect to create a set of filters available in a submenu of the filters menu. The filters proposed are time dependent but not dynamic in the sense that their domains are evaluated at the time of the control panel instantiation."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1907
|
||
msgid "The example above allows to easily search for records with creation date field values in one of the periods below (if the current month is August 2019)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1925
|
||
msgid "Muti selection of options is allowed."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1942
|
||
msgid "``default_period`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1928
|
||
msgid "only makes sense for a filter with non empty ``date`` attribute. determines which period is activated if the filter is in the default set of filters activated at the view initialization. If not provided, 'this_month' is used by default."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1933
|
||
msgid "To choose among the following options: today, this_week, this_month, last_month, antepenultimate_month, fourth_quarter, third_quarter, second_quarter, first_quarter, this_year, last_year, antepenultimate_year."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1945
|
||
msgid "a Python dictionary, merged into the action's domain to generate the search domain"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1948
|
||
msgid "The key ``group_by`` can be used to define a groupby available in the 'Group By' menu. The 'group_by' value can be a valid field name."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1955
|
||
msgid "The groupby defined above allows to group data by category."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1957
|
||
msgid "When the field is of type ``date`` or ``datetime``, the filter generates a submenu of the Group By menu in which the following interval options are available: day, week, month, quarter, year."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1960
|
||
msgid "In case the filter is in the default set of filters activated at the view initialization, the records are grouped by month by default. This can be changed by using the syntax 'date_field:interval' as in the following example."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1971
|
||
msgid "The results of read_groups grouped on a field may be influenced by its group_expand attribute, allowing to display empty groups when needed. For more information, please refer to :class:`~odoo.fields.Field` attributes documentation."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1976
|
||
msgid "logical name for the filter, can be used to :ref:`enable it by default <reference/views/search/defaults>`, can also be used as :ref:`inheritance hook <reference/views/inheritance>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1980
|
||
msgid "a longer explanatory text for the filter, may be displayed as a tooltip"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1983
|
||
msgid "makes a filter only available to specific users"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1989
|
||
msgid "Sequences of filters (without non-filters separating them) are treated as inclusively composited: they will be composed with ``OR`` rather than the usual ``AND``, e.g."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:1998
|
||
msgid "if both filters are selected, will select the records whose ``state`` is ``draft`` or ``done``, but"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2007
|
||
msgid "if both filters are selected, will select the records whose ``state`` is ``draft`` **and** ``delay`` is below 15."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2011
|
||
msgid "can be used to separates groups of filters in simple search views"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2014
|
||
msgid "can be used to separate groups of filters, more readable than ``separator`` in complex search views"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2091
|
||
msgid "``searchpanel``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2018
|
||
msgid "allows to display a search panel on the left of any multi records view. By default, the list and kanban views have the searchpanel enabled. The search panel can be activated on other views with the attribute:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2022
|
||
msgid "``view_types`` a comma separated list of view types on which to enable the search panel default: 'tree,kanban'"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2025
|
||
msgid "This tool allows to quickly filter data on the basis of given fields. The fields are specified as direct children of the ``searchpanel`` with tag name ``field``, and the following attributes:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2029
|
||
msgid "``name`` (mandatory) the name of the field to filter on"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2031
|
||
msgid "``select`` determines the behavior and display. Possible values are"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2033
|
||
msgid "``one`` (default) at most one value can be selected. Supported field types are many2one and selection."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2036
|
||
msgid "``multi`` several values can be selected (checkboxes). Supported field types are many2one, many2many and selection."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2039
|
||
msgid "``groups``: restricts to specific users"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2041
|
||
msgid "``string``: determines the label to display"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2043
|
||
msgid "``icon``: specifies which icon is used"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2045
|
||
msgid "``color``: determines the icon color"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2047
|
||
msgid "``enable_counters``: default is false. If set to true the record counters will be computed and displayed if non-zero."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2050
|
||
msgid "This feature has been implemented in case performances would be too bad."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2052
|
||
msgid "Another way to solve performance issues is to properly override the ``search_panel_select_range`` and ``search_panel_select_multi_range`` methods."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2055
|
||
msgid "``expand``: default is false. If set to false categories or filters with 0 records will be hidden."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2057
|
||
msgid "``limit``: default is 200. Integer determining the maximal number of values to fetch for the field. If the limit is reached, no values will be displayed in the search panel and an error message will appear instead because we consider that is useless / bad performance-wise. All values will be fetched if set to 0."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2062
|
||
msgid "Additional optional attributes are available according to the chosen case:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2064
|
||
msgid "For the ``one`` case:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2066
|
||
msgid "``hierarchize``: (only available for many2one fields) default is true. Handles the display style of categories :"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2068
|
||
msgid "If set to true child categories will appear under their related parent. If not, all categories will be displayed on the same level."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2071
|
||
msgid "For the ``multi`` case:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2073
|
||
msgid "``domain``: determines conditions that the comodel records have to satisfy."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2075
|
||
msgid "A domain might be used to express a dependency on another field (with select=\"one\") of the search panel. Consider /!\\ This attribute is incompatible with a select=\"one\" with enabled counters; if a select=\"multi\" has a `domain` attribute, all select=\"one\" will have their counters disabled."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2087
|
||
msgid "In the above example, the range of values for manager_id (manager names) available at screen will depend on the value currently selected for the field ``department_id``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2090
|
||
msgid "``groupby``: field name of the comodel (only available for many2one and many2many fields). Values will be grouped by that field."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2096
|
||
msgid "Search defaults"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2098
|
||
msgid "Search fields and filters can be configured through the action's ``context`` using :samp:`search_default_{name}` keys. For fields, the value should be the value to set in the field, for filters it's a boolean value or a number. For instance, assuming ``foo`` is a field and ``bar`` is a filter an action context of:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2110
|
||
msgid "will automatically enable the ``bar`` filter and search the ``foo`` field for *acro*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2113
|
||
msgid "A numeric value (between 1 and 99) can be used to describe the order of default groupbys. For instance if ``foo`` and ``bar`` refer to two groupbys"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2123
|
||
msgid "has the effect to activate first ``bar`` then ``foo``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/reference/views.rst:2125
|
||
msgid "View Grid"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices.rst:4
|
||
msgid "Web Services"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:5
|
||
msgid "Extract API"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:7
|
||
msgid "Odoo provides a service allowing you to automate the processing of your invoices. The service scans your document using an Optical Character Recognition (OCR) engine and then uses AI-based algorithms to extract the fields of interest such as the total, the due date, or the invoice lines. More functional information can be found on the `demo page <https://www.odoo.com/page/invoice-automation>`_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:11
|
||
msgid "This service is a paid service. Each invoice processing will cost you one credit. Three different sized packs can be bought on `iap.odoo.com <https://iap.odoo.com/iap/in-app-services/259?sortby=date>`_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:13
|
||
msgid "You can either use this service directly in the Odoo Accounting App or through the API. The Extract API which is detailed in the next section allows you to integrate our service directly into your own projects."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:17
|
||
msgid "Invoices"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:18
|
||
msgid "The extract API use the JSON-RPC2_ protocol. The diffent routes are located at the following address: **https://iap-extract.odoo.com**."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:21
|
||
msgid "Expected successful flow"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:23
|
||
msgid "Call :ref:`webservices/extract_api/invoice_parse` to submit your invoices (one call for each invoice). On success, you receive a `document_id` in the response."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:24
|
||
msgid "You then have to regularly poll :ref:`webservices/extract_api/invoice_get_results` to get the document's parsing status."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:25
|
||
msgid "Once the result received, you can validate it by calling :ref:`webservices/extract_api/invoice_validate` and sending the expected values. This step is optional but greatly helps the system to improve."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:28
|
||
msgid "These 3 routes are detailed in this :ref:`section <webservices/extract_api/routes>`. The HTTP POST method should be used for all of them. A python implementation of the full flow can be found :download:`here <files/extract_api_implementation.py>` and a token for integration testing is provided in the :ref:`integration testing section <webservices/extract_api/integration_testing>`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:34
|
||
msgid "Routes"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:39
|
||
msgid "``/iap/invoice_extract/parse``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:43
|
||
msgid "Request a processing of the document from the OCR. The route will return a `document_id` you can use to obtain the result of your request."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:46
|
||
#: ../../content/developer/webservices/extract_api.rst:156
|
||
#: ../../content/developer/webservices/extract_api.rst:387
|
||
msgid "Request Body"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:48
|
||
#: ../../content/developer/webservices/extract_api.rst:158
|
||
#: ../../content/developer/webservices/extract_api.rst:389
|
||
msgid "``jsonrpc`` (required)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:49
|
||
msgid "Must be exactly “2.0”."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:50
|
||
#: ../../content/developer/webservices/extract_api.rst:160
|
||
#: ../../content/developer/webservices/extract_api.rst:391
|
||
msgid "``method`` (required)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:51
|
||
msgid "Must be “call”."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:52
|
||
#: ../../content/developer/webservices/extract_api.rst:162
|
||
msgid "``id`` (required)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:53
|
||
msgid "An identifier established by the client. It allows the client to keep track of which response goes with which request. This makes asynchronous calls easier."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:76
|
||
#: ../../content/developer/webservices/extract_api.rst:397
|
||
msgid "``params``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:55
|
||
msgid "``account_token`` (required)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:56
|
||
msgid "The token of the account from which credits will be taken. Each successful call costs one token."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:58
|
||
msgid "``version`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:58
|
||
msgid "The version will determine the format of your requests and the format of the server response. Some results can be unavailable in older versions. For the current version 1.2.0, send ‘120’. If not specified, the latest version will be used."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:62
|
||
msgid "``documents`` (required)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:61
|
||
msgid "The invoice must be provided as a string in the ASCII encoding. The list should contain only one string. If multiple strings are provided only the first string corresponding to a pdf will be processed. If no pdf is found, the first string will be processed. This field is a list only for legacy reasons. The supported extensions are *pdf*, *png*, *jpg* and *bmp*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:76
|
||
msgid "``user_infos`` (required)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:65
|
||
msgid "Information concerning the person to whom the invoice is intended. This informations is not required in order for the service to work but it greatly improves the quality of the result."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:67
|
||
msgid "``user_company_vat`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:68
|
||
msgid "VAT number of the client."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:69
|
||
msgid "``user_company_name`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:70
|
||
msgid "Name of the client’s company."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:71
|
||
msgid "``user_company_country_code`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:72
|
||
msgid "Country code of the client. Format: `ISO3166 alpha-2 <https://www.iban.com/country-codes>`_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:73
|
||
msgid "``user_lang`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:74
|
||
msgid "The client language. Format: *language_code + _ + locale* (ex: fr_FR, en_US)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:76
|
||
msgid "``user_email`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:76
|
||
msgid "The client email."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:105
|
||
#: ../../content/developer/webservices/extract_api.rst:190
|
||
#: ../../content/developer/webservices/extract_api.rst:502
|
||
msgid "``jsonrpc``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:106
|
||
msgid "A string specifying the version of the JSON-RPC protocol. It will be “2.0”."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:108
|
||
msgid "The identifier you set in the request body."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:115
|
||
#: ../../content/developer/webservices/extract_api.rst:202
|
||
#: ../../content/developer/webservices/extract_api.rst:510
|
||
msgid "``result``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:110
|
||
#: ../../content/developer/webservices/extract_api.rst:197
|
||
#: ../../content/developer/webservices/extract_api.rst:507
|
||
msgid "``status_code``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:111
|
||
#: ../../content/developer/webservices/extract_api.rst:198
|
||
#: ../../content/developer/webservices/extract_api.rst:508
|
||
msgid "|STATUS_CODE|"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:112
|
||
#: ../../content/developer/webservices/extract_api.rst:199
|
||
#: ../../content/developer/webservices/extract_api.rst:510
|
||
msgid "``status_msg``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:113
|
||
#: ../../content/developer/webservices/extract_api.rst:200
|
||
#: ../../content/developer/webservices/extract_api.rst:510
|
||
msgid "|STATUS_MSG|"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:115
|
||
msgid "``document_id``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:115
|
||
#: ../../content/developer/webservices/extract_api.rst:202
|
||
msgid "Only present if the request is successful."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:117
|
||
msgid "The API does not actually use the JSON-RPC error scheme. Instead the API has its own error scheme bundled inside a successful JSON-RPC result."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:120
|
||
#: ../../content/developer/webservices/extract_api.rst:207
|
||
#: ../../content/developer/webservices/extract_api.rst:513
|
||
msgid "status_code"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:120
|
||
#: ../../content/developer/webservices/extract_api.rst:207
|
||
#: ../../content/developer/webservices/extract_api.rst:513
|
||
msgid "status_msg"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:122
|
||
#: ../../content/developer/webservices/extract_api.rst:209
|
||
#: ../../content/developer/webservices/extract_api.rst:515
|
||
msgid "0"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:122
|
||
#: ../../content/developer/webservices/extract_api.rst:209
|
||
#: ../../content/developer/webservices/extract_api.rst:515
|
||
msgid "Success"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:123
|
||
#: ../../content/developer/webservices/extract_api.rst:211
|
||
msgid "2"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:123
|
||
#: ../../content/developer/webservices/extract_api.rst:211
|
||
msgid "An error occured"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:124
|
||
msgid "3"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:124
|
||
msgid "You don't have enough credit"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:125
|
||
msgid "6"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:125
|
||
msgid "Unsupported file format"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:126
|
||
#: ../../content/developer/webservices/extract_api.rst:212
|
||
msgid "9"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:126
|
||
#: ../../content/developer/webservices/extract_api.rst:212
|
||
msgid "Server is currently under maintenance. Please try again later."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:149
|
||
msgid "``/iap/invoice_extract/get_results``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:153
|
||
msgid "Request the results of the documents ids obtained with the :ref:`/parse <webservices/extract_api/invoice_parse>` route. Can either return the results or a \"request pending\" message."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:159
|
||
#: ../../content/developer/webservices/extract_api.rst:161
|
||
#: ../../content/developer/webservices/extract_api.rst:163
|
||
#: ../../content/developer/webservices/extract_api.rst:166
|
||
#: ../../content/developer/webservices/extract_api.rst:191
|
||
#: ../../content/developer/webservices/extract_api.rst:193
|
||
#: ../../content/developer/webservices/extract_api.rst:390
|
||
#: ../../content/developer/webservices/extract_api.rst:392
|
||
#: ../../content/developer/webservices/extract_api.rst:503
|
||
#: ../../content/developer/webservices/extract_api.rst:505
|
||
msgid "|SAME_AS_PARSE|"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:168
|
||
msgid "``params``:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:165
|
||
msgid "``version`` (required)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:168
|
||
msgid "``documents_ids`` (required)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:168
|
||
msgid "The list of ``document_id`` for which you want to get the current parsing status."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:195
|
||
msgid "Dictionary where each key is a document_id. For each ``document_id``:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:202
|
||
msgid "``results``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:204
|
||
msgid "result keys are strings despite the fact that the document_ids given in the request body are integers."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:210
|
||
msgid "1"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:210
|
||
msgid "Not ready"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:248
|
||
msgid "``feature_result``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:250
|
||
msgid "Each field of interest we want to extract from the invoice such as the total or the due date are also called features. An exhaustive list of all the extracted features can be found in the table below."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:252
|
||
msgid "For each feature, we return a list of candidates and we spotlight the candidate our model predicts to be the best fit for the feature."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:254
|
||
msgid "``selected_value``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:255
|
||
msgid "The best candidate for this feature."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:257
|
||
msgid "``words``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:257
|
||
msgid "List of all the candidates for this feature ordered by decreasing score."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:272
|
||
msgid "``candidate``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:274
|
||
msgid "For each candidate we give its representation and position in the document. Candidates are sorted by decreasing order of suitability."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:276
|
||
msgid "``content``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:277
|
||
msgid "Representation of the candidate."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:279
|
||
msgid "``coords``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:279
|
||
msgid "``[center_x, center_y, width, height, rotation_angle]``. The position and dimensions are relative to the size of the page and are therefore between 0 and 1. The angle is a clockwise rotation measured in degrees."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:282
|
||
msgid "Page of the original document on which the candidate is located (starts at 0)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:297
|
||
msgid "Feature name"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:297
|
||
msgid "Specifities"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:299
|
||
msgid "``SWIFT_code``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:299
|
||
msgid "**content** is a dictionary encoded as a string."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:301
|
||
msgid "It contains information about the detected SWIFT code (or `BIC <https://www.iso9362.org/isobic/overview.html>`_)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:304
|
||
msgid "Keys:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:306
|
||
msgid "``bic``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:307
|
||
msgid "detected BIC (string)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:309
|
||
msgid "bank name (string)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:310
|
||
msgid "``country_code``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:311
|
||
msgid "ISO3166 alpha-2 country code of the bank (string)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:312
|
||
msgid "``city`` (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:313
|
||
msgid "city of the bank (string)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:315
|
||
msgid "``verified_bic``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:315
|
||
msgid "True if the BIC has been found in our DB (bool)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:317
|
||
msgid "Name and city are present only if verified_bic is true."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:319
|
||
msgid "``VAT_Number``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:319
|
||
#: ../../content/developer/webservices/extract_api.rst:321
|
||
#: ../../content/developer/webservices/extract_api.rst:323
|
||
#: ../../content/developer/webservices/extract_api.rst:325
|
||
#: ../../content/developer/webservices/extract_api.rst:339
|
||
#: ../../content/developer/webservices/extract_api.rst:345
|
||
msgid "**content** is a string"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:321
|
||
msgid "``country``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:323
|
||
msgid "``currency``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:325
|
||
msgid "``date``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:327
|
||
msgid "Format : *YYYY-MM-DD HH:MM:SS*"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:329
|
||
msgid "``due_date``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:329
|
||
msgid "Same as for ``date``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:331
|
||
msgid "``global_taxes``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:331
|
||
#: ../../content/developer/webservices/extract_api.rst:337
|
||
#: ../../content/developer/webservices/extract_api.rst:341
|
||
#: ../../content/developer/webservices/extract_api.rst:343
|
||
msgid "**content** is a float"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:333
|
||
msgid "**candidate** has an additional field ``amount_type``. Its value is always percent."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:335
|
||
msgid "**selected_values** is a list of candidates."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:337
|
||
msgid "``global_taxes_amount``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:339
|
||
msgid "``invoice_id``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:341
|
||
msgid "``subtotal``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:343
|
||
msgid "``total``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:345
|
||
msgid "``supplier``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:349
|
||
msgid "``feature_result`` for the ``invoice_lines`` feature"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:351
|
||
msgid "It follows a more specific structure. It is basically a list of dictionaries where each dictionary represents an invoice line. Each value follows a :ref:`webservices/extract_api/invoice_get_results/feature_result` structure."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:379
|
||
msgid "``/iap/invoice_extract/validate``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:383
|
||
msgid "Route that validates the different features of an invoice. The validation step is an optional step but is strongly recommended. By telling the system if it were right or wrong for each feature you give an important feedback. It has no direct impact but it helps the system to greatly improve its prediction accuracy for the invoices you will send in the future."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:394
|
||
msgid "``documents_id`` (required)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:395
|
||
msgid "Id of the document for which you want to validate the result."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:397
|
||
msgid "``values``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:397
|
||
msgid "Contains the validation for each feature. The field ``merged_line`` indicates if the ``invoice_lines`` have been merged or not."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:399
|
||
msgid "You don't have to validate all the features in order for the validation to succeed. However :ref:`/validate <webservices/extract_api/invoice_validate>` can't be called multiple times for a same invoice. Therefore you should validate all the features you want to validate at once."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:424
|
||
msgid "``validation``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:426
|
||
msgid "A **validation** for a given feature is a dictionary containing the textual representation of the expected value for this given feature. This format apply for all the features except for ``global_taxes`` and ``invoice_lines`` which have more complex validation format."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:438
|
||
msgid "validation for ``global_taxes``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:440
|
||
msgid "**content** is a list of dictionaries. Each dictionary represents a tax:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:442
|
||
msgid "``amount``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:443
|
||
msgid "Amount on which the tax is applied."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:444
|
||
msgid "``tax_amount``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:445
|
||
msgid "Amount of the tax."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:446
|
||
msgid "``tax_amount_type``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:447
|
||
msgid "Indicates if the ``tax_amount`` is a percentage or a fixed value. The type must be specified using the literal string \"fixed\" or \"percent\"."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:449
|
||
msgid "``tax_price_include``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:449
|
||
msgid "Indicates if ``amount`` already contains the tax or not."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:468
|
||
msgid "validation for ``invoice_lines``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:470
|
||
msgid "**lines** is a list of dictionaries. Each dictionary represents an invoice line. The dictionary keys speak for themselves."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:516
|
||
msgid "12"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:516
|
||
msgid "Validation format is incorrect"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:540
|
||
msgid "You can test your integration by using *integration_token* as ``account_token`` in the :ref:`/parse <webservices/extract_api/invoice_parse>` request."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:542
|
||
msgid "Using this token put you in test mode and allows you to simulate the entire flow without really parsing a document and without being billed one credit for each successful invoice parsing."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:544
|
||
msgid "The only technical differences in test mode is that the document you send is not parsed by the system and that the response you get from :ref:`/get_results <webservices/extract_api/invoice_get_results>` is a hard-coded one."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/extract_api.rst:547
|
||
msgid "A python implementation of the full flow can be found :download:`here <files/extract_api_implementation.py>`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:6
|
||
msgid "In-App Purchase"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:8
|
||
msgid "In-App Purchase (IAP) allows providers of ongoing services through Odoo apps to be compensated for ongoing service use rather than — and possibly instead of — a sole initial purchase."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:12
|
||
msgid "In that context, Odoo acts mostly as a *broker* between a client and an Odoo App Developer:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:15
|
||
msgid "Users purchase service tokens from Odoo."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:16
|
||
msgid "Service providers draw tokens from the user's Odoo account when service is requested."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:21
|
||
msgid "This document is intended for *service providers* and presents the latter, which can be done either via direct JSON-RPC2_ or if you are using Odoo using the convenience helpers it provides."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:31
|
||
msgid "The Players"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:33
|
||
msgid "The Service Provider is (probably) you the reader, you will be providing value to the client in the form of a service paid per-use."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:35
|
||
msgid "The Client installed your Odoo App, and from there will request services."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:36
|
||
msgid "Odoo brokers crediting, the Client adds credit to their account, and you can draw credits from there to provide services."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:38
|
||
msgid "The External Service is an optional player: *you* can either provide a service directly, or you can delegate the actual service acting as a bridge/translator between an Odoo system and the actual service."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:46
|
||
msgid "The Credits"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:48
|
||
msgid "The credits went from integer to float value starting **October 2018**. Integer values are still supported."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:51
|
||
msgid "Every service provided through the IAP platform can be used by the clients with tokens or *credits*. The credits are an float unit and their monetary value depends on the service and is decided by the provider. This could be:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:56
|
||
msgid "for an sms service: 1 credit = 1 sms;"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:57
|
||
msgid "for an ad service: 1 credit = 1 ad; or"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:58
|
||
msgid "for a postage service: 1 credit = 1 post stamp."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:60
|
||
msgid "A credit can also simply be associated with a fixed amount of money to palliate the variations of price (e.g. the prices of sms and stamps may vary following the countries)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:64
|
||
msgid "The value of the credits is fixed with the help of prepaid credit packs that the clients can buy on https://iap.odoo.com (see :ref:`Packs <iap-packages>`)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:67
|
||
msgid "In the following explanations we will ignore the External Service, they are just a detail of the service you provide."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:73
|
||
msgid "'Normal' service flow"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:75
|
||
msgid "If everything goes well, the normal flow is the following:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:77
|
||
msgid "The Client requests a service of some sort."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:78
|
||
msgid "The Service Provider asks Odoo if there are enough credits for the service in the Client's account, and creates a transaction over that amount."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:81
|
||
msgid "The Service Provider provides the service (either on their own or calling to External Services)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:83
|
||
msgid "The Service Provider goes back to Odoo to capture (if the service could be provided) or cancel (if the service could not be provided) the transaction created at step 2."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:86
|
||
msgid "Finally, the Service Provider notifies the Client that the service has been rendered, possibly (depending on the service) displaying or storing its results in the client's system."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:93
|
||
msgid "Insufficient credits"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:95
|
||
msgid "However, if the Client's account lacks credits for the service, the flow will be as follows:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:97
|
||
msgid "The Client requests a service as previously."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:98
|
||
msgid "The Service Provider asks Odoo if there are enough credits on the Client's account and gets a negative reply."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:100
|
||
msgid "This is signaled back to the Client."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:101
|
||
msgid "Who is redirected to their Odoo account to credit it and re-try."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:105
|
||
msgid "Building your service"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:107
|
||
msgid "For this example, the service we will provide is ~~mining dogecoins~~ burning 10 seconds of CPU for a credit. For your own services, you could, for example:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:110
|
||
msgid "provide an online service yourself (e.g. convert quotations to faxes for business in Japan);"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:112
|
||
msgid "provide an *offline* service yourself (e.g. provide accountancy service); or"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:113
|
||
msgid "act as intermediary to an other service provider (e.g. bridge to an MMS gateway)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:119
|
||
msgid "Register the service on Odoo"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:121
|
||
msgid "complete this part with screenshots"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:123
|
||
msgid "The first step is to register your service on the IAP endpoint (production and/or test) before you can actually query user accounts. To create a service, go to your *Portal Account* on the IAP endpoint (https://iap.odoo.com for production, https://iap-sandbox.odoo.com for testing, the endpoints are *independent* and *not synchronized*). Alternatively, you can go to your portal on Odoo (https://iap.odoo.com/my/home) and select *In-App Services*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:132
|
||
msgid "On production, there is a manual validation step before the service can be used to manage real transactions. This step is automatically passed when on sandbox to ease the tests."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:136
|
||
msgid "Log in then go to :menuselection:`My Account --> Your In-App Services`, click Create and provide the informations of your service."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:140
|
||
msgid "The service has *seven* important fields:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:142
|
||
msgid ":samp:`name` - :class:`ServiceName`: This is the string you will need to provide inside the client's :ref:`app <iap-odoo-app>` when requesting a transaction from Odoo. (e.g. :class:`self.env['iap.account].get(name)`). As good practice, this should match the technical name of your app."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:147
|
||
msgid ":samp:`label` - :class:`Label`: The name displayed on the shopping portal for the client."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:152
|
||
msgid "Both the :class:`ServiceName` and :class:`Label` are unique. As good practice, the :class:`ServiceName` should usually match the name of your Odoo Client App."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:155
|
||
msgid ":samp:`icon` - :class:`Icon`: A generic icon that will serve as default for your :ref:`packs <iap-packages>`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:158
|
||
msgid ":samp:`key` - :class:`ServiceKey`: The developer key that identifies you in IAP (see :ref:`your service <iap-service>`) and allows to draw credits from the client's account. It will be shown only once upon creation of the service and can be regenerated at will."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:164
|
||
msgid "Your :class:`ServiceKey` *is a secret*, leaking your service key allows other application developers to draw credits bought for your service(s)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:168
|
||
msgid ":samp:`trial credits` - :class:`Float`: This corresponds to the credits you are ready to offer upon first use to your app users. Note that such service will only be available to clients that have an active enterprise contract."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:172
|
||
msgid ":samp:`privacy policy` - :class:`PrivacyPolicy`: This is an url to the privacy policy of your service. This should explicitly mention the **information you collect**, how you **use it, its relevance** to make your service work and inform the client on how they can **access, update or delete their personal information**."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:189
|
||
msgid "You can then create *credit packs* which clients can purchase in order to use your service."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:195
|
||
msgid "Packs"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:197
|
||
msgid "A credit pack is essentially a product with five characteristics:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:199
|
||
msgid "Name: name of the pack,"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:200
|
||
msgid "Icon: specific icon for the pack (if not provided, it will fallback on the service icon),"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:201
|
||
msgid "Description: details on the pack that will appear on the shop page as well as the invoice,"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:203
|
||
msgid "Amount: amount of credits the client is entitled to when buying the pack,"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:204
|
||
msgid "Price: price in EUR (for the time being, USD support is planned)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:208
|
||
msgid "Odoo takes a 25% commission on all pack sales. Adjust your selling price accordingly."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:213
|
||
msgid "Depending on the strategy, the price per credit may vary from one pack to another."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:223
|
||
msgid "Odoo App"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:225
|
||
msgid "does this actually require apps?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:227
|
||
msgid "The second step is to develop an `Odoo App`_ which clients can install in their Odoo instance and through which they can *request* the services you provide. Our app will just add a button to the Partners form which lets a user request burning some CPU time on the server."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:232
|
||
msgid "First, we will create an *odoo module* depending on ``iap``. IAP is a standard V11 module and the dependency ensures a local account is properly set up and we will have access to some necessary views and useful helpers."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:236
|
||
#: ../../content/developer/webservices/iap.rst:251
|
||
msgid "`coalroller/__manifest__.py`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:246
|
||
msgid "Second, the \"local\" side of the integration. Here we will only be adding an action button to the partners view, but you can of course provide significant local value via your application and additional parts via a remote service."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:264
|
||
msgid "`coalroller/views/res_partner_views.xml`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:289
|
||
msgid "We can now implement the action method/callback. This will *call our own server*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:292
|
||
msgid "There are no requirements when it comes to the server or the communication protocol between the app and our server, but ``iap`` provides a :func:`~odoo.addons.iap.tools.iap_tools.iap_jsonrpc` helper to call a JSON-RPC2_ endpoint on an other Odoo instance and transparently re-raise relevant Odoo exceptions (:class:`~odoo.addons.iap.tools.iap_tools.InsufficientCreditError`, :class:`odoo.exceptions.AccessError` and :class:`odoo.exceptions.UserError`)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:299
|
||
msgid "In that call, we will need to provide:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:301
|
||
msgid "any relevant client parameter (none here),"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:302
|
||
msgid "the :class:`token <UserToken>` of the current client that is provided by the ``iap.account`` model's ``account_token`` field. You can retrieve the account for your service by calling :samp:`env['iap.account'].get({service_name})` where :class:`service_name <ServiceName>` is the name of the service registered on IAP endpoint."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:308
|
||
msgid "`coalroller/models/res_partner.py`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:336
|
||
msgid "``iap`` automatically handles :class:`~odoo.addons.iap.tools.iap_tools.InsufficientCreditError` coming from the action and prompts the user to add credits to their account."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:340
|
||
msgid ":func:`~odoo.addons.iap.tools.iap_tools.iap_jsonrpc` takes care of re-raising :class:`~odoo.addons.iap.models.iap.InsufficientCreditError` for you."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:345
|
||
msgid "If you are not using :func:`~odoo.addons.iap.tools.iap_tools.iap_jsonrpc` you *must* be careful to re-raise :class:`~odoo.addons.iap.tools.iap_tools.InsufficientCreditError` in your handler otherwise the user will not be prompted to credit their account, and the next call will fail the same way."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:356
|
||
msgid "Though that is not *required*, since ``iap`` provides both a client helper for JSON-RPC2_ calls (:func:`~odoo.addons.iap.tools.iap_tools.iap_jsonrpc`) and a service helper for transactions (:class:`~odoo.addons.iap.tools.iap_tools.iap_charge`) we will also be implementing the service side as an Odoo module:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:361
|
||
#: ../../content/developer/webservices/iap.rst:449
|
||
msgid "`coalroller_service/__manifest__.py`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:371
|
||
msgid "Since the query from the client comes as JSON-RPC2_ we will need the corresponding controller which can call :class:`~odoo.addons.iap.tools.iap_tools.iap_charge` and perform the service within:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:375
|
||
#: ../../content/developer/webservices/iap.rst:462
|
||
msgid "`coalroller_service/controllers/main.py`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:407
|
||
msgid "for the actual IAP will the \"portal\" page be on odoo.com or iap.odoo.com?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:409
|
||
msgid "\"My Account\" > \"Your InApp Services\"?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:412
|
||
msgid "The :class:`~odoo.addons.iap.tools.iap_tools.iap_charge` helper will:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:414
|
||
msgid "authorize (create) a transaction with the specified number of credits, if the account does not have enough credits it will raise the relevant error"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:417
|
||
msgid "execute the body of the ``with`` statement"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:418
|
||
msgid "if the body of the ``with`` executes successfully, update the price of the transaction if needed"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:420
|
||
msgid "capture (confirm) the transaction"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:421
|
||
msgid "otherwise, if an error is raised from the body of the ``with``, cancel the transaction (and release the hold on the credits)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:426
|
||
msgid "By default, :class:`~odoo.addons.iap.tools.iap_tools.iap_charge` contacts the *production* IAP endpoint, https://iap.odoo.com. While developing and testing your service you may want to point it towards the *development* IAP endpoint https://iap-sandbox.odoo.com."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:431
|
||
msgid "To do so, set the ``iap.endpoint`` config parameter in your service Odoo: in debug/developer mode, :menuselection:`Setting --> Technical --> Parameters --> System Parameters`, just define an entry for the key ``iap.endpoint`` if none already exists)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:436
|
||
msgid "The :class:`~odoo.addons.iap.tools.iap_tools.iap_charge` helper has two additional optional parameters we can use to make things clearer to the end-user."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:440
|
||
msgid "is a message which will be associated with the transaction and will be displayed in the user's dashboard, it is useful to remind the user why the charge exists."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:447
|
||
msgid "``credit_template``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:444
|
||
msgid "is the name of a :ref:`reference/qweb` template which will be rendered and shown to the user if their account has less credit available than the service provider is requesting, its purpose is to tell your users why they should be interested in your IAP offers."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:487
|
||
msgid "`coalroller_service/views/no-credit.xml`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:510
|
||
msgid "how do you test your service?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:513
|
||
msgid "JSON-RPC2_ Transaction API"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:518
|
||
msgid "The IAP transaction API does not require using Odoo when implementing your server gateway, calls are standard JSON-RPC2_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:520
|
||
msgid "Calls use different *endpoints* but the same *method* on all endpoints (``call``)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:522
|
||
msgid "Exceptions are returned as JSON-RPC2_ errors, the formal exception name is available on ``data.name`` for programmatic manipulation."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:525
|
||
msgid "`iap.odoo.com documentation`_ for additional information."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:528
|
||
#: ../../content/developer/webservices/iap.rst:770
|
||
msgid "Authorize"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:532
|
||
msgid "Verifies that the user's account has at least as ``credit`` available *and creates a hold (pending transaction) on that amount*."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:535
|
||
msgid "Any amount currently on hold by a pending transaction is considered unavailable to further authorize calls."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:538
|
||
msgid "Returns a :class:`TransactionToken` identifying the pending transaction which can be used to capture (confirm) or cancel said transaction (`iap.odoo.com documentation`_)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:544
|
||
msgid "optional, helps users identify the reason for charges on their account"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:546
|
||
msgid "optional, allows the user to benefit from trial credits if his database is eligible (see :ref:`Service registration <register-service>`)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:548
|
||
msgid ":class:`TransactionToken` if the authorization succeeded"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:0
|
||
#: ../../content/developer/webservices/iap.rst:0
|
||
#: ../../content/developer/webservices/iap.rst:0
|
||
#: ../../content/developer/webservices/iap.rst:0
|
||
#: ../../content/developer/webservices/iap.rst:0
|
||
msgid "raises"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:549
|
||
msgid ":class:`~odoo.exceptions.AccessError` if the service token is invalid"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:550
|
||
msgid ":class:`~odoo.addons.iap.models.iap.InsufficientCreditError` if the account does not have enough credits"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:551
|
||
msgid "``TypeError`` if the ``credit`` value is not an integer or a float"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:573
|
||
#: ../../content/developer/webservices/iap.rst:849
|
||
msgid "Capture"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:577
|
||
msgid "Confirms the specified transaction, transferring the reserved credits from the user's account to the service provider's."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:580
|
||
msgid "Capture calls are idempotent: performing capture calls on an already captured transaction has no further effect."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:585
|
||
msgid "optional parameter to capture a smaller amount of credits than authorized"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:586
|
||
#: ../../content/developer/webservices/iap.rst:618
|
||
msgid ":class:`~odoo.exceptions.AccessError`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:606
|
||
#: ../../content/developer/webservices/iap.rst:811
|
||
msgid "Cancel"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:610
|
||
msgid "Cancels the specified transaction, releasing the hold on the user's credits."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:613
|
||
msgid "Cancel calls are idempotent: performing capture calls on an already cancelled transaction has no further effect."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:636
|
||
msgid "Types"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:638
|
||
msgid "Exceptions aside, these are *abstract types* used for clarity, you should not care how they are implemented."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:643
|
||
msgid "String identifying your service on https://iap.odoo.com (production) as well as the account related to your service in the client's database."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:648
|
||
msgid "Identifier generated for the provider's service. Each key (and service) matches a token of a fixed value, as generated by the service provide."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:651
|
||
msgid "Multiple types of tokens correspond to multiple services. As an exampe, SMS and MMS could either be the same service (with an MMS being 'worth' multiple SMS) or could be separate services at separate price points."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:655
|
||
msgid "Your service key *is a secret*, leaking your service key allows other application developers to draw credits bought for your service(s)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:661
|
||
msgid "Identifier for a user account."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:665
|
||
msgid "Transaction identifier, returned by the authorization process and consumed by either capturing or cancelling the transaction."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:670
|
||
msgid "Raised during transaction authorization if the credits requested are not currently available on the account (either not enough credits or too many pending transactions/existing holds)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:677
|
||
msgid "Raised by:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:679
|
||
msgid "any operation to which a service token is required, if the service token is invalid; or"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:680
|
||
msgid "any failure in an inter-server call. (typically, in :func:`~odoo.addons.iap.tools.iap_tools.iap_jsonrpc`)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:685
|
||
msgid "Raised by any unexpected behaviour at the discretion of the App developer (*you*)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:689
|
||
msgid "Test the API"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:691
|
||
msgid "In order to test the developped app, we propose a sandbox platform that allows you to:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:693
|
||
msgid "Test the whole flow from the client's point of view - Actual services and transactions that can be consulted. (again this requires to change the endpoint, see the danger note in :ref:`Service <iap-service>`)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:696
|
||
msgid "Test the API."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:698
|
||
msgid "The latter consists in specific tokens that will work on **IAP-Sandbox only**."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:700
|
||
msgid "Token ``000000``: Represents a non-existing account. Returns an :class:`~odoo.addons.iap.tools.iap_tools.InsufficientCreditError` on authorize attempt."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:702
|
||
msgid "Token ``000111``: Represents an account without sufficient credits to perform any service. Returns an :class:`~odoo.addons.iap.tools.iap_tools.InsufficientCreditError` on authorize attempt."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:704
|
||
msgid "Token ``111111``: Represents an account with enough credits to perform any service. An authorize attempt will return a dummy transacion token that is processed by the capture and cancel routes."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:710
|
||
msgid "Those tokens are only active on the IAP-Sanbox server."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:711
|
||
msgid "The service key is completely ignored with this flow, If you want to run a robust test of your service, you should ignore these tokens."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:715
|
||
msgid "Odoo Helpers"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:717
|
||
msgid "For convenience, if you are implementing your service using Odoo the ``iap`` module provides a few helpers to make IAP flow even simpler."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:723
|
||
msgid "Charging"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:727
|
||
msgid "A *context manager* for authorizing and automatically capturing or cancelling transactions for use in the backend/proxy."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:730
|
||
msgid "Works much like e.g. a cursor context manager:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:732
|
||
msgid "immediately authorizes a transaction with the specified parameters;"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:733
|
||
msgid "executes the ``with`` body;"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:734
|
||
msgid "if the body executes in full without error, captures the transaction;"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:735
|
||
msgid "otherwise cancels it."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:737
|
||
#: ../../content/developer/webservices/iap.rst:776
|
||
#: ../../content/developer/webservices/iap.rst:817
|
||
#: ../../content/developer/webservices/iap.rst:855
|
||
msgid "used to retrieve the ``iap.endpoint`` configuration key"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:774
|
||
msgid "Will authorize everything."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:815
|
||
msgid "Will cancel an authorized transaction."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/iap.rst:853
|
||
msgid "Will capture the amount ``credit`` on the given transaction."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:4
|
||
msgid "Creating a Localization"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:8
|
||
msgid "This tutorial requires knowledges about how to build a module in Odoo (see :doc:`../howtos/backend`)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:12
|
||
msgid "Building a localization module"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:14
|
||
msgid "When installing the ``accounting`` module, the localization module corresponding to the country code of the company is installed automatically. In case of no country code set or no localization module found, the ``l10n_generic_coa`` (US) localization module is installed by default."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:17
|
||
msgid "For example, ``l10n_be`` will be installed if the company has ``Belgium`` as country."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:19
|
||
msgid "This behavior is allowed by the presence of a *.xml* file containing the following code:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:27
|
||
msgid "Where ``module.template_xmlid`` is the **fully-qualified** xmlid of the corresponding template."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:29
|
||
msgid "Usually located in the ``data`` folder, it must be loaded at the very last in the ``__manifest__.py`` file."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:33
|
||
msgid "If the *.xml* file is missing, the right chart of accounts won't be loaded on time!"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:37
|
||
msgid "Configuring my own Chart of Accounts?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:39
|
||
msgid "First of all, before I proceed, we need to talk about the templates. A template is a record that allows replica of itself. This mechanism is needed when working in multi-companies. For example, the creation of a new account is done using the ``account.account.template`` model. However, each company using this chart of accounts will be linked to a replica having ``account.account`` as model. So, the templates are never used directly by the company."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:44
|
||
msgid "Then, when a chart of accounts needs to be installed, all templates dependent of this one will create a replica and link this newly generated record to the company's user. It means all such templates must be linked to the chart of accounts in some way. To do so, each one must reference the desired chart of accounts using the ``chart_template_id`` field. For this reason, we need to define an instance of the ``account.chart.template`` model before creating its templates."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:87
|
||
msgid "For example, let's take a look to the Belgium chart of accounts."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:99
|
||
msgid "Now that the chart of accounts is created, we can focus on the creation of the templates. As said previously, each record must reference this record through the ``chart_template_id`` field. If not, the template will be ignored. The following sections show in details how to create these templates."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:104
|
||
msgid "Adding a new account to my Chart of Accounts"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:106
|
||
msgid "It's time to create our accounts. It consists to creating records of ``account.account.template`` type. Each ``account.account.template`` is able to create an ``account.account`` for each company."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:137
|
||
msgid "Some of the described fields above deserve a bit more explanation."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:139
|
||
msgid "The ``user_type_id`` field requires a value of type ``account.account.type``. Although some additional types could be created in a localization module, we encourage the usage of the existing types in the `account/data/data_account_type.xml <https://github.com/odoo/odoo/blob/14.0/addons/account/data/data_account_type.xml>`_ file. The usage of these generic types ensures the generic reports working correctly in addition to those that you could create in your localization module."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:145
|
||
msgid "Avoid the usage of liquidity ``account.account.type``! Indeed, the bank & cash accounts are created directly at the installation of the localization module and then, are linked to an ``account.journal``."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:150
|
||
msgid "Only one account of type payable/receivable is enough."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:152
|
||
msgid "Although the ``tag_ids`` field is optional, this one remains a very powerful feature. Indeed, this one allows you to define some tags for your accounts to spread them correctly on your reports. For example, suppose you want to create a financial report having multiple lines but you have no way to find a rule to dispatch the accounts according their ``code`` or ``name``. The solution is the usage of tags, one for each report line, to spread and aggregate your accounts like you want."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:157
|
||
msgid "Like any other record, a tag can be created with the following xml structure:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:170
|
||
msgid "As you can well imagine with the usage of tags, this feature can also be used with taxes."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:172
|
||
msgid "An examples coming from the ``l10n_be`` module:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:185
|
||
msgid "Don't create too much accounts: 200-300 is enough."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:188
|
||
msgid "Adding a new tax to my Chart of Accounts"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:190
|
||
msgid "To create a new tax record, you just need to follow the same process as the creation of accounts. The only difference being that you must use the ``account.tax.template`` model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:271
|
||
msgid "An example found in the ``l10n_pl`` module:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:290
|
||
msgid "Adding a new fiscal position to my Chart of Accounts"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:294
|
||
msgid "If you need more information about what is a fiscal position and how it works in Odoo, please refer to :doc:`/applications/finance/accounting/taxation/taxes/fiscal_positions`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:297
|
||
msgid "To create a new fiscal position, simply use the ``account.fiscal.position.template`` model:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:313
|
||
msgid "Adding the properties to my Chart of Accounts"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:315
|
||
msgid "When the whole accounts are generated, you have the possibility to override the newly generated chart of accounts by adding some properties that correspond to default accounts used in certain situations. This must be done after the creation of accounts before each one must be linked to the chart of accounts."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:348
|
||
msgid "For example, let's come back to the Belgium PCMN. This chart of accounts is override in this way to add some properties."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:363
|
||
msgid "How to create a new bank operation model?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:367
|
||
msgid "How a bank operation model works exactly in Odoo? See :doc:`/applications/finance/accounting/bank/reconciliation/reconciliation_models`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:369
|
||
msgid "Since ``V10``, a new feature is available in the bank statement reconciliation widget: the bank operation model. This allows the user to pre-fill some accounting entries with a single click. The creation of an ``account.reconcile.model.template`` record is quite easy:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:415
|
||
msgid "How to create a new dynamic report?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:417
|
||
msgid "If you need to add some reports on your localization, you need to create a new module named **l10n_xx_reports**. Furthermore, this additional module must be present in the ``enterprise`` repository and must have at least two dependencies, one to bring all the stuff for your localization module and one more, ``account_reports``, to design dynamic reports."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/localization.rst:425
|
||
msgid "Once it's done, you can start the creation of your report statements. The documentation is available in the following `slides <https://www.odoo.com/slides/slide/how-to-create-custom-accounting-report-415>`_."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:5
|
||
msgid "External API"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:7
|
||
msgid "Odoo is usually extended internally via modules, but many of its features and all of its data are also available from the outside for external analysis or integration with various tools. Part of the :ref:`reference/orm/model` API is easily available over XML-RPC_ and accessible from a variety of languages."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:23
|
||
msgid "Connection"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:88
|
||
msgid "Configuration"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:90
|
||
msgid "If you already have an Odoo server installed, you can just use its parameters"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:95
|
||
msgid "For Odoo Online instances (<domain>.odoo.com), users are created without a *local* password (as a person you are logged in via the Odoo Online authentication system, not by the instance itself). To use XML-RPC on Odoo Online instances, you will need to set a password on the user account you want to use:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:101
|
||
msgid "Log in your instance with an administrator account"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:102
|
||
msgid "Go to :menuselection:`Settings --> Users --> Users`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:103
|
||
msgid "Click on the user you want to use for XML-RPC access"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:104
|
||
msgid "Click the :guilabel:`Change Password` button"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:105
|
||
msgid "Set a :guilabel:`New Password` value then click :guilabel:`Change Password`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:108
|
||
msgid "The *server url* is the instance's domain (e.g. *https://mycompany.odoo.com*), the *database name* is the name of the instance (e.g. *mycompany*). The *username* is the configured user's login as shown by the *Change Password* screen."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:146
|
||
msgid "API Keys"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:150
|
||
msgid "Odoo has support for **api keys** and (depending on modules or settings) may **require** these keys to perform webservice operations."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:153
|
||
msgid "The way to use API Keys in your scripts is to simply replace your **password** by the key. The login remains in-use. You should store the API Key as carefully as the password as they essentially provide the same access to your user account (although they can not be used to log-in via the interface)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:158
|
||
msgid "In order to add a key to your account, simply go to your :guilabel:`Preferences` (or :guilabel:`My Profile`):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:164
|
||
msgid "then open the :guilabel:`Account Security` tab, and click :guilabel:`New API Key`:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:170
|
||
msgid "Input a description for the key, **this description should be as clear and complete as possible**: it is the only way you will have to identify your keys later and know whether you should remove them or keep them around."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:174
|
||
msgid "Click :guilabel:`Generate Key`, then copy the key provided. **Store this key carefully**: it is equivalent to your password, and just like your password the system will not be able to retrieve or show the key again later on. If you lose this key, you will have to create a new one (and probably delete the one you lost)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:180
|
||
msgid "Once you have keys configured on your account, they will appear above the :guilabel:`New API Key` button, and you will be able to delete them:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:186
|
||
msgid "**A deleted API key can not be undeleted or re-set**. You will have to generate a new key and update all the places where you used the old one."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:190
|
||
msgid "demo"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:192
|
||
msgid "To make exploration simpler, you can also ask https://demo.odoo.com for a test database:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:224
|
||
msgid "These examples use the `Ripcord <https://code.google.com/p/ripcord/>`_ library, which provides a simple XML-RPC API. Ripcord requires that `XML-RPC support be enabled <https://php.net/manual/en/xmlrpc.installation.php>`_ in your PHP installation."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:230
|
||
msgid "Since calls are performed over `HTTPS <https://en.wikipedia.org/wiki/HTTP_Secure>`_, it also requires that the `OpenSSL extension <https://php.net/manual/en/openssl.installation.php>`_ be enabled."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:253
|
||
msgid "These examples use the `Apache XML-RPC library <https://ws.apache.org/xmlrpc/>`_"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:256
|
||
msgid "The examples do not include imports as these imports couldn't be pasted in the code."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:260
|
||
msgid "Logging in"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:262
|
||
msgid "Odoo requires users of the API to be authenticated before they can query most data."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:265
|
||
msgid "The ``xmlrpc/2/common`` endpoint provides meta-calls which don't require authentication, such as the authentication itself or fetching version information. To verify if the connection information is correct before trying to authenticate, the simplest call is to ask for the server's version. The authentication itself is done through the ``authenticate`` function and returns a user identifier (``uid``) used in authenticated calls instead of the login."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:335
|
||
msgid "Calling methods"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:337
|
||
msgid "The second endpoint is ``xmlrpc/2/object``, is used to call methods of odoo models via the ``execute_kw`` RPC function."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:340
|
||
msgid "Each call to ``execute_kw`` takes the following parameters:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:342
|
||
msgid "the database to use, a string"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:343
|
||
msgid "the user id (retrieved through ``authenticate``), an integer"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:344
|
||
msgid "the user's password, a string"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:345
|
||
msgid "the model name, a string"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:346
|
||
msgid "the method name, a string"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:347
|
||
msgid "an array/list of parameters passed by position"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:348
|
||
msgid "a mapping/dict of parameters to pass by keyword (optional)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:352
|
||
msgid "For instance to see if we can read the ``res.partner`` model we can call ``check_access_rights`` with ``operation`` passed by position and ``raise_exception`` passed by keyword (in order to get a true/false result rather than true/error):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:400
|
||
msgid "this should be runnable and checked"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:403
|
||
msgid "List records"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:405
|
||
msgid "Records can be listed and filtered via :meth:`~odoo.models.Model.search`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:407
|
||
msgid ":meth:`~odoo.models.Model.search` takes a mandatory :ref:`domain <reference/orm/domains>` filter (possibly empty), and returns the database identifiers of all records matching the filter. To list customer companies for instance:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:448
|
||
msgid "Pagination"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:450
|
||
msgid "By default a search will return the ids of all records matching the condition, which may be a huge number. ``offset`` and ``limit`` parameters are available to only retrieve a subset of all matched records."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:494
|
||
msgid "Count records"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:496
|
||
msgid "Rather than retrieve a possibly gigantic list of records and count them, :meth:`~odoo.models.Model.search_count` can be used to retrieve only the number of records matching the query. It takes the same :ref:`domain <reference/orm/domains>` filter as :meth:`~odoo.models.Model.search` and no other parameter."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:539
|
||
msgid "calling ``search`` then ``search_count`` (or the other way around) may not yield coherent results if other users are using the server: stored data could have changed between the calls"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:544
|
||
msgid "Read records"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:546
|
||
msgid "Record data is accessible via the :meth:`~odoo.models.Model.read` method, which takes a list of ids (as returned by :meth:`~odoo.models.Model.search`) and optionally a list of fields to fetch. By default, it will fetch all the fields the current user can read, which tends to be a huge amount."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:612
|
||
msgid "Conversedly, picking only three fields deemed interesting."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:652
|
||
msgid "even if the ``id`` field is not requested, it is always returned"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:655
|
||
msgid "Listing record fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:657
|
||
msgid ":meth:`~odoo.models.Model.fields_get` can be used to inspect a model's fields and check which ones seem to be of interest."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:660
|
||
msgid "Because it returns a large amount of meta-information (it is also used by client programs) it should be filtered before printing, the most interesting items for a human user are ``string`` (the field's label), ``help`` (a help text if available) and ``type`` (to know which values to expect, or to send when updating a record):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:739
|
||
msgid "Search and read"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:741
|
||
msgid "Because it is a very common task, Odoo provides a :meth:`~odoo.models.Model.search_read` shortcut which as its name suggests is equivalent to a :meth:`~odoo.models.Model.search` followed by a :meth:`~odoo.models.Model.read`, but avoids having to perform two requests and keep ids around."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:747
|
||
msgid "Its arguments are similar to :meth:`~odoo.models.Model.search`'s, but it can also take a list of ``fields`` (like :meth:`~odoo.models.Model.read`, if that list is not provided it will fetch all fields of matched records):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:826
|
||
msgid "Create records"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:828
|
||
msgid "Records of a model are created using :meth:`~odoo.models.Model.create`. The method will create a single record and return its database identifier."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:831
|
||
msgid ":meth:`~odoo.models.Model.create` takes a mapping of fields to values, used to initialize the record. For any field which has a default value and is not set through the mapping argument, the default value will be used."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:871
|
||
msgid "while most value types are what would be expected (integer for :class:`~odoo.fields.Integer`, string for :class:`~odoo.fields.Char` or :class:`~odoo.fields.Text`),"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:875
|
||
msgid ":class:`~odoo.fields.Date`, :class:`~odoo.fields.Datetime` and :class:`~odoo.fields.Binary` fields use string values"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:877
|
||
msgid ":class:`~odoo.fields.One2many` and :class:`~odoo.fields.Many2many` use a special command protocol detailed in :meth:`the documentation to the write method <odoo.models.Model.write>`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:882
|
||
msgid "Update records"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:884
|
||
msgid "Records can be updated using :meth:`~odoo.models.Model.write`, it takes a list of records to update and a mapping of updated fields to values similar to :meth:`~odoo.models.Model.create`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:888
|
||
msgid "Multiple records can be updated simultanously, but they will all get the same values for the fields being set. It is not currently possible to perform \"computed\" updates (where the value being set depends on an existing value of a record)."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:943
|
||
msgid "Delete records"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:945
|
||
msgid "Records can be deleted in bulk by providing their ids to :meth:`~odoo.models.Model.unlink`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:994
|
||
msgid "Inspection and introspection"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:996
|
||
msgid "``get_external_id`` is kinda crap and may not return an id: it just gets a random existing xid but won't generate one if there is no xid currently associated with the record. And operating with xids isn't exactly fun in RPC."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1001
|
||
msgid "While we previously used :meth:`~odoo.models.Model.fields_get` to query a model and have been using an arbitrary model from the start, Odoo stores most model metadata inside a few meta-models which allow both querying the system and altering models and fields (with some limitations) on the fly over XML-RPC."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1010
|
||
msgid "``ir.model``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1012
|
||
msgid "Provides information about Odoo models via its various fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1015
|
||
msgid "a human-readable description of the model"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1017
|
||
msgid "the name of each model in the system"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1019
|
||
msgid "whether the model was generated in Python code (``base``) or by creating an ``ir.model`` record (``manual``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1022
|
||
msgid "``field_id``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1022
|
||
msgid "list of the model's fields through a :class:`~odoo.fields.One2many` to :ref:`reference/webservice/inspection/fields`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1025
|
||
msgid ":class:`~odoo.fields.One2many` to the :ref:`reference/views` defined for the model"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1029
|
||
msgid "``access_ids``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1028
|
||
msgid ":class:`~odoo.fields.One2many` relation to the :ref:`reference/security/acl` set on the model"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1031
|
||
msgid "``ir.model`` can be used to"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1033
|
||
msgid "query the system for installed models (as a precondition to operations on the model or to explore the system's content)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1035
|
||
msgid "get information about a specific model (generally by listing the fields associated with it)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1037
|
||
msgid "create new models dynamically over RPC"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1041
|
||
msgid "\"custom\" model names must start with ``x_``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1042
|
||
msgid "the ``state`` must be provided and ``manual``, otherwise the model will not be loaded"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1044
|
||
msgid "it is not possible to add new *methods* to a custom model, only fields"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1048
|
||
msgid "a custom model will initially contain only the \"built-in\" fields available on all models:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1155
|
||
msgid "``ir.model.fields``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1157
|
||
msgid "Provides information about the fields of Odoo models and allows adding custom fields without using Python code"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1161
|
||
msgid ":class:`~odoo.fields.Many2one` to :ref:`reference/webservice/inspection/models` to which the field belongs"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1164
|
||
msgid "the field's technical name (used in ``read`` or ``write``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1165
|
||
msgid "``field_description``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1166
|
||
msgid "the field's user-readable label (e.g. ``string`` in ``fields_get``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1167
|
||
msgid "``ttype``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1168
|
||
msgid "the :ref:`type <reference/orm/fields>` of field to create"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1170
|
||
msgid "whether the field was created via Python code (``base``) or via ``ir.model.fields`` (``manual``)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1172
|
||
msgid "``required``, ``readonly``, ``translate``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1173
|
||
msgid "enables the corresponding flag on the field"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1175
|
||
msgid ":ref:`field-level access control <reference/security/fields>`, a :class:`~odoo.fields.Many2many` to ``res.groups``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1179
|
||
msgid "``selection``, ``size``, ``on_delete``, ``relation``, ``relation_field``, ``domain``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1178
|
||
msgid "type-specific properties and customizations, see :ref:`the fields documentation <reference/orm/fields>` for details"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1181
|
||
msgid "Like custom models, only new fields created with ``state=\"manual\"`` are activated as actual fields on the model."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1184
|
||
msgid "computed fields can not be added via ``ir.model.fields``, some field meta-information (defaults, onchange) can not be set either"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/odoo.rst:1187
|
||
msgid "maybe new-API fields could store constant ``default`` in a new column, maybe JSON-encoded?"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:7
|
||
msgid "Database Upgrade"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:12
|
||
msgid "This document describes the API used to upgrade an Odoo database to a higher version."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:15
|
||
msgid "It allows a database to be upgraded without ressorting to the html form at https://upgrade.odoo.com Although the database will follow the same process described on that form."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:20
|
||
msgid "The required steps are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:22
|
||
msgid ":ref:`creating a request <upgrade-api-create-method>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:23
|
||
msgid ":ref:`uploading a database dump <upgrade-api-upload-method>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:24
|
||
msgid ":ref:`running the upgrade process <upgrade-api-process-method>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:25
|
||
msgid ":ref:`obtaining the status of the database request <upgrade-api-status-method>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:26
|
||
msgid ":ref:`downloading the upgraded database dump <upgrade-api-download-method>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:29
|
||
msgid "The methods"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:34
|
||
msgid "Creating a database upgrade request"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:36
|
||
msgid "This action creates a database request with the following information:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:38
|
||
msgid "your contract reference"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:39
|
||
msgid "your email address"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:40
|
||
msgid "the target version (the Odoo version you want to upgrade to)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:41
|
||
msgid "the purpose of your request (test or production)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:42
|
||
msgid "the database dump name (required but purely informative)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:43
|
||
msgid "optionally the server timezone (for Odoo source version < 6.1)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:46
|
||
msgid "The ``create`` method"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:50
|
||
msgid "Creates a database upgrade request"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:52
|
||
msgid "(required) your enterprise contract reference"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:53
|
||
msgid "(required) your email address"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:54
|
||
msgid "(required) the Odoo version you want to upgrade to. Valid choices: 11.0, 12.0, 13.0"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:55
|
||
msgid "(required) the purpose of your upgrade database request. Valid choices: test, production."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:56
|
||
msgid "(required) a purely informative name for you database dump file"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:57
|
||
msgid "(optional) the timezone used by your server. Only for Odoo source version < 6.1"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:58
|
||
#: ../../content/developer/webservices/upgrade.rst:203
|
||
#: ../../content/developer/webservices/upgrade.rst:260
|
||
#: ../../content/developer/webservices/upgrade.rst:387
|
||
#: ../../content/developer/webservices/upgrade.rst:440
|
||
#: ../../content/developer/webservices/upgrade.rst:491
|
||
msgid "request result"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:61
|
||
msgid "The *create* method returns a JSON dictionary containing the following keys:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:66
|
||
#: ../../content/developer/webservices/upgrade.rst:314
|
||
msgid "``failures``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:68
|
||
msgid "The list of errors."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:70
|
||
msgid "A list of dictionaries, each dictionary giving information about one particular error. Each dictionary can contain various keys depending of the type of error but you will always get the ``reason`` and the ``message`` keys:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:74
|
||
msgid "``reason``: the error type"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:75
|
||
msgid "``message``: a human friendly message"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:77
|
||
msgid "Some possible keys:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:79
|
||
msgid "``code``: a faulty value"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:80
|
||
msgid "``value``: a faulty value"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:81
|
||
msgid "``expected``: a list of valid values"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:83
|
||
msgid "See a sample output aside."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:115
|
||
msgid "If the *create* method is successful, the value associated to the *request* key will be a dictionary containing various information about the created request:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:118
|
||
msgid "The most important keys are:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:120
|
||
msgid "``id``: the request id"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:121
|
||
msgid "``key``: your private key for this request"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:123
|
||
msgid "These 2 values will be requested by the other methods (upload, process and status)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:125
|
||
msgid "The other keys will be explained in the section describing the :ref:`status method <upgrade-api-status-method>`."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:129
|
||
msgid "Sample script"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:131
|
||
msgid "Here are 2 examples of database upgrade request creation using:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:133
|
||
msgid "one in the python programming language using the requests library"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:134
|
||
msgid "one in the bash programming language using `curl <https://curl.haxx.se>`_ (tool for transfering data using http) and `jq <https://stedolan.github.io/jq>`_ (JSON processor):"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:184
|
||
msgid "Uploading your database dump"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:186
|
||
msgid "There are 2 methods to upload your database dump:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:188
|
||
msgid "the ``upload`` method using the HTTPS protocol"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:189
|
||
msgid "the ``request_sftp_access`` method using the SFTP protocol"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:192
|
||
msgid "The ``upload`` method"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:194
|
||
msgid "It's the most simple and most straightforward way of uploading your database dump. It uses the HTTPS protocol."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:199
|
||
msgid "Uploads a database dump"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:201
|
||
#: ../../content/developer/webservices/upgrade.rst:257
|
||
#: ../../content/developer/webservices/upgrade.rst:385
|
||
#: ../../content/developer/webservices/upgrade.rst:438
|
||
#: ../../content/developer/webservices/upgrade.rst:489
|
||
msgid "(required) your private key"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:202
|
||
#: ../../content/developer/webservices/upgrade.rst:258
|
||
#: ../../content/developer/webservices/upgrade.rst:386
|
||
#: ../../content/developer/webservices/upgrade.rst:439
|
||
#: ../../content/developer/webservices/upgrade.rst:490
|
||
msgid "(required) your request id"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:206
|
||
#: ../../content/developer/webservices/upgrade.rst:263
|
||
#: ../../content/developer/webservices/upgrade.rst:390
|
||
#: ../../content/developer/webservices/upgrade.rst:443
|
||
#: ../../content/developer/webservices/upgrade.rst:494
|
||
msgid "The request id and the private key are obtained using the :ref:`create method <upgrade-api-create-method>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:209
|
||
#: ../../content/developer/webservices/upgrade.rst:393
|
||
#: ../../content/developer/webservices/upgrade.rst:446
|
||
msgid "The result is a JSON dictionary containing the list of ``failures``, which should be empty if everything went fine."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:245
|
||
msgid "The ``request_sftp_access`` method"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:247
|
||
msgid "This method is recommanded for big database dumps. It uses the SFTP protocol and supports resuming."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:250
|
||
msgid "It will create a temporary SFTP server where you can connect to and allow you to upload your database dump using an SFTP client."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:255
|
||
msgid "Creates an SFTP server"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:259
|
||
msgid "(required) the path to a file listing the ssh public keys you'd like to use"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:266
|
||
msgid "The file listing your ssh public keys should be roughly similar to a standard ``authorized_keys`` file. This file should only contains public keys, blank lines or comments (lines starting with the ``#`` character)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:269
|
||
msgid "Your database upgrade request should be in the ``draft`` state."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:271
|
||
msgid "The ``request_sftp_access`` method returns a JSON dictionary containing the following keys:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:316
|
||
msgid "The list of errors. See :ref:`failures <upgrade-api-json-failure>` for an explanation about the JSON dictionary returned in case of failure."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:322
|
||
msgid "If the call is successful, the value associated to the *request* key will be a dictionary containing your SFTP connexion parameters:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:325
|
||
msgid "``hostname``: the host address to connect to"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:326
|
||
msgid "``sftp_port``: the port to connect to"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:327
|
||
msgid "``sftp_user``: the SFTP user to use for connecting"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:328
|
||
msgid "``shared_file``: the filename you need to use (identical to the ``filename`` value you have used when creating the request in the :ref:`create method <upgrade-api-create-method>`.)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:329
|
||
msgid "``request_id``: the related upgrade request id (only informative, ,not required for the connection)"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:330
|
||
msgid "``sample_command``: a sample command using the 'sftp' client"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:332
|
||
msgid "You should normally be able to connect using the sample command as is."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:334
|
||
msgid "You will only have access to the ``shared_file``. No other files will be accessible and you will not be able to create new files in your shared environment on the SFTP server."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:339
|
||
msgid "Using the 'sftp' client"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:341
|
||
msgid "Once you have successfully connected using your SFTP client, you can upload your database dump. Here is a sample session using the 'sftp' client:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:353
|
||
msgid "If your connection is interrupted, you can continue your file transfer using the ``-a`` command line switch:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:361
|
||
msgid "If you don't want to manually type the command and need to automate your database upgrade using a script, you can use a batch file or pipe your commands to 'sftp':"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:368
|
||
msgid "The ``-b`` parameter takes a filename. If the filename is ``-``, it reads the commands from standard input."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:374
|
||
msgid "Asking to process your request"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:376
|
||
msgid "This action ask the Upgrade Platform to process your database dump."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:379
|
||
msgid "The ``process`` method"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:383
|
||
msgid "Process a database dump"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:426
|
||
msgid "Asking to skip the tests"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:428
|
||
msgid "This action asks the Upgrade Platform to skip the tests for your request. If you don't want Odoo to test and validate the migration, you can bypass the testing stage and directly get the migrated dump."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:432
|
||
msgid "The ``skip_test`` method"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:436
|
||
msgid "Skip the tests, deliver the upgraded dump, and set the state to 'delivered'"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:478
|
||
msgid "Obtaining your request status"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:480
|
||
msgid "This action ask the status of your database upgrade request."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:483
|
||
msgid "The ``status`` method"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:487
|
||
msgid "Ask the status of a database upgrade request"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:497
|
||
msgid "The result is a JSON dictionary containing various information about your database upgrade request."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:527
|
||
msgid "Sample output"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:529
|
||
msgid "The ``request`` key contains various useful information about your request:"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:532
|
||
msgid "the request id"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:533
|
||
msgid "``key``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:534
|
||
msgid "your private key"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:535
|
||
msgid "``email``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:536
|
||
msgid "the email address you supplied when creating the request"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:538
|
||
msgid "the target Odoo version you supplied when creating the request"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:539
|
||
msgid "``aim``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:540
|
||
msgid "the purpose (test, production) of your database upgrade request you supplied when creating the request"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:542
|
||
msgid "the filename you supplied when creating the request"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:543
|
||
msgid "``timezone``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:544
|
||
msgid "the timezone you supplied when creating the request"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:546
|
||
msgid "the state of your request"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:547
|
||
msgid "``issue_stage``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:548
|
||
msgid "the stage of the issue we have create on Odoo main server"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:549
|
||
msgid "``issue``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:550
|
||
msgid "the id of the issue we have create on Odoo main server"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:551
|
||
msgid "``status_url``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:552
|
||
msgid "the URL to access your database upgrade request html page"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:553
|
||
msgid "``notes_url``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:554
|
||
msgid "the URL to get the notes about your database upgrade"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:555
|
||
msgid "``original_sql_url``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:556
|
||
msgid "the URL used to get your uploaded (not upgraded) database as an SQL stream"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:557
|
||
msgid "``original_dump_url``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:558
|
||
msgid "the URL used to get your uploaded (not upgraded) database as an archive file"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:559
|
||
msgid "``upgraded_sql_url``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:560
|
||
msgid "the URL used to get your upgraded database as an SQL stream"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:561
|
||
msgid "``upgraded_dump_url``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:562
|
||
msgid "the URL used to get your upgraded database as an archive file"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:563
|
||
msgid "``modules_url``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:564
|
||
msgid "the URL used to get your custom modules"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:565
|
||
msgid "``filesize``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:566
|
||
msgid "the size of your uploaded database file"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:567
|
||
msgid "``database_uuid``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:568
|
||
msgid "the Unique ID of your database"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:569
|
||
msgid "``created_at``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:570
|
||
msgid "the date when you created the request"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:571
|
||
msgid "``estimated_time``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:572
|
||
msgid "an estimation of the time it takes to upgrade your database"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:573
|
||
msgid "``processed_at``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:574
|
||
msgid "time when your database upgrade was started"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:575
|
||
msgid "``elapsed``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:576
|
||
msgid "the time it takes to upgrade your database"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:577
|
||
msgid "``filestore``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:578
|
||
msgid "your attachments were converted to the filestore"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:579
|
||
msgid "``customer_message``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:580
|
||
msgid "an important message related to your request"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:581
|
||
msgid "``database_version``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:582
|
||
msgid "the guessed Odoo version of your uploaded (not upgraded) database"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:583
|
||
msgid "``postgresql``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:584
|
||
msgid "the guessed Postgresql version of your uploaded (not upgraded) database"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:586
|
||
msgid "``compressions``"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:586
|
||
msgid "the compression methods used by your uploaded database"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:634
|
||
msgid "Downloading your database dump"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:636
|
||
msgid "Beside downloading your migrated database using the URL provided by the :ref:`status method <upgrade-api-status-method>`, you can also use the SFTP protocol as described in the :ref:`request_sftp_access method <upgrade-api-request-sftp-access-method>`"
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:641
|
||
msgid "The diffence is that you'll only be able to download the migrated database. No uploading will be possible."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:644
|
||
msgid "Your database upgrade request should be in the ``done`` state."
|
||
msgstr ""
|
||
|
||
#: ../../content/developer/webservices/upgrade.rst:646
|
||
msgid "Once you have successfully connected using your SFTP client, you can download your database dump. Here is a sample session using the 'sftp' client:"
|
||
msgstr ""
|