# SOME DESCRIPTIVE TITLE. # Copyright (C) Odoo S.A. # This file is distributed under the same license as the Odoo package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Odoo 16.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-10-04 12:47+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../../content/developer.rst:9 msgid "Developer" msgstr "" #: ../../content/developer.rst:11 msgid "Learn through tutorials and get help using reference guides." msgstr "" #: ../../content/developer/api.rst:5 #: ../../content/developer/reference/backend/http.rst:52 #: ../../content/developer/reference/backend/orm.rst:54 #: ../../content/developer/reference/backend/views.rst:1994 #: ../../content/developer/reference/frontend/hooks.rst:85 #: ../../content/developer/reference/frontend/hooks.rst:120 #: ../../content/developer/reference/frontend/hooks.rst:168 #: ../../content/developer/reference/frontend/hooks.rst:211 #: ../../content/developer/reference/frontend/qweb.rst:966 #: ../../content/developer/reference/frontend/registries.rst:170 #: ../../content/developer/reference/frontend/services.rst:156 #: ../../content/developer/reference/frontend/services.rst:211 #: ../../content/developer/reference/frontend/services.rst:373 #: ../../content/developer/reference/frontend/services.rst:421 #: ../../content/developer/reference/frontend/services.rst:534 #: ../../content/developer/reference/frontend/services.rst:637 #: ../../content/developer/reference/frontend/services.rst:728 #: ../../content/developer/reference/frontend/services.rst:777 #: ../../content/developer/reference/frontend/services.rst:845 msgid "API" msgstr "" #: ../../content/developer/api/external_api.rst:3 msgid "External API" msgstr "" #: ../../content/developer/api/external_api.rst:5 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/api/external_api.rst:11 msgid "Starting with PHP8, the XML-RPC extension may not be available by default. Check out the `manual `_ for the installation steps." msgstr "" #: ../../content/developer/api/external_api.rst:16 msgid ":doc:`Tutorial on web services <../howtos/web_services>`" msgstr "" #: ../../content/developer/api/external_api.rst:19 msgid "Connection" msgstr "" #: ../../content/developer/api/external_api.rst:22 msgid "Configuration" msgstr "" #: ../../content/developer/api/external_api.rst:24 msgid "If you already have an Odoo server installed, you can just use its parameters." msgstr "" #: ../../content/developer/api/external_api.rst:28 msgid "For Odoo Online instances (.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/api/external_api.rst:34 msgid "Log in your instance with an administrator account." msgstr "" #: ../../content/developer/api/external_api.rst:35 msgid "Go to :menuselection:`Settings --> Users & Companies --> Users`." msgstr "" #: ../../content/developer/api/external_api.rst:36 msgid "Click on the user you want to use for XML-RPC access." msgstr "" #: ../../content/developer/api/external_api.rst:37 msgid "Click on :guilabel:`Action` and select :guilabel:`Change Password`." msgstr "" #: ../../content/developer/api/external_api.rst:38 msgid "Set a :guilabel:`New Password` value then click :guilabel:`Change Password`." msgstr "" #: ../../content/developer/api/external_api.rst:40 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/api/external_api.rst:76 msgid "API Keys" msgstr "" #: ../../content/developer/api/external_api.rst:80 msgid "Odoo has support for **api keys** and (depending on modules or settings) may **require** these keys to perform webservice operations." msgstr "" #: ../../content/developer/api/external_api.rst:83 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/api/external_api.rst:88 msgid "In order to add a key to your account, simply go to your :guilabel:`Preferences` (or :guilabel:`My Profile`):" msgstr "" #: ../../content/developer/api/external_api.rst:94 msgid "then open the :guilabel:`Account Security` tab, and click :guilabel:`New API Key`:" msgstr "" #: ../../content/developer/api/external_api.rst:100 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/api/external_api.rst:104 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/api/external_api.rst:110 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/api/external_api.rst:116 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/api/external_api.rst:120 msgid "Test database" msgstr "" #: ../../content/developer/api/external_api.rst:122 msgid "To make exploration simpler, you can also ask https://demo.odoo.com for a test database:" msgstr "" #: ../../content/developer/api/external_api.rst:139 msgid "PHP" msgstr "" #: ../../content/developer/api/external_api.rst:148 msgid "These examples use the `Ripcord `_ library, which provides a simple XML-RPC API. Ripcord requires that `XML-RPC support be enabled `_ in your PHP installation." msgstr "" #: ../../content/developer/api/external_api.rst:154 msgid "Since calls are performed over `HTTPS `_, it also requires that the `OpenSSL extension `_ be enabled." msgstr "" #: ../../content/developer/api/external_api.rst:159 msgid "Java" msgstr "" #: ../../content/developer/api/external_api.rst:176 msgid "These examples use the `Apache XML-RPC library `_." msgstr "" #: ../../content/developer/api/external_api.rst:178 msgid "The examples do not include imports as these imports couldn't be pasted in the code." msgstr "" #: ../../content/developer/api/external_api.rst:182 msgid "Logging in" msgstr "" #: ../../content/developer/api/external_api.rst:184 msgid "Odoo requires users of the API to be authenticated before they can query most data." msgstr "" #: ../../content/developer/api/external_api.rst:187 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/api/external_api.rst:218 #: ../../content/developer/api/external_api.rst:304 #: ../../content/developer/api/external_api.rst:346 #: ../../content/developer/api/external_api.rst:385 #: ../../content/developer/api/external_api.rst:425 #: ../../content/developer/api/external_api.rst:489 #: ../../content/developer/api/external_api.rst:522 #: ../../content/developer/api/external_api.rst:570 #: ../../content/developer/api/external_api.rst:653 #: ../../content/developer/api/external_api.rst:724 #: ../../content/developer/api/external_api.rst:793 #: ../../content/developer/api/external_api.rst:842 #: ../../content/developer/api/external_api.rst:954 #: ../../content/developer/api/external_api.rst:1119 #: ../../content/developer/howtos/web.rst:655 msgid "Result:" msgstr "" #: ../../content/developer/api/external_api.rst:251 msgid "Calling methods" msgstr "" #: ../../content/developer/api/external_api.rst:253 msgid "The second endpoint is ``xmlrpc/2/object``. It is used to call methods of odoo models via the ``execute_kw`` RPC function." msgstr "" #: ../../content/developer/api/external_api.rst:256 msgid "Each call to ``execute_kw`` takes the following parameters:" msgstr "" #: ../../content/developer/api/external_api.rst:258 msgid "the database to use, a string" msgstr "" #: ../../content/developer/api/external_api.rst:259 msgid "the user id (retrieved through ``authenticate``), an integer" msgstr "" #: ../../content/developer/api/external_api.rst:260 msgid "the user's password, a string" msgstr "" #: ../../content/developer/api/external_api.rst:261 msgid "the model name, a string" msgstr "" #: ../../content/developer/api/external_api.rst:262 msgid "the method name, a string" msgstr "" #: ../../content/developer/api/external_api.rst:263 msgid "an array/list of parameters passed by position" msgstr "" #: ../../content/developer/api/external_api.rst:264 msgid "a mapping/dict of parameters to pass by keyword (optional)" msgstr "" #: ../../content/developer/api/external_api.rst:268 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/api/external_api.rst:311 msgid "List records" msgstr "" #: ../../content/developer/api/external_api.rst:313 msgid "Records can be listed and filtered via :meth:`~odoo.models.Model.search`." msgstr "" #: ../../content/developer/api/external_api.rst:315 msgid ":meth:`~odoo.models.Model.search` takes a mandatory :ref:`domain ` filter (possibly empty), and returns the database identifiers of all records matching the filter." msgstr "" #: ../../content/developer/api/external_api.rst:321 msgid "To list customer companies, for instance:" msgstr "" #: ../../content/developer/api/external_api.rst:353 msgid "Pagination" msgstr "" #: ../../content/developer/api/external_api.rst:355 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/api/external_api.rst:392 msgid "Count records" msgstr "" #: ../../content/developer/api/external_api.rst:394 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 ` filter as :meth:`~odoo.models.Model.search` and no other parameter." msgstr "" #: ../../content/developer/api/external_api.rst:432 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/api/external_api.rst:437 msgid "Read records" msgstr "" #: ../../content/developer/api/external_api.rst:439 msgid "Record data are 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 fetches all the fields the current user can read, which tends to be a huge amount." msgstr "" #: ../../content/developer/api/external_api.rst:495 msgid "Conversely, picking only three fields deemed interesting." msgstr "" #: ../../content/developer/api/external_api.rst:529 msgid "Even if the ``id`` field is not requested, it is always returned." msgstr "" #: ../../content/developer/api/external_api.rst:532 msgid "List record fields" msgstr "" #: ../../content/developer/api/external_api.rst:534 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/api/external_api.rst:537 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/api/external_api.rst:612 msgid "Search and read" msgstr "" #: ../../content/developer/api/external_api.rst:614 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/api/external_api.rst:620 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/api/external_api.rst:691 msgid "Create records" msgstr "" #: ../../content/developer/api/external_api.rst:693 msgid "Records of a model are created using :meth:`~odoo.models.Model.create`. The method creates a single record and returns its database identifier." msgstr "" #: ../../content/developer/api/external_api.rst:696 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/api/external_api.rst:731 msgid "While most value types are what would expect (integer for :class:`~odoo.fields.Integer`, string for :class:`~odoo.fields.Char` or :class:`~odoo.fields.Text`)," msgstr "" #: ../../content/developer/api/external_api.rst:735 msgid ":class:`~odoo.fields.Date`, :class:`~odoo.fields.Datetime` and :class:`~odoo.fields.Binary` fields use string values" msgstr "" #: ../../content/developer/api/external_api.rst:737 msgid ":class:`~odoo.fields.One2many` and :class:`~odoo.fields.Many2many` use a special command protocol detailed in :meth:`the documentation to the write method `." msgstr "" #: ../../content/developer/api/external_api.rst:742 msgid "Update records" msgstr "" #: ../../content/developer/api/external_api.rst:744 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/api/external_api.rst:748 msgid "Multiple records can be updated simultaneously, but they will all get the same values for the fields being set. It is not possible to perform \"computed\" updates (where the value being set depends on an existing value of a record)." msgstr "" #: ../../content/developer/api/external_api.rst:800 msgid "Delete records" msgstr "" #: ../../content/developer/api/external_api.rst:802 msgid "Records can be deleted in bulk by providing their ids to :meth:`~odoo.models.Model.unlink`." msgstr "" #: ../../content/developer/api/external_api.rst:849 msgid "Inspection and introspection" msgstr "" #: ../../content/developer/api/external_api.rst:851 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/api/external_api.rst:860 msgid "``ir.model``" msgstr "" #: ../../content/developer/api/external_api.rst:862 msgid "Provides information about Odoo models via its various fields." msgstr "" #: ../../content/developer/api/external_api.rst:864 #: ../../content/developer/api/external_api.rst:1000 #: ../../content/developer/howtos/web.rst:1326 #: ../../content/developer/reference/backend/actions.rst:19 #: ../../content/developer/reference/backend/actions.rst:416 #: ../../content/developer/reference/backend/data.rst:221 #: ../../content/developer/reference/backend/views.rst:1376 #: ../../content/developer/reference/backend/views.rst:1784 #: ../../content/developer/reference/backend/views.rst:1820 #: ../../content/developer/reference/backend/views.rst:1904 #: ../../content/developer/reference/backend/views.rst:2031 #: ../../content/developer/reference/backend/views.rst:2200 #: ../../content/developer/reference/backend/views.rst:2341 #: ../../content/developer/reference/frontend/services.rst:872 msgid "``name``" msgstr "" #: ../../content/developer/api/external_api.rst:865 msgid "a human-readable description of the model" msgstr "" #: ../../content/developer/api/external_api.rst:866 #: ../../content/developer/reference/backend/views.rst:2154 msgid "``model``" msgstr "" #: ../../content/developer/api/external_api.rst:867 msgid "the name of each model in the system" msgstr "" #: ../../content/developer/api/external_api.rst:869 #: ../../content/developer/api/external_api.rst:1007 #: ../../content/developer/reference/backend/actions.rst:231 msgid "``state``" msgstr "" #: ../../content/developer/api/external_api.rst:869 msgid "whether the model was generated in Python code (``base``) or by creating an ``ir.model`` record (``manual``)" msgstr "" #: ../../content/developer/api/external_api.rst:872 msgid "``field_id``" msgstr "" #: ../../content/developer/api/external_api.rst:872 msgid "list of the model's fields through a :class:`~odoo.fields.One2many` to :ref:`reference/webservice/inspection/fields`" msgstr "" #: ../../content/developer/api/external_api.rst:875 #: ../../content/developer/reference/backend/actions.rst:148 msgid "``view_ids``" msgstr "" #: ../../content/developer/api/external_api.rst:875 msgid ":class:`~odoo.fields.One2many` to the :ref:`reference/views` defined for the model" msgstr "" #: ../../content/developer/api/external_api.rst:879 msgid "``access_ids``" msgstr "" #: ../../content/developer/api/external_api.rst:878 msgid ":class:`~odoo.fields.One2many` relation to the :ref:`reference/security/acl` set on the model" msgstr "" #: ../../content/developer/api/external_api.rst:881 msgid "``ir.model`` can be used to" msgstr "" #: ../../content/developer/api/external_api.rst:883 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/api/external_api.rst:885 msgid "Get information about a specific model (generally by listing the fields associated with it)." msgstr "" #: ../../content/developer/api/external_api.rst:887 msgid "Create new models dynamically over RPC." msgstr "" #: ../../content/developer/api/external_api.rst:890 msgid "Custom model names must start with ``x_``." msgstr "" #: ../../content/developer/api/external_api.rst:891 msgid "The ``state`` must be provided and set to ``manual``, otherwise the model will not be loaded." msgstr "" #: ../../content/developer/api/external_api.rst:893 msgid "It is not possible to add new *methods* to a custom model, only fields." msgstr "" #: ../../content/developer/api/external_api.rst:897 msgid "A custom model will initially contain only the \"built-in\" fields available on all models:" msgstr "" #: ../../content/developer/api/external_api.rst:992 msgid "``ir.model.fields``" msgstr "" #: ../../content/developer/api/external_api.rst:994 msgid "Provides information about the fields of Odoo models and allows adding custom fields without using Python code." msgstr "" #: ../../content/developer/api/external_api.rst:998 #: ../../content/developer/reference/backend/actions.rst:229 #: ../../content/developer/reference/backend/actions.rst:433 msgid "``model_id``" msgstr "" #: ../../content/developer/api/external_api.rst:998 msgid ":class:`~odoo.fields.Many2one` to :ref:`reference/webservice/inspection/models` to which the field belongs" msgstr "" #: ../../content/developer/api/external_api.rst:1001 msgid "the field's technical name (used in ``read`` or ``write``)" msgstr "" #: ../../content/developer/api/external_api.rst:1002 msgid "``field_description``" msgstr "" #: ../../content/developer/api/external_api.rst:1003 msgid "the field's user-readable label (e.g. ``string`` in ``fields_get``)" msgstr "" #: ../../content/developer/api/external_api.rst:1004 msgid "``ttype``" msgstr "" #: ../../content/developer/api/external_api.rst:1005 msgid "the :ref:`type ` of field to create" msgstr "" #: ../../content/developer/api/external_api.rst:1007 msgid "whether the field was created via Python code (``base``) or via ``ir.model.fields`` (``manual``)" msgstr "" #: ../../content/developer/api/external_api.rst:1009 msgid "``required``, ``readonly``, ``translate``" msgstr "" #: ../../content/developer/api/external_api.rst:1010 msgid "enables the corresponding flag on the field" msgstr "" #: ../../content/developer/api/external_api.rst:1012 #: ../../content/developer/reference/backend/data.rst:226 #: ../../content/developer/reference/backend/data.rst:250 #: ../../content/developer/reference/backend/views.rst:895 #: ../../content/developer/reference/backend/views.rst:1829 #: ../../content/developer/reference/backend/views.rst:2232 #: ../../content/developer/reference/backend/views.rst:2347 #: ../../content/developer/reference/backend/views.rst:2411 msgid "``groups``" msgstr "" #: ../../content/developer/api/external_api.rst:1012 msgid ":ref:`field-level access control `, a :class:`~odoo.fields.Many2many` to ``res.groups``" msgstr "" #: ../../content/developer/api/external_api.rst:1016 msgid "``selection``, ``size``, ``on_delete``, ``relation``, ``relation_field``, ``domain``" msgstr "" #: ../../content/developer/api/external_api.rst:1015 msgid "type-specific properties and customizations, see :ref:`the fields documentation ` for details" msgstr "" #: ../../content/developer/api/external_api.rst:1019 msgid "Like custom models, only new fields created with ``state=\"manual\"`` are activated as actual fields on the model." msgstr "" #: ../../content/developer/api/external_api.rst:1021 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/api/extract_api.rst:5 msgid "Extract API" msgstr "" #: ../../content/developer/api/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 `_." msgstr "" #: ../../content/developer/api/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 `_." msgstr "" #: ../../content/developer/api/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/api/extract_api.rst:17 msgid "Invoices" msgstr "" #: ../../content/developer/api/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/api/extract_api.rst:21 msgid "Expected successful flow" msgstr "" #: ../../content/developer/api/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/api/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/api/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/api/extract_api.rst:28 msgid "These 3 routes are detailed in this :ref:`section `. The HTTP POST method should be used for all of them. A python implementation of the full flow can be found :download:`here ` and a token for integration testing is provided in the :ref:`integration testing section `." msgstr "" #: ../../content/developer/api/extract_api.rst:34 msgid "Routes" msgstr "" #: ../../content/developer/api/extract_api.rst:39 msgid "``/iap/invoice_extract/parse``" msgstr "" #: ../../content/developer/api/extract_api.rst:42 #: ../../content/developer/api/extract_api.rst:145 #: ../../content/developer/api/extract_api.rst:359 #: ../../content/developer/howtos/themes.rst:959 #: ../../content/developer/reference/frontend/assets.rst:301 #: ../../content/developer/reference/frontend/framework_overview.rst:263 #: ../../content/developer/reference/frontend/hooks.rst:45 #: ../../content/developer/reference/frontend/hooks.rst:62 #: ../../content/developer/reference/frontend/hooks.rst:102 #: ../../content/developer/reference/frontend/hooks.rst:139 #: ../../content/developer/reference/frontend/hooks.rst:185 #: ../../content/developer/reference/frontend/hooks.rst:225 #: ../../content/developer/reference/frontend/odoo_editor.rst:148 #: ../../content/developer/reference/frontend/odoo_editor.rst:174 #: ../../content/developer/reference/frontend/odoo_editor.rst:218 #: ../../content/developer/reference/frontend/owl_components.rst:175 #: ../../content/developer/reference/frontend/owl_components.rst:238 #: ../../content/developer/reference/frontend/owl_components.rst:297 #: ../../content/developer/reference/frontend/owl_components.rst:317 #: ../../content/developer/reference/frontend/owl_components.rst:336 #: ../../content/developer/reference/frontend/owl_components.rst:384 #: ../../content/developer/reference/frontend/owl_components.rst:428 #: ../../content/developer/reference/frontend/owl_components.rst:612 #: ../../content/developer/reference/frontend/owl_components.rst:632 #: ../../content/developer/reference/frontend/patching_code.rst:17 #: ../../content/developer/reference/frontend/services.rst:247 #: ../../content/developer/reference/frontend/services.rst:439 #: ../../content/developer/reference/frontend/services.rst:467 #: ../../content/developer/reference/frontend/services.rst:738 #: ../../content/developer/reference/frontend/services.rst:853 msgid "Description" msgstr "" #: ../../content/developer/api/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/api/extract_api.rst:46 #: ../../content/developer/api/extract_api.rst:149 #: ../../content/developer/api/extract_api.rst:364 msgid "Request Body" msgstr "" #: ../../content/developer/api/extract_api.rst:48 #: ../../content/developer/api/extract_api.rst:151 #: ../../content/developer/api/extract_api.rst:366 msgid "``jsonrpc`` (required)" msgstr "" #: ../../content/developer/api/extract_api.rst:49 msgid "Must be exactly “2.0”." msgstr "" #: ../../content/developer/api/extract_api.rst:50 #: ../../content/developer/api/extract_api.rst:153 #: ../../content/developer/api/extract_api.rst:368 msgid "``method`` (required)" msgstr "" #: ../../content/developer/api/extract_api.rst:51 msgid "Must be “call”." msgstr "" #: ../../content/developer/api/extract_api.rst:52 #: ../../content/developer/api/extract_api.rst:155 msgid "``id`` (required)" msgstr "" #: ../../content/developer/api/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/api/extract_api.rst:76 #: ../../content/developer/api/extract_api.rst:374 msgid "``params``" msgstr "" #: ../../content/developer/api/extract_api.rst:55 msgid "``account_token`` (required)" msgstr "" #: ../../content/developer/api/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/api/extract_api.rst:58 msgid "``version`` (optional)" msgstr "" #: ../../content/developer/api/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/api/extract_api.rst:62 msgid "``documents`` (required)" msgstr "" #: ../../content/developer/api/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/api/extract_api.rst:76 msgid "``user_infos`` (required)" msgstr "" #: ../../content/developer/api/extract_api.rst:65 msgid "Information concerning the person to whom the invoice is intended. This information is not required in order for the service to work but it greatly improves the quality of the result." msgstr "" #: ../../content/developer/api/extract_api.rst:67 msgid "``user_company_vat`` (optional)" msgstr "" #: ../../content/developer/api/extract_api.rst:68 msgid "VAT number of the client." msgstr "" #: ../../content/developer/api/extract_api.rst:69 msgid "``user_company_name`` (optional)" msgstr "" #: ../../content/developer/api/extract_api.rst:70 msgid "Name of the client’s company." msgstr "" #: ../../content/developer/api/extract_api.rst:71 msgid "``user_company_country_code`` (optional)" msgstr "" #: ../../content/developer/api/extract_api.rst:72 msgid "Country code of the client. Format: `ISO3166 alpha-2 `_." msgstr "" #: ../../content/developer/api/extract_api.rst:73 msgid "``user_lang`` (optional)" msgstr "" #: ../../content/developer/api/extract_api.rst:74 msgid "The client language. Format: *language_code + _ + locale* (ex: fr_FR, en_US)." msgstr "" #: ../../content/developer/api/extract_api.rst:76 msgid "``user_email`` (optional)" msgstr "" #: ../../content/developer/api/extract_api.rst:76 msgid "The client email." msgstr "" #: ../../content/developer/api/extract_api.rst:100 #: ../../content/developer/api/extract_api.rst:177 #: ../../content/developer/api/extract_api.rst:465 #: ../../content/developer/reference/backend/http.rst:81 msgid "Response" msgstr "" #: ../../content/developer/api/extract_api.rst:102 #: ../../content/developer/api/extract_api.rst:179 #: ../../content/developer/api/extract_api.rst:467 msgid "``jsonrpc``" msgstr "" #: ../../content/developer/api/extract_api.rst:103 msgid "A string specifying the version of the JSON-RPC protocol. It will be “2.0”." msgstr "" #: ../../content/developer/api/extract_api.rst:104 #: ../../content/developer/api/extract_api.rst:181 #: ../../content/developer/api/extract_api.rst:469 #: ../../content/developer/reference/backend/actions.rst:219 #: ../../content/developer/reference/backend/data.rst:70 #: ../../content/developer/reference/backend/data.rst:155 #: ../../content/developer/reference/backend/data.rst:232 #: ../../content/developer/reference/backend/data.rst:242 #: ../../content/developer/reference/backend/views.rst:866 msgid "``id``" msgstr "" #: ../../content/developer/api/extract_api.rst:105 msgid "The identifier you set in the request body." msgstr "" #: ../../content/developer/api/extract_api.rst:112 #: ../../content/developer/api/extract_api.rst:191 #: ../../content/developer/api/extract_api.rst:475 msgid "``result``" msgstr "" #: ../../content/developer/api/extract_api.rst:107 #: ../../content/developer/api/extract_api.rst:186 #: ../../content/developer/api/extract_api.rst:472 msgid "``status_code``" msgstr "" #: ../../content/developer/api/extract_api.rst:108 #: ../../content/developer/api/extract_api.rst:187 #: ../../content/developer/api/extract_api.rst:473 msgid "|STATUS_CODE|" msgstr "" #: ../../content/developer/api/extract_api.rst:109 #: ../../content/developer/api/extract_api.rst:188 #: ../../content/developer/api/extract_api.rst:475 msgid "``status_msg``" msgstr "" #: ../../content/developer/api/extract_api.rst:110 #: ../../content/developer/api/extract_api.rst:189 #: ../../content/developer/api/extract_api.rst:475 msgid "|STATUS_MSG|" msgstr "" #: ../../content/developer/api/extract_api.rst:112 msgid "``document_id``" msgstr "" #: ../../content/developer/api/extract_api.rst:112 #: ../../content/developer/api/extract_api.rst:191 msgid "Only present if the request is successful." msgstr "" #: ../../content/developer/api/extract_api.rst:114 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/api/extract_api.rst:117 #: ../../content/developer/api/extract_api.rst:196 #: ../../content/developer/api/extract_api.rst:478 msgid "status_code" msgstr "" #: ../../content/developer/api/extract_api.rst:117 #: ../../content/developer/api/extract_api.rst:196 #: ../../content/developer/api/extract_api.rst:478 msgid "status_msg" msgstr "" #: ../../content/developer/api/extract_api.rst:119 #: ../../content/developer/api/extract_api.rst:198 #: ../../content/developer/api/extract_api.rst:480 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.amount:1 msgid "0" msgstr "" #: ../../content/developer/api/extract_api.rst:119 #: ../../content/developer/api/extract_api.rst:198 #: ../../content/developer/api/extract_api.rst:480 msgid "Success" msgstr "" #: ../../content/developer/api/extract_api.rst:120 #: ../../content/developer/api/extract_api.rst:200 msgid "2" msgstr "" #: ../../content/developer/api/extract_api.rst:120 #: ../../content/developer/api/extract_api.rst:200 msgid "An error occurred" msgstr "" #: ../../content/developer/api/extract_api.rst:121 msgid "3" msgstr "" #: ../../content/developer/api/extract_api.rst:121 msgid "You don't have enough credit" msgstr "" #: ../../content/developer/api/extract_api.rst:122 #: ../../content/developer/howtos/rdtraining/C_data.rst:185 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.code_digits:1 msgid "6" msgstr "" #: ../../content/developer/api/extract_api.rst:122 msgid "Unsupported file format" msgstr "" #: ../../content/developer/api/extract_api.rst:123 #: ../../content/developer/api/extract_api.rst:201 msgid "9" msgstr "" #: ../../content/developer/api/extract_api.rst:123 #: ../../content/developer/api/extract_api.rst:201 msgid "Server is currently under maintenance. Please try again later." msgstr "" #: ../../content/developer/api/extract_api.rst:142 msgid "``/iap/invoice_extract/get_results``" msgstr "" #: ../../content/developer/api/extract_api.rst:146 msgid "Request the results of the documents ids obtained with the :ref:`/parse ` route. Can either return the results or a \"request pending\" message." msgstr "" #: ../../content/developer/api/extract_api.rst:152 #: ../../content/developer/api/extract_api.rst:154 #: ../../content/developer/api/extract_api.rst:156 #: ../../content/developer/api/extract_api.rst:159 #: ../../content/developer/api/extract_api.rst:180 #: ../../content/developer/api/extract_api.rst:182 #: ../../content/developer/api/extract_api.rst:367 #: ../../content/developer/api/extract_api.rst:369 #: ../../content/developer/api/extract_api.rst:468 #: ../../content/developer/api/extract_api.rst:470 msgid "|SAME_AS_PARSE|" msgstr "" #: ../../content/developer/api/extract_api.rst:161 msgid "``params``:" msgstr "" #: ../../content/developer/api/extract_api.rst:158 msgid "``version`` (required)" msgstr "" #: ../../content/developer/api/extract_api.rst:161 msgid "``documents_ids`` (required)" msgstr "" #: ../../content/developer/api/extract_api.rst:161 msgid "The list of ``document_id`` for which you want to get the current parsing status." msgstr "" #: ../../content/developer/api/extract_api.rst:184 msgid "Dictionary where each key is a document_id. For each ``document_id``:" msgstr "" #: ../../content/developer/api/extract_api.rst:191 msgid "``results``" msgstr "" #: ../../content/developer/api/extract_api.rst:193 msgid "result keys are strings despite the fact that the document_ids given in the request body are integers." msgstr "" #: ../../content/developer/api/extract_api.rst:199 #: ../../content/developer/howtos/rdtraining/C_data.rst:185 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.sequence:1 msgid "1" msgstr "" #: ../../content/developer/api/extract_api.rst:199 msgid "Not ready" msgstr "" #: ../../content/developer/api/extract_api.rst:234 msgid "``feature_result``" msgstr "" #: ../../content/developer/api/extract_api.rst:236 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/api/extract_api.rst:238 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/api/extract_api.rst:240 msgid "``selected_value``" msgstr "" #: ../../content/developer/api/extract_api.rst:241 msgid "The best candidate for this feature." msgstr "" #: ../../content/developer/api/extract_api.rst:243 msgid "``words``" msgstr "" #: ../../content/developer/api/extract_api.rst:243 msgid "List of all the candidates for this feature ordered by decreasing score." msgstr "" #: ../../content/developer/api/extract_api.rst:255 msgid "``candidate``" msgstr "" #: ../../content/developer/api/extract_api.rst:257 msgid "For each candidate we give its representation and position in the document. Candidates are sorted by decreasing order of suitability." msgstr "" #: ../../content/developer/api/extract_api.rst:259 msgid "``content``" msgstr "" #: ../../content/developer/api/extract_api.rst:260 msgid "Representation of the candidate." msgstr "" #: ../../content/developer/api/extract_api.rst:262 msgid "``coords``" msgstr "" #: ../../content/developer/api/extract_api.rst:262 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/api/extract_api.rst:265 #: ../../content/developer/reference/backend/data.rst:253 msgid "``page``" msgstr "" #: ../../content/developer/api/extract_api.rst:265 msgid "Page of the original document on which the candidate is located (starts at 0)." msgstr "" #: ../../content/developer/api/extract_api.rst:277 msgid "Feature name" msgstr "" #: ../../content/developer/api/extract_api.rst:277 msgid "Specifities" msgstr "" #: ../../content/developer/api/extract_api.rst:279 msgid "``SWIFT_code``" msgstr "" #: ../../content/developer/api/extract_api.rst:279 msgid "**content** is a dictionary encoded as a string." msgstr "" #: ../../content/developer/api/extract_api.rst:281 msgid "It contains information about the detected SWIFT code (or `BIC `_)." msgstr "" #: ../../content/developer/api/extract_api.rst:284 msgid "Keys:" msgstr "" #: ../../content/developer/api/extract_api.rst:286 msgid "``bic``" msgstr "" #: ../../content/developer/api/extract_api.rst:287 msgid "detected BIC (string)." msgstr "" #: ../../content/developer/api/extract_api.rst:288 #: ../../content/developer/reference/backend/views.rst:617 #: ../../content/developer/reference/backend/views.rst:734 msgid "``name`` (optional)" msgstr "" #: ../../content/developer/api/extract_api.rst:289 msgid "bank name (string)." msgstr "" #: ../../content/developer/api/extract_api.rst:290 msgid "``country_code``" msgstr "" #: ../../content/developer/api/extract_api.rst:291 msgid "ISO3166 alpha-2 country code of the bank (string)." msgstr "" #: ../../content/developer/api/extract_api.rst:292 msgid "``city`` (optional)" msgstr "" #: ../../content/developer/api/extract_api.rst:293 msgid "city of the bank (string)." msgstr "" #: ../../content/developer/api/extract_api.rst:295 msgid "``verified_bic``" msgstr "" #: ../../content/developer/api/extract_api.rst:295 msgid "True if the BIC has been found in our DB (bool)." msgstr "" #: ../../content/developer/api/extract_api.rst:297 msgid "Name and city are present only if verified_bic is true." msgstr "" #: ../../content/developer/api/extract_api.rst:299 msgid "``VAT_Number``" msgstr "" #: ../../content/developer/api/extract_api.rst:299 #: ../../content/developer/api/extract_api.rst:301 #: ../../content/developer/api/extract_api.rst:303 #: ../../content/developer/api/extract_api.rst:305 #: ../../content/developer/api/extract_api.rst:319 #: ../../content/developer/api/extract_api.rst:325 msgid "**content** is a string" msgstr "" #: ../../content/developer/api/extract_api.rst:301 msgid "``country``" msgstr "" #: ../../content/developer/api/extract_api.rst:303 msgid "``currency``" msgstr "" #: ../../content/developer/api/extract_api.rst:305 msgid "``date``" msgstr "" #: ../../content/developer/api/extract_api.rst:307 msgid "Format : *YYYY-MM-DD HH:MM:SS*" msgstr "" #: ../../content/developer/api/extract_api.rst:309 msgid "``due_date``" msgstr "" #: ../../content/developer/api/extract_api.rst:309 msgid "Same as for ``date``" msgstr "" #: ../../content/developer/api/extract_api.rst:311 msgid "``global_taxes``" msgstr "" #: ../../content/developer/api/extract_api.rst:311 #: ../../content/developer/api/extract_api.rst:317 #: ../../content/developer/api/extract_api.rst:321 #: ../../content/developer/api/extract_api.rst:323 msgid "**content** is a float" msgstr "" #: ../../content/developer/api/extract_api.rst:313 msgid "**candidate** has an additional field ``amount_type``. Its value is always percent." msgstr "" #: ../../content/developer/api/extract_api.rst:315 msgid "**selected_values** is a list of candidates." msgstr "" #: ../../content/developer/api/extract_api.rst:317 msgid "``global_taxes_amount``" msgstr "" #: ../../content/developer/api/extract_api.rst:319 msgid "``invoice_id``" msgstr "" #: ../../content/developer/api/extract_api.rst:321 msgid "``subtotal``" msgstr "" #: ../../content/developer/api/extract_api.rst:323 msgid "``total``" msgstr "" #: ../../content/developer/api/extract_api.rst:325 msgid "``supplier``" msgstr "" #: ../../content/developer/api/extract_api.rst:329 msgid "``feature_result`` for the ``invoice_lines`` feature" msgstr "" #: ../../content/developer/api/extract_api.rst:331 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/api/extract_api.rst:356 msgid "``/iap/invoice_extract/validate``" msgstr "" #: ../../content/developer/api/extract_api.rst:360 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/api/extract_api.rst:371 msgid "``documents_id`` (required)" msgstr "" #: ../../content/developer/api/extract_api.rst:372 msgid "Id of the document for which you want to validate the result." msgstr "" #: ../../content/developer/api/extract_api.rst:374 #: ../../content/developer/reference/backend/views.rst:1496 #: ../../content/developer/reference/backend/views.rst:1486 msgid "``values``" msgstr "" #: ../../content/developer/api/extract_api.rst:374 msgid "Contains the validation for each feature. The field ``merged_line`` indicates if the ``invoice_lines`` have been merged or not." msgstr "" #: ../../content/developer/api/extract_api.rst:376 msgid "You don't have to validate all the features in order for the validation to succeed. However :ref:`/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/api/extract_api.rst:398 msgid "``validation``" msgstr "" #: ../../content/developer/api/extract_api.rst:400 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/api/extract_api.rst:409 msgid "validation for ``global_taxes``" msgstr "" #: ../../content/developer/api/extract_api.rst:411 msgid "**content** is a list of dictionaries. Each dictionary represents a tax:" msgstr "" #: ../../content/developer/api/extract_api.rst:413 msgid "``amount``" msgstr "" #: ../../content/developer/api/extract_api.rst:414 msgid "Amount on which the tax is applied." msgstr "" #: ../../content/developer/api/extract_api.rst:415 msgid "``tax_amount``" msgstr "" #: ../../content/developer/api/extract_api.rst:416 msgid "Amount of the tax." msgstr "" #: ../../content/developer/api/extract_api.rst:417 msgid "``tax_amount_type``" msgstr "" #: ../../content/developer/api/extract_api.rst:418 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/api/extract_api.rst:420 msgid "``tax_price_include``" msgstr "" #: ../../content/developer/api/extract_api.rst:420 msgid "Indicates if ``amount`` already contains the tax or not." msgstr "" #: ../../content/developer/api/extract_api.rst:436 msgid "validation for ``invoice_lines``" msgstr "" #: ../../content/developer/api/extract_api.rst:438 msgid "**lines** is a list of dictionaries. Each dictionary represents an invoice line. The dictionary keys speak for themselves." msgstr "" #: ../../content/developer/api/extract_api.rst:481 msgid "12" msgstr "" #: ../../content/developer/api/extract_api.rst:481 msgid "Validation format is incorrect" msgstr "" #: ../../content/developer/api/extract_api.rst:500 #: ../../content/developer/reference/backend/testing.rst:535 msgid "Integration Testing" msgstr "" #: ../../content/developer/api/extract_api.rst:502 msgid "You can test your integration by using *integration_token* as ``account_token`` in the :ref:`/parse ` request." msgstr "" #: ../../content/developer/api/extract_api.rst:504 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/api/extract_api.rst:506 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 ` is a hard-coded one." msgstr "" #: ../../content/developer/api/extract_api.rst:509 msgid "A python implementation of the full flow can be found :download:`here `." msgstr "" #: ../../content/developer/api/iap.rst:6 msgid "In-App Purchase" msgstr "" #: ../../content/developer/api/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/api/iap.rst:12 msgid "In that context, Odoo acts mostly as a *broker* between a client and an Odoo App Developer:" msgstr "" #: ../../content/developer/api/iap.rst:15 msgid "Users purchase service tokens from Odoo." msgstr "" #: ../../content/developer/api/iap.rst:16 msgid "Service providers draw tokens from the user's Odoo account when service is requested." msgstr "" #: ../../content/developer/api/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/api/iap.rst:26 #: ../../content/developer/reference/frontend/javascript_reference.rst:18 #: ../../content/developer/reference/frontend/services.rst:144 #: ../../content/developer/reference/frontend/services.rst:182 #: ../../content/developer/reference/frontend/services.rst:362 #: ../../content/developer/reference/frontend/services.rst:408 #: ../../content/developer/reference/frontend/services.rst:522 #: ../../content/developer/reference/frontend/services.rst:612 #: ../../content/developer/reference/frontend/services.rst:709 #: ../../content/developer/reference/frontend/services.rst:760 #: ../../content/developer/reference/frontend/services.rst:835 msgid "Overview" msgstr "" #: ../../content/developer/api/iap.rst:31 msgid "The Players" msgstr "" #: ../../content/developer/api/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/api/iap.rst:35 msgid "The Client installed your Odoo App, and from there will request services." msgstr "" #: ../../content/developer/api/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/api/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/api/iap.rst:46 msgid "The Credits" msgstr "" #: ../../content/developer/api/iap.rst:48 msgid "The credits went from integer to float value starting **October 2018**. Integer values are still supported." msgstr "" #: ../../content/developer/api/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/api/iap.rst:56 msgid "for an sms service: 1 credit = 1 sms;" msgstr "" #: ../../content/developer/api/iap.rst:57 msgid "for an ad service: 1 credit = 1 ad; or" msgstr "" #: ../../content/developer/api/iap.rst:58 msgid "for a postage service: 1 credit = 1 post stamp." msgstr "" #: ../../content/developer/api/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/api/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 `)." msgstr "" #: ../../content/developer/api/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/api/iap.rst:73 msgid "'Normal' service flow" msgstr "" #: ../../content/developer/api/iap.rst:75 msgid "If everything goes well, the normal flow is the following:" msgstr "" #: ../../content/developer/api/iap.rst:77 msgid "The Client requests a service of some sort." msgstr "" #: ../../content/developer/api/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/api/iap.rst:81 msgid "The Service Provider provides the service (either on their own or calling to External Services)." msgstr "" #: ../../content/developer/api/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/api/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/api/iap.rst:93 msgid "Insufficient credits" msgstr "" #: ../../content/developer/api/iap.rst:95 msgid "However, if the Client's account lacks credits for the service, the flow will be as follows:" msgstr "" #: ../../content/developer/api/iap.rst:97 msgid "The Client requests a service as previously." msgstr "" #: ../../content/developer/api/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/api/iap.rst:100 msgid "This is signaled back to the Client." msgstr "" #: ../../content/developer/api/iap.rst:101 msgid "Who is redirected to their Odoo account to credit it and re-try." msgstr "" #: ../../content/developer/api/iap.rst:105 msgid "Building your service" msgstr "" #: ../../content/developer/api/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/api/iap.rst:110 msgid "provide an online service yourself (e.g. convert quotations to faxes for business in Japan);" msgstr "" #: ../../content/developer/api/iap.rst:112 msgid "provide an *offline* service yourself (e.g. provide accountancy service); or" msgstr "" #: ../../content/developer/api/iap.rst:113 msgid "act as intermediary to an other service provider (e.g. bridge to an MMS gateway)." msgstr "" #: ../../content/developer/api/iap.rst:119 msgid "Register the service on Odoo" msgstr "" #: ../../content/developer/api/iap.rst:121 #: ../../content/developer/api/iap.rst:225 #: ../../content/developer/api/iap.rst:409 #: ../../content/developer/api/iap.rst:411 #: ../../content/developer/api/iap.rst:514 #: ../../content/developer/howtos/company.rst:229 #: ../../content/developer/howtos/translations.rst:21 #: ../../content/developer/howtos/web.rst:137 #: ../../content/developer/howtos/web.rst:1878 #: ../../content/developer/howtos/website.rst:490 #: ../../content/developer/reference/backend/actions.rst:176 #: ../../../odoo/odoo/api.py:docstring of odoo.api:3 #: ../../content/developer/reference/backend/orm.rst:637 #: ../../content/developer/reference/backend/orm.rst:639 #: ../../content/developer/reference/backend/orm.rst:832 #: ../../content/developer/reference/backend/orm.rst:989 #: ../../content/developer/reference/backend/security.rst:28 #: ../../content/developer/reference/backend/security.rst:186 #: ../../content/developer/reference/backend/views.rst:13 #: ../../content/developer/reference/backend/views.rst:70 #: ../../content/developer/reference/backend/views.rst:81 #: ../../content/developer/reference/backend/views.rst:179 #: ../../content/developer/reference/backend/views.rst:241 #: ../../content/developer/reference/backend/views.rst:874 #: ../../content/developer/reference/backend/views.rst:998 #: ../../content/developer/reference/backend/views.rst:1000 #: ../../content/developer/reference/backend/views.rst:1569 #: ../../content/developer/reference/backend/views.rst:1664 #: ../../content/developer/reference/backend/views.rst:1682 #: ../../content/developer/reference/backend/views.rst:1811 #: ../../content/developer/reference/frontend/qweb.rst:413 #: ../../content/developer/reference/frontend/qweb.rst:414 #: ../../content/developer/reference/frontend/qweb.rst:476 #: ../../content/developer/reference/frontend/qweb.rst:793 msgid "Todo" msgstr "" #: ../../content/developer/api/iap.rst:121 msgid "complete this part with screenshots" msgstr "" #: ../../content/developer/api/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/api/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/api/iap.rst:136 msgid "Log in then go to :menuselection:`My Account --> Your In-App Services`, click Create and provide the information of your service." msgstr "" #: ../../content/developer/api/iap.rst:140 msgid "The service has *seven* important fields:" msgstr "" #: ../../content/developer/api/iap.rst:142 msgid ":samp:`name` - :class:`ServiceName`: This is the string you will need to provide inside the client's :ref:`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/api/iap.rst:147 msgid ":samp:`label` - :class:`Label`: The name displayed on the shopping portal for the client." msgstr "" #: ../../content/developer/api/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/api/iap.rst:155 msgid ":samp:`icon` - :class:`Icon`: A generic icon that will serve as default for your :ref:`packs `." msgstr "" #: ../../content/developer/api/iap.rst:158 msgid ":samp:`key` - :class:`ServiceKey`: The developer key that identifies you in IAP (see :ref:`your 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/api/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/api/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/api/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/api/iap.rst:189 msgid "You can then create *credit packs* which clients can purchase in order to use your service." msgstr "" #: ../../content/developer/api/iap.rst:195 msgid "Packs" msgstr "" #: ../../content/developer/api/iap.rst:197 msgid "A credit pack is essentially a product with five characteristics:" msgstr "" #: ../../content/developer/api/iap.rst:199 msgid "Name: name of the pack," msgstr "" #: ../../content/developer/api/iap.rst:200 msgid "Icon: specific icon for the pack (if not provided, it will fallback on the service icon)," msgstr "" #: ../../content/developer/api/iap.rst:201 msgid "Description: details on the pack that will appear on the shop page as well as the invoice," msgstr "" #: ../../content/developer/api/iap.rst:203 msgid "Amount: amount of credits the client is entitled to when buying the pack," msgstr "" #: ../../content/developer/api/iap.rst:204 msgid "Price: price in EUR (for the time being, USD support is planned)." msgstr "" #: ../../content/developer/api/iap.rst:208 msgid "Odoo takes a 25% commission on all pack sales. Adjust your selling price accordingly." msgstr "" #: ../../content/developer/api/iap.rst:213 msgid "Depending on the strategy, the price per credit may vary from one pack to another." msgstr "" #: ../../content/developer/api/iap.rst:223 msgid "Odoo App" msgstr "" #: ../../content/developer/api/iap.rst:225 msgid "does this actually require apps?" msgstr "" #: ../../content/developer/api/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/api/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/api/iap.rst:236 #: ../../content/developer/api/iap.rst:251 msgid "`coalroller/__manifest__.py`" msgstr "" #: ../../content/developer/api/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/api/iap.rst:264 msgid "`coalroller/views/res_partner_views.xml`" msgstr "" #: ../../content/developer/api/iap.rst:289 msgid "We can now implement the action method/callback. This will *call our own server*." msgstr "" #: ../../content/developer/api/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/api/iap.rst:299 msgid "In that call, we will need to provide:" msgstr "" #: ../../content/developer/api/iap.rst:301 msgid "any relevant client parameter (none here)," msgstr "" #: ../../content/developer/api/iap.rst:302 msgid "the :class:`token ` 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 ` is the name of the service registered on IAP endpoint." msgstr "" #: ../../content/developer/api/iap.rst:308 msgid "`coalroller/models/res_partner.py`" msgstr "" #: ../../content/developer/api/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/api/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/api/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/api/iap.rst:354 #: ../../content/developer/reference/frontend/javascript_reference.rst:887 msgid "Service" msgstr "" #: ../../content/developer/api/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/api/iap.rst:361 #: ../../content/developer/api/iap.rst:451 msgid "`coalroller_service/__manifest__.py`" msgstr "" #: ../../content/developer/api/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/api/iap.rst:375 #: ../../content/developer/api/iap.rst:464 msgid "`coalroller_service/controllers/main.py`" msgstr "" #: ../../content/developer/api/iap.rst:409 msgid "for the actual IAP will the \"portal\" page be on odoo.com or iap.odoo.com?" msgstr "" #: ../../content/developer/api/iap.rst:411 msgid "\"My Account\" > \"Your InApp Services\"?" msgstr "" #: ../../content/developer/api/iap.rst:414 msgid "The :class:`~odoo.addons.iap.tools.iap_tools.iap_charge` helper will:" msgstr "" #: ../../content/developer/api/iap.rst:416 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/api/iap.rst:419 msgid "execute the body of the ``with`` statement" msgstr "" #: ../../content/developer/api/iap.rst:420 msgid "if the body of the ``with`` executes successfully, update the price of the transaction if needed" msgstr "" #: ../../content/developer/api/iap.rst:422 msgid "capture (confirm) the transaction" msgstr "" #: ../../content/developer/api/iap.rst:423 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/api/iap.rst:428 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/api/iap.rst:433 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/api/iap.rst:438 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/api/iap.rst:443 #: ../../content/developer/reference/backend/reports.rst:197 msgid "``description``" msgstr "" #: ../../content/developer/api/iap.rst:442 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/api/iap.rst:449 msgid "``credit_template``" msgstr "" #: ../../content/developer/api/iap.rst:446 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/api/iap.rst:491 msgid "`coalroller_service/views/no-credit.xml`" msgstr "" #: ../../content/developer/api/iap.rst:514 msgid "how do you test your service?" msgstr "" #: ../../content/developer/api/iap.rst:517 msgid "JSON-RPC2_ Transaction API" msgstr "" #: ../../content/developer/api/iap.rst:522 msgid "The IAP transaction API does not require using Odoo when implementing your server gateway, calls are standard JSON-RPC2_." msgstr "" #: ../../content/developer/api/iap.rst:524 msgid "Calls use different *endpoints* but the same *method* on all endpoints (``call``)." msgstr "" #: ../../content/developer/api/iap.rst:526 msgid "Exceptions are returned as JSON-RPC2_ errors, the formal exception name is available on ``data.name`` for programmatic manipulation." msgstr "" #: ../../content/developer/api/iap.rst:529 msgid "`iap.odoo.com documentation`_ for additional information." msgstr "" #: ../../content/developer/api/iap.rst:532 #: ../../content/developer/api/iap.rst:778 msgid "Authorize" msgstr "" #: ../../content/developer/api/iap.rst:536 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/api/iap.rst:539 msgid "Any amount currently on hold by a pending transaction is considered unavailable to further authorize calls." msgstr "" #: ../../content/developer/api/iap.rst:542 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/api/iap.rst:0 #: ../../content/developer/api/iap.rst:0 #: ../../content/developer/api/iap.rst:0 #: ../../content/developer/api/iap.rst:0 #: ../../content/developer/api/iap.rst:0 #: ../../content/developer/api/iap.rst:0 #: ../../content/developer/api/iap.rst:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel._check_company:0 #: ../../../odoo/odoo/http.py:docstring of odoo.http.route:0 #: ../../../odoo/odoo/http.py:docstring of odoo.http.Request.csrf_token:0 #: ../../../odoo/odoo/http.py:docstring of odoo.http.Request.validate_csrf:0 #: ../../../odoo/odoo/http.py:docstring of odoo.http.Request.make_response:0 #: ../../../odoo/odoo/http.py:docstring of odoo.http.Request.make_json_response:0 #: ../../../odoo/odoo/http.py:docstring of odoo.http.Request.render:0 #: ../../../odoo/odoo/http.py:docstring of odoo.http.JsonRPCDispatcher.handle_error:0 #: ../../../odoo/odoo/http.py:docstring of odoo.http.HttpDispatcher.handle_error:0 #: ../../../odoo/odoo/http.py:docstring of odoo.http.Response:0 #: ../../../odoo/odoo/http.py:docstring of odoo.http.Response.load:0 #: ../../../odoo/odoo/http.py:docstring of odoo.http.Response.set_cookie:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Field:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Field:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Char:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Float:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Binary:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Html:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Image:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Monetary:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Selection:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Text:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.tools.date_utils.add:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Date.context_today:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.tools.date_utils.end_of:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.tools.date_utils.start_of:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.tools.date_utils.subtract:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Date.to_date:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Date.to_string:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.tools.date_utils.add:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Datetime.context_timestamp:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.tools.date_utils.end_of:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.tools.date_utils.start_of:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.tools.date_utils.subtract:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Datetime.to_datetime:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Datetime.to_string:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Many2one:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.One2many:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Many2many:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Many2many:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Many2oneReference:0 #: ../../../odoo/odoo/api.py:docstring of odoo.api.ondelete:0 #: ../../../odoo/odoo/api.py:docstring of odoo.api.returns:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.with_company:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.with_env:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.flush_model:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.flush_recordset:0 #: ../../../odoo/odoo/api.py:docstring of odoo.api.Environment.invalidate_all:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.invalidate_model:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.invalidate_recordset:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.modified:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.create:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.copy:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.default_get:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.name_create:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.write:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.browse:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.search:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.search_count:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.name_search:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.read:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.read_group:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.fields_get:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.get_view:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.filtered:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.filtered_domain:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.mapped:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.sorted:0 #: ../../../odoo/odoo/exceptions.py:docstring of odoo.exceptions.RedirectWarning:0 #: ../../../odoo/odoo/tests/common.py:docstring of odoo.tests.common.BaseCase.browse_ref:0 #: ../../../odoo/odoo/tests/common.py:docstring of odoo.tests.common.BaseCase.ref:0 #: ../../../odoo/odoo/tests/common.py:docstring of odoo.tests.common.BaseCase.browse_ref:0 #: ../../../odoo/odoo/tests/common.py:docstring of odoo.tests.common.BaseCase.ref:0 #: ../../../odoo/odoo/tests/common.py:docstring of odoo.tests.common.BaseCase.browse_ref:0 #: ../../../odoo/odoo/tests/common.py:docstring of odoo.tests.common.BaseCase.ref:0 #: ../../../odoo/odoo/tests/common.py:docstring of odoo.tests.common.Form:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel._populate:0 #: ../../../odoo/odoo/tools/populate.py:docstring of odoo.tools.populate.cartesian:0 #: ../../../odoo/odoo/tools/populate.py:docstring of odoo.tools.populate.compute:0 #: ../../../odoo/odoo/tools/populate.py:docstring of odoo.tools.populate.iterate:0 #: ../../../odoo/odoo/tools/populate.py:docstring of odoo.tools.populate.randint:0 #: ../../../odoo/odoo/tools/populate.py:docstring of odoo.tools.populate.randomize:0 #: ../../content/developer/reference/frontend/framework_overview.rst:0 #: ../../content/developer/reference/frontend/framework_overview.rst:0 #: ../../content/developer/reference/frontend/framework_overview.rst:0 #: ../../content/developer/reference/frontend/framework_overview.rst:0 #: ../../content/developer/reference/frontend/qweb.rst:0 msgid "Parameters" msgstr "" #: ../../content/developer/api/iap.rst:548 msgid "optional, helps users identify the reason for charges on their account" msgstr "" #: ../../content/developer/api/iap.rst:550 msgid "optional, allows the user to benefit from trial credits if his database is eligible (see :ref:`Service registration `)" msgstr "" #: ../../content/developer/api/iap.rst:552 msgid "optional, transaction time to live in hours. If the credit are not captured when the transaction expires, the transaction is cancelled. The default value is set to 4320 hours (= 180 days)." msgstr "" #: ../../content/developer/api/iap.rst:0 #: ../../../odoo/odoo/http.py:docstring of odoo.http.Request.csrf_token:0 #: ../../../odoo/odoo/http.py:docstring of odoo.http.Request.validate_csrf:0 #: ../../../odoo/odoo/http.py:docstring of odoo.http.Request.default_lang:0 #: ../../../odoo/odoo/http.py:docstring of odoo.http.Request.get_http_params:0 #: ../../../odoo/odoo/http.py:docstring of odoo.http.Request.make_response:0 #: ../../../odoo/odoo/http.py:docstring of odoo.http.JsonRPCDispatcher.handle_error:0 #: ../../../odoo/odoo/http.py:docstring of odoo.http.HttpDispatcher.handle_error:0 #: ../../../odoo/odoo/http.py:docstring of odoo.http.Response.load:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../content/developer/reference/backend/mixins.rst:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.tools.date_utils.add:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.tools.date_utils.end_of:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.tools.date_utils.start_of:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.tools.date_utils.subtract:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Date.to_date:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Date.to_string:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.tools.date_utils.add:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Datetime.context_timestamp:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.tools.date_utils.end_of:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.tools.date_utils.start_of:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.tools.date_utils.subtract:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Datetime.to_datetime:0 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Datetime.to_string:0 #: ../../../odoo/odoo/api.py:docstring of odoo.api.Environment.user:0 #: ../../../odoo/odoo/api.py:docstring of odoo.api.Environment.company:0 #: ../../../odoo/odoo/api.py:docstring of odoo.api.Environment.companies:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.create:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.copy:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.default_get:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.name_create:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.browse:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.search:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.name_search:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.read:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.read_group:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.fields_get:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.get_view:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.name_get:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.get_metadata:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.filtered:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.mapped:0 #: ../../../odoo/odoo/tests/common.py:docstring of odoo.tests.common.BaseCase.browse_ref:0 #: ../../../odoo/odoo/tests/common.py:docstring of odoo.tests.common.BaseCase.ref:0 #: ../../../odoo/odoo/tests/common.py:docstring of odoo.tests.common.BaseCase.browse_ref:0 #: ../../../odoo/odoo/tests/common.py:docstring of odoo.tests.common.BaseCase.ref:0 #: ../../../odoo/odoo/tests/common.py:docstring of odoo.tests.common.BaseCase.browse_ref:0 #: ../../../odoo/odoo/tests/common.py:docstring of odoo.tests.common.BaseCase.ref:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel._populate_factories:0 #: ../../../odoo/odoo/tools/populate.py:docstring of odoo.tools.populate.cartesian:0 #: ../../../odoo/odoo/tools/populate.py:docstring of odoo.tools.populate.compute:0 #: ../../../odoo/odoo/tools/populate.py:docstring of odoo.tools.populate.constant:0 #: ../../../odoo/odoo/tools/populate.py:docstring of odoo.tools.populate.iterate:0 #: ../../../odoo/odoo/tools/populate.py:docstring of odoo.tools.populate.randint:0 #: ../../../odoo/odoo/tools/populate.py:docstring of odoo.tools.populate.randomize:0 #: ../../content/developer/reference/frontend/assets.rst:0 #: ../../content/developer/reference/frontend/framework_overview.rst:0 #: ../../content/developer/reference/frontend/framework_overview.rst:0 #: ../../content/developer/reference/frontend/framework_overview.rst:0 #: ../../content/developer/reference/frontend/framework_overview.rst:0 #: ../../content/developer/reference/frontend/framework_overview.rst:0 #: ../../content/developer/reference/frontend/framework_overview.rst:0 #: ../../content/developer/reference/frontend/framework_overview.rst:0 #: ../../content/developer/reference/frontend/framework_overview.rst:0 #: ../../content/developer/reference/frontend/framework_overview.rst:0 #: ../../content/developer/reference/frontend/framework_overview.rst:0 #: ../../content/developer/reference/frontend/framework_overview.rst:0 #: ../../content/developer/reference/frontend/framework_overview.rst:0 #: ../../content/developer/reference/frontend/hooks.rst:0 #: ../../content/developer/reference/frontend/javascript_reference.rst:0 #: ../../content/developer/reference/frontend/javascript_reference.rst:0 #: ../../content/developer/reference/frontend/javascript_reference.rst:0 #: ../../content/developer/reference/frontend/mobile.rst:0 #: ../../content/developer/reference/frontend/mobile.rst:0 #: ../../content/developer/reference/frontend/qweb.rst:0 #: ../../content/developer/reference/frontend/registries.rst:0 #: ../../content/developer/reference/frontend/registries.rst:0 #: ../../content/developer/reference/frontend/registries.rst:0 #: ../../content/developer/reference/frontend/registries.rst:0 #: ../../content/developer/reference/frontend/registries.rst:0 #: ../../content/developer/reference/frontend/registries.rst:0 #: ../../content/developer/reference/frontend/services.rst:0 #: ../../content/developer/reference/frontend/services.rst:0 #: ../../content/developer/reference/frontend/services.rst:0 #: ../../content/developer/reference/frontend/services.rst:0 #: ../../content/developer/reference/frontend/services.rst:0 #: ../../content/developer/reference/frontend/services.rst:0 #: ../../content/developer/reference/frontend/services.rst:0 msgid "Returns" msgstr "" #: ../../content/developer/api/iap.rst:554 msgid ":class:`TransactionToken` if the authorization succeeded" msgstr "" #: ../../content/developer/api/iap.rst:0 #: ../../content/developer/api/iap.rst:0 #: ../../content/developer/api/iap.rst:0 #: ../../content/developer/api/iap.rst:0 #: ../../content/developer/api/iap.rst:0 msgid "raises" msgstr "" #: ../../content/developer/api/iap.rst:555 msgid ":class:`~odoo.exceptions.AccessError` if the service token is invalid" msgstr "" #: ../../content/developer/api/iap.rst:556 msgid ":class:`~odoo.addons.iap.models.iap.InsufficientCreditError` if the account does not have enough credits" msgstr "" #: ../../content/developer/api/iap.rst:557 msgid "``TypeError`` if the ``credit`` value is not an integer or a float" msgstr "" #: ../../content/developer/api/iap.rst:580 #: ../../content/developer/api/iap.rst:858 msgid "Capture" msgstr "" #: ../../content/developer/api/iap.rst:584 msgid "Confirms the specified transaction, transferring the reserved credits from the user's account to the service provider's." msgstr "" #: ../../content/developer/api/iap.rst:587 msgid "Capture calls are idempotent: performing capture calls on an already captured transaction has no further effect." msgstr "" #: ../../content/developer/api/iap.rst:592 msgid "optional parameter to capture a smaller amount of credits than authorized" msgstr "" #: ../../content/developer/api/iap.rst:593 #: ../../content/developer/api/iap.rst:625 msgid ":class:`~odoo.exceptions.AccessError`" msgstr "" #: ../../content/developer/api/iap.rst:613 #: ../../content/developer/api/iap.rst:820 msgid "Cancel" msgstr "" #: ../../content/developer/api/iap.rst:617 msgid "Cancels the specified transaction, releasing the hold on the user's credits." msgstr "" #: ../../content/developer/api/iap.rst:620 msgid "Cancel calls are idempotent: performing capture calls on an already cancelled transaction has no further effect." msgstr "" #: ../../content/developer/api/iap.rst:643 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:127 msgid "Types" msgstr "" #: ../../content/developer/api/iap.rst:645 msgid "Exceptions aside, these are *abstract types* used for clarity, you should not care how they are implemented." msgstr "" #: ../../content/developer/api/iap.rst:650 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/api/iap.rst:655 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/api/iap.rst:658 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/api/iap.rst:662 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/api/iap.rst:668 msgid "Identifier for a user account." msgstr "" #: ../../content/developer/api/iap.rst:672 msgid "Transaction identifier, returned by the authorization process and consumed by either capturing or cancelling the transaction." msgstr "" #: ../../content/developer/api/iap.rst:677 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/api/iap.rst:684 msgid "Raised by:" msgstr "" #: ../../content/developer/api/iap.rst:686 msgid "any operation to which a service token is required, if the service token is invalid; or" msgstr "" #: ../../content/developer/api/iap.rst:687 msgid "any failure in an inter-server call. (typically, in :func:`~odoo.addons.iap.tools.iap_tools.iap_jsonrpc`)." msgstr "" #: ../../content/developer/api/iap.rst:692 msgid "Raised by any unexpected behaviour at the discretion of the App developer (*you*)." msgstr "" #: ../../content/developer/api/iap.rst:696 msgid "Test the API" msgstr "" #: ../../content/developer/api/iap.rst:698 msgid "In order to test the developed app, we propose a sandbox platform that allows you to:" msgstr "" #: ../../content/developer/api/iap.rst:700 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 `)." msgstr "" #: ../../content/developer/api/iap.rst:703 msgid "Test the API." msgstr "" #: ../../content/developer/api/iap.rst:705 msgid "The latter consists in specific tokens that will work on **IAP-Sandbox only**." msgstr "" #: ../../content/developer/api/iap.rst:707 msgid "Token ``000000``: Represents a non-existing account. Returns an :class:`~odoo.addons.iap.tools.iap_tools.InsufficientCreditError` on authorize attempt." msgstr "" #: ../../content/developer/api/iap.rst:709 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/api/iap.rst:711 msgid "Token ``111111``: Represents an account with enough credits to perform any service. An authorize attempt will return a dummy transaction token that is processed by the capture and cancel routes." msgstr "" #: ../../content/developer/api/iap.rst:717 msgid "Those tokens are only active on the IAP-Sanbox server." msgstr "" #: ../../content/developer/api/iap.rst:718 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/api/iap.rst:722 msgid "Odoo Helpers" msgstr "" #: ../../content/developer/api/iap.rst:724 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/api/iap.rst:730 msgid "Charging" msgstr "" #: ../../content/developer/api/iap.rst:734 msgid "A *context manager* for authorizing and automatically capturing or cancelling transactions for use in the backend/proxy." msgstr "" #: ../../content/developer/api/iap.rst:737 msgid "Works much like e.g. a cursor context manager:" msgstr "" #: ../../content/developer/api/iap.rst:739 msgid "immediately authorizes a transaction with the specified parameters;" msgstr "" #: ../../content/developer/api/iap.rst:740 msgid "executes the ``with`` body;" msgstr "" #: ../../content/developer/api/iap.rst:741 msgid "if the body executes in full without error, captures the transaction;" msgstr "" #: ../../content/developer/api/iap.rst:742 msgid "otherwise cancels it." msgstr "" #: ../../content/developer/api/iap.rst:744 #: ../../content/developer/api/iap.rst:784 #: ../../content/developer/api/iap.rst:826 #: ../../content/developer/api/iap.rst:864 msgid "used to retrieve the ``iap.endpoint`` configuration key" msgstr "" #: ../../content/developer/api/iap.rst:782 msgid "Will authorize everything." msgstr "" #: ../../content/developer/api/iap.rst:824 msgid "Will cancel an authorized transaction." msgstr "" #: ../../content/developer/api/iap.rst:862 msgid "Will capture the amount ``credit`` on the given transaction." msgstr "" #: ../../content/developer/cli.rst:6 msgid "Command-line interface (CLI)" msgstr "" #: ../../content/developer/cli.rst:8 msgid "The CLI :dfn:`command-line interface` offers several functionalities related to Odoo. You can use it to :ref:`run the server `, :ref:`launch Odoo as a Python console environment `, :ref:`scaffold an Odoo module `, :ref:`populate a database `, or :ref:`count the number of lines of code `." msgstr "" #: ../../content/developer/cli.rst:15 msgid "The command to use to call the CLI depends on how you installed Odoo. In the examples below, we assume that you are :ref:`running Odoo from source ` with the :file:`odoo-bin` file. If you installed Odoo :ref:`from a distribution package ` or :ref:`with Docker `, you must adapt the command." msgstr "" #: ../../content/developer/cli.rst:23 msgid "Run Odoo from source" msgstr "" #: ../../content/developer/cli.rst:25 msgid "Navigate to the root of the directory where you downloaded the source files of Odoo Community." msgstr "" #: ../../content/developer/cli.rst:27 msgid "Run all CLI commands with :command:`./odoo-bin`" msgstr "" #: ../../content/developer/cli.rst:29 msgid "Odoo was installed from a distribution package" msgstr "" #: ../../content/developer/cli.rst:31 msgid "When Odoo was installed, an executable named `odoo` was added to your user's PATH. Replace all occurrences of :command:`odoo-bin` with :command:`odoo` in the examples below." msgstr "" #: ../../content/developer/cli.rst:34 msgid "Odoo was installed with Docker" msgstr "" #: ../../content/developer/cli.rst:36 msgid "Please refer to the `documentation of the official Docker image of Odoo `_." msgstr "" #: ../../content/developer/cli.rst:42 msgid "Help & version" msgstr "" #: ../../content/developer/cli.rst:48 msgid "shows help text with all available options" msgstr "" #: ../../content/developer/cli.rst:52 msgid "shows Odoo version e.g. \"Odoo Server 13.0\"" msgstr "" #: ../../content/developer/cli.rst:57 msgid "Running the server" msgstr "" #: ../../content/developer/cli.rst:63 msgid "database(s) used when installing or updating modules. Providing a comma-separated list restrict access to databases provided in list." msgstr "" #: ../../content/developer/cli.rst:67 msgid "For advanced database options, take a look :ref:`below `." msgstr "" #: ../../content/developer/cli.rst:71 msgid "comma-separated list of modules to install before running the server (requires :option:`-d`)." msgstr "" #: ../../content/developer/cli.rst:76 msgid "comma-separated list of modules to update before running the server. Use ``all`` for all modules. (requires :option:`-d`)." msgstr "" #: ../../content/developer/cli.rst:81 msgid "comma-separated list of directories in which modules are stored. These directories are scanned for modules." msgstr "" #: ../../content/developer/cli.rst:88 msgid "specify an additional upgrade path." msgstr "" #: ../../content/developer/cli.rst:92 msgid "list of server-wide modules to load. Those modules are supposed to provide features not necessarily tied to a particular database. This is in contrast to modules that are always bound to a specific database when they are installed (i.e. the majority of Odoo addons). Default is ``base,web``." msgstr "" #: ../../content/developer/cli.rst:99 msgid "path to an alternate :ref:`configuration file `. If not defined, Odoo checks ``ODOO_RC`` environmental variable and default location :file:`{$HOME}/.odoorc`. See configuration file section :ref:`below `." msgstr "" #: ../../content/developer/cli.rst:106 msgid "directory path where to store Odoo data (eg. filestore, sessions). If not specified, Odoo will fallback to a predefined path. On Unix systems its one defined in ``$XDG_DATA_HOME`` environmental variable or :file:`~/.local/share/Odoo` or :file:`/var/lib/Odoo`." msgstr "" #: ../../content/developer/cli.rst:114 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/cli.rst:120 msgid "disables demo data loading for modules installed comma-separated, use ``all`` for all modules. Requires :option:`-d` and :option:`-i`." msgstr "" #: ../../content/developer/cli.rst:126 msgid "path to a file where the server pid will be stored" msgstr "" #: ../../content/developer/cli.rst:130 msgid "stops the server after its initialization." msgstr "" #: ../../content/developer/cli.rst:134 msgid "Absolute path to the GeoIP database file." msgstr "" #: ../../content/developer/cli.rst:140 msgid "Testing Configuration" msgstr "" #: ../../content/developer/cli.rst:144 msgid "runs tests after module installation" msgstr "" #: ../../content/developer/cli.rst:148 msgid "runs a python test file" msgstr "" #: ../../content/developer/cli.rst:152 msgid "Comma-separated list of specs to filter which tests to execute. Enable unit tests if set." msgstr "" #: ../../content/developer/cli.rst:154 msgid "Example: `--test-tags :TestClass.test_func,/test_module,external`" msgstr "" #: ../../content/developer/cli.rst:156 msgid "The `-` specifies if we want to include or exclude tests matching this spec." msgstr "" #: ../../content/developer/cli.rst:157 msgid "The tag will match tags added on a class with a :func:`~odoo.tests.common.tagged` decorator (all :ref:`test classes ` have `standard` and `at_install` tags until explicitly removed, see the decorator documentation)." msgstr "" #: ../../content/developer/cli.rst:160 msgid "`*` will match all tags." msgstr "" #: ../../content/developer/cli.rst:161 msgid "If tag is omitted on include mode, its value is `standard`." msgstr "" #: ../../content/developer/cli.rst:162 msgid "If tag is omitted on exclude mode, its value is `*`." msgstr "" #: ../../content/developer/cli.rst:163 msgid "The module, class, and method will respectively match the module name, test class name and test method name." msgstr "" #: ../../content/developer/cli.rst:165 msgid "Filtering and executing the tests happens twice: right after each module installation/update and at the end of the modules loading. At each stage tests are filtered by `--test-tags` specs and additionally by dynamic specs `at_install` and `post_install` correspondingly." msgstr "" #: ../../content/developer/cli.rst:173 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/cli.rst:178 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/cli.rst:185 msgid "Database" msgstr "" #: ../../content/developer/cli.rst:189 msgid "database username, used to connect to PostgreSQL." msgstr "" #: ../../content/developer/cli.rst:193 msgid "database password, if using `password authentication`_." msgstr "" #: ../../content/developer/cli.rst:197 msgid "host for the database server" msgstr "" #: ../../content/developer/cli.rst:199 msgid "``localhost`` on Windows" msgstr "" #: ../../content/developer/cli.rst:200 msgid "UNIX socket otherwise" msgstr "" #: ../../content/developer/cli.rst:204 msgid "port the database listens on, defaults to 5432" msgstr "" #: ../../content/developer/cli.rst:208 msgid "hides databases that do not match ````. The filter is a `regular expression`_, with the additions that:" msgstr "" #: ../../content/developer/cli.rst:211 msgid "``%h`` is replaced by the whole hostname the request is made on." msgstr "" #: ../../content/developer/cli.rst:212 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/cli.rst:216 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/cli.rst:220 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/cli.rst:224 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/cli.rst:232 msgid "Restrict access to databases whose name starts with 11" msgstr "" #: ../../content/developer/cli.rst:238 msgid "Restrict access to only two databases, 11firstdatabase and 11seconddatabase" msgstr "" #: ../../content/developer/cli.rst:244 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/cli.rst:253 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/cli.rst:260 msgid "when creating new databases from the database-management screens, use the specified `template database`_. Defaults to ``template0``." msgstr "" #: ../../content/developer/cli.rst:265 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/cli.rst:271 msgid "Suppresses the ability to list databases available on the system" msgstr "" #: ../../content/developer/cli.rst:275 msgid "Control the SSL security of the connection between Odoo and PostgreSQL. Value should be one of 'disable', 'allow', 'prefer', 'require', 'verify-ca' or 'verify-full' Default value is 'prefer'" msgstr "" #: ../../content/developer/cli.rst:282 msgid "Use the unaccent function provided by the database when available." msgstr "" #: ../../content/developer/cli.rst:287 msgid "Emails" msgstr "" #: ../../content/developer/cli.rst:291 msgid "Email address used as when Odoo needs to send mails" msgstr "" #: ../../content/developer/cli.rst:295 msgid "Define which email address the SMTP configuration will apply to. The field can be a domain name or an entire email address, or it can remain empty. If the sender's email address does not match this set filter, then the email will be encapsulated using a combination of the two system parameters: ``mail.default.from`` and ``mail.catchall.domain``. For example, \"Admin\" => \"Admin\" ." msgstr "" #: ../../content/developer/cli.rst:303 msgid "Address of the SMTP server to connect to in order to send mails" msgstr "" #: ../../content/developer/cli.rst:309 msgid "If set, odoo should use SSL/STARTSSL SMTP connections" msgstr "" #: ../../content/developer/cli.rst:313 msgid "Username to connect to the SMTP server" msgstr "" #: ../../content/developer/cli.rst:317 msgid "Password to connect to the SMTP server" msgstr "" #: ../../content/developer/cli.rst:321 msgid "An SSL certificate is to be used for authentication. If set, then `smtp-ssl-private-key` is required." msgstr "" #: ../../content/developer/cli.rst:326 msgid "An SSL private key is used for authentication. If set, then `smtp-ssl-certificate` is required." msgstr "" #: ../../content/developer/cli.rst:331 msgid "Internationalisation" msgstr "" #: ../../content/developer/cli.rst:333 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/cli.rst:339 msgid "specifies the languages (separated by commas) for the translations you want to be loaded" msgstr "" #: ../../content/developer/cli.rst:344 msgid "specify the language of the translation file. Use it with --i18n-export or --i18n-import" msgstr "" #: ../../content/developer/cli.rst:349 msgid "export all sentences to be translated to a CSV file, a PO file or a TGZ archive and exit." msgstr "" #: ../../content/developer/cli.rst:354 msgid "import a CSV or a PO file with translations and exit. The '-l' option is required." msgstr "" #: ../../content/developer/cli.rst:359 msgid "overwrites existing translation terms on updating a module or importing a CSV or a PO file." msgstr "" #: ../../content/developer/cli.rst:364 msgid "specify modules to export. Use in combination with --i18n-export" msgstr "" #: ../../content/developer/cli.rst:369 msgid "Advanced Options" msgstr "" #: ../../content/developer/cli.rst:374 msgid "Developer features" msgstr "" #: ../../content/developer/cli.rst:378 msgid "comma-separated list of features. For development purposes only. Do not use it in production. Possible features are:" msgstr "" #: ../../content/developer/cli.rst:381 msgid "``all``: all the features below are activated" msgstr "" #: ../../content/developer/cli.rst:383 msgid "``xml``: read QWeb template 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. Particularly, templates are not translated on using this option." msgstr "" #: ../../content/developer/cli.rst:388 msgid "``reload``: restart server when python file are updated (may not be detected depending on the text editor used)" msgstr "" #: ../../content/developer/cli.rst:391 msgid "``qweb``: break in the evaluation of QWeb template when a node contains ``t-debug='debugger'``" msgstr "" #: ../../content/developer/cli.rst:393 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/cli.rst:396 msgid "``werkzeug``: display the full traceback on the frontend page in case of exception" msgstr "" #: ../../content/developer/cli.rst:402 msgid "HTTP" msgstr "" #: ../../content/developer/cli.rst:406 msgid "do not start the HTTP or long-polling workers (may still start :ref:`cron ` workers)" msgstr "" #: ../../content/developer/cli.rst:409 msgid "has no effect if :option:`--test-enable` is set, as tests require an accessible HTTP server" msgstr "" #: ../../content/developer/cli.rst:414 msgid "TCP/IP address on which the HTTP server listens, defaults to ``0.0.0.0`` (all addresses)" msgstr "" #: ../../content/developer/cli.rst:420 msgid "Port on which the HTTP server listens, defaults to 8069." msgstr "" #: ../../content/developer/cli.rst:424 msgid "TCP port for websocket connections in multiprocessing or gevent mode, defaults to 8072. Not used in default (threaded) mode." msgstr "" #: ../../content/developer/cli.rst:429 msgid "enables the use of ``X-Forwarded-*`` headers through `Werkzeug's proxy support`_. Only enable this when running behind a trusted web proxy!" msgstr "" #: ../../content/developer/cli.rst:433 msgid "proxy mode *must not* be enabled outside of a reverse proxy scenario" msgstr "" #: ../../content/developer/cli.rst:438 msgid "delegates serving attachments files to the static web server and sets both ``X-Sendfile`` (apache) and ``X-Accel-*`` (nginx) http headers on stream responses. See :ref:`deploy/streaming` for web server configuration." msgstr "" #: ../../content/developer/cli.rst:445 msgid "Logging" msgstr "" #: ../../content/developer/cli.rst:447 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/cli.rst:454 msgid "sends logging output to the specified file instead of stdout. On Unix, the file `can be managed by external log rotation programs `_ and will automatically be reopened when replaced" msgstr "" #: ../../content/developer/cli.rst:461 msgid "logs to the system's event logger: `syslog on unices `_ and `the Event Log on Windows `_." msgstr "" #: ../../content/developer/cli.rst:464 msgid "Neither is configurable" msgstr "" #: ../../content/developer/cli.rst:468 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/cli.rst:474 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/cli.rst:478 msgid "The colon ``:`` is mandatory" msgstr "" #: ../../content/developer/cli.rst:479 msgid "The logger can be omitted to configure the root (default) handler" msgstr "" #: ../../content/developer/cli.rst:480 msgid "If the level is omitted, the logger is set to ``INFO``" msgstr "" #: ../../content/developer/cli.rst:482 msgid "The option can be repeated to configure multiple loggers e.g." msgstr "" #: ../../content/developer/cli.rst:490 msgid "enable DEBUG logging for RPC requests, equivalent to ``--log-handler=odoo.http.rpc.request:DEBUG``" msgstr "" #: ../../content/developer/cli.rst:495 msgid "enable DEBUG logging for RPC responses, equivalent to ``--log-handler=odoo.http.rpc.response:DEBUG``" msgstr "" #: ../../content/developer/cli.rst:500 msgid "enables DEBUG logging of HTTP requests and responses, equivalent to ``--log-handler=odoo.http:DEBUG``" msgstr "" #: ../../content/developer/cli.rst:505 msgid "enables DEBUG logging of SQL querying, equivalent to ``--log-handler=odoo.sql_db:DEBUG``" msgstr "" #: ../../content/developer/cli.rst:510 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/cli.rst:515 msgid "Odoo also provides debugging pseudo-levels which apply to different sets of loggers:" msgstr "" #: ../../content/developer/cli.rst:520 msgid "``debug_sql``" msgstr "" #: ../../content/developer/cli.rst:519 msgid "sets the SQL logger to ``debug``" msgstr "" #: ../../content/developer/cli.rst:521 msgid "equivalent to ``--log-sql``" msgstr "" #: ../../content/developer/cli.rst:524 msgid "``debug_rpc``" msgstr "" #: ../../content/developer/cli.rst:523 msgid "sets the ``odoo`` and HTTP request loggers to ``debug``" msgstr "" #: ../../content/developer/cli.rst:525 msgid "equivalent to ``--log-level debug --log-request``" msgstr "" #: ../../content/developer/cli.rst:530 msgid "``debug_rpc_answer``" msgstr "" #: ../../content/developer/cli.rst:527 msgid "sets the ``odoo`` and HTTP request and response loggers to ``debug``" msgstr "" #: ../../content/developer/cli.rst:530 msgid "equivalent to ``--log-level debug --log-request --log-response``" msgstr "" #: ../../content/developer/cli.rst:534 msgid "In case of conflict between :option:`--log-level` and :option:`--log-handler`, the latter is used" msgstr "" #: ../../content/developer/cli.rst:540 msgid "Multiprocessing" msgstr "" #: ../../content/developer/cli.rst:544 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/cli.rst:548 msgid "multiprocessing mode is only available on Unix-based systems" msgstr "" #: ../../content/developer/cli.rst:550 msgid "A number of options allow limiting and recycling workers:" msgstr "" #: ../../content/developer/cli.rst:554 msgid "Number of requests a worker will process before being recycled and restarted." msgstr "" #: ../../content/developer/cli.rst:557 msgid "Defaults to *8196*." msgstr "" #: ../../content/developer/cli.rst:561 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/cli.rst:564 msgid "Defaults to *2048MiB*." msgstr "" #: ../../content/developer/cli.rst:568 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/cli.rst:572 msgid "Defaults to *2560MiB*." msgstr "" #: ../../content/developer/cli.rst:576 msgid "Prevents the worker from using more than CPU seconds for each request. If the limit is exceeded, the worker is killed." msgstr "" #: ../../content/developer/cli.rst:579 msgid "Defaults to *60*." msgstr "" #: ../../content/developer/cli.rst:583 msgid "Prevents the worker from taking longer than seconds to process a request. If the limit is exceeded, the worker is killed." msgstr "" #: ../../content/developer/cli.rst:586 msgid "Differs from :option:`--limit-time-cpu` in that this is a \"wall time\" limit including e.g. SQL queries." msgstr "" #: ../../content/developer/cli.rst:589 msgid "Defaults to *120*." msgstr "" #: ../../content/developer/cli.rst:593 msgid "number of workers dedicated to :ref:`cron ` jobs. Defaults to *2*. The workers are threads in multi-threading mode and processes in multi-processing mode." msgstr "" #: ../../content/developer/cli.rst:596 msgid "For multi-processing mode, this is in addition to the HTTP worker processes." msgstr "" #: ../../content/developer/cli.rst:601 msgid "Configuration file" msgstr "" #: ../../content/developer/cli.rst:605 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/cli.rst:610 msgid "Some conversions don't match the pattern:" msgstr "" #: ../../content/developer/cli.rst:612 msgid ":option:`--db-filter` becomes ``dbfilter``" msgstr "" #: ../../content/developer/cli.rst:613 msgid ":option:`--no-http` corresponds to the ``http_enable`` boolean" msgstr "" #: ../../content/developer/cli.rst:614 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/cli.rst:617 msgid ":option:`--smtp` is stored as ``smtp_server``" msgstr "" #: ../../content/developer/cli.rst:618 msgid ":option:`--database` is stored as ``db_name``" msgstr "" #: ../../content/developer/cli.rst:619 msgid ":option:`--i18n-import` and :option:`--i18n-export` aren't available at all from configuration files" msgstr "" #: ../../content/developer/cli.rst:622 msgid "The default configuration file is :file:`{$HOME}/.odoorc` which can be overridden using :option:`--config `. Specifying :option:`--save ` 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/cli.rst:628 msgid "Here is a sample file:" msgstr "" #: ../../content/developer/cli.rst:653 msgid "Shell" msgstr "" #: ../../content/developer/cli.rst:655 msgid "Odoo command-line also allows to launch odoo as a python console environment. This enables direct interaction with the :ref:`orm ` and its functionalities." msgstr "" #: ../../content/developer/cli.rst:665 msgid "Specify a preferred REPL to use in shell mode." msgstr "" #: ../../content/developer/cli.rst:671 msgid "Scaffolding" msgstr "" #: ../../content/developer/cli.rst:675 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/cli.rst:680 msgid "Scaffolding is available via the :command:`odoo-bin scaffold` subcommand." msgstr "" #: ../../content/developer/cli.rst:688 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/cli.rst:693 msgid "directory in which to create the new module, defaults to the current directory" msgstr "" #: ../../content/developer/cli.rst:698 msgid "a template directory, files are passed through jinja2_ then copied to the ``destination`` directory" msgstr "" #: ../../content/developer/cli.rst:702 msgid "This will create module *my_module* in directory */addons/*." msgstr "" #: ../../content/developer/cli.rst:707 msgid "Database Population" msgstr "" #: ../../content/developer/cli.rst:711 msgid "Odoo CLI supports database population features. If the feature is :ref:`implemented on a given model `, 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/cli.rst:721 msgid "list of models for which the database should be filled" msgstr "" #: ../../content/developer/cli.rst:725 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/cli.rst:731 msgid ":ref:`reference/testing/populate`" msgstr "" #: ../../content/developer/cli.rst:736 msgid "Cloc" msgstr "" #: ../../content/developer/cli.rst:740 msgid "Odoo Cloc is a tool to count the number of relevant lines written in Python, Javascript, CSS, SCSS, or XML. This can be used as a rough metric for pricing maintenance of extra modules." msgstr "" #: ../../content/developer/cli.rst:745 msgid "Command-line options" msgstr "" #: ../../content/developer/cli.rst:750 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/cli.rst:752 msgid "The :option:`--addons-path` option is required to specify the path(s) to the module folder(s)." msgstr "" #: ../../content/developer/cli.rst:755 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/cli.rst:762 msgid ":ref:`reference/cmdline/cloc/database-option`" msgstr "" #: ../../content/developer/cli.rst:767 msgid "Process the files in the provided path." msgstr "" #: ../../content/developer/cli.rst:770 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/cli.rst:777 msgid "Multiple paths can be provided by repeating the option." msgstr "" #: ../../content/developer/cli.rst:784 msgid ":ref:`reference/cmdline/cloc/path-option`" msgstr "" #: ../../content/developer/cli.rst:790 msgid "Comma-separated list of directories in which modules are stored. These directories are scanned for modules." msgstr "" #: ../../content/developer/cli.rst:791 msgid "Required if the :option:`--database` option is used." msgstr "" #: ../../content/developer/cli.rst:796 msgid "Specify a configuration file to use in place of the :option:`--addons-path` option." msgstr "" #: ../../content/developer/cli.rst:805 msgid "Show the details of lines counted for each file." msgstr "" #: ../../content/developer/cli.rst:809 msgid "Processed files" msgstr "" #: ../../content/developer/cli.rst:814 msgid "With the :option:`--database` option" msgstr "" #: ../../content/developer/cli.rst:816 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. Finally, it counts the lines of code of Javascript, CSS, and SCSS files, and of QWeb views from imported modules." msgstr "" #: ../../content/developer/cli.rst:822 msgid "Some files are excluded from the count by default:" msgstr "" #: ../../content/developer/cli.rst:824 msgid "The manifest (:file:`__manifest__.py` or :file:`__openerp__.py`)" msgstr "" #: ../../content/developer/cli.rst:825 msgid "The contents of the folder :file:`static/lib`" msgstr "" #: ../../content/developer/cli.rst:826 msgid "The tests defined in the folder :file:`tests` and :file:`static/tests`" msgstr "" #: ../../content/developer/cli.rst:827 msgid "The migrations scripts defined in the folder :file:`migrations` and `upgrades`" msgstr "" #: ../../content/developer/cli.rst:828 msgid "The XML files declared in the ``demo`` or ``demo_xml`` sections of the manifest" msgstr "" #: ../../content/developer/cli.rst:830 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/cli.rst:843 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/cli.rst:845 msgid "For more information about the pattern syntax, see `glob `_." msgstr "" #: ../../content/developer/cli.rst:852 msgid "With the :option:`--path` option" msgstr "" #: ../../content/developer/cli.rst:854 msgid "This method works the same as with the :ref:`--database option ` if a manifest file is present in the given folder. Otherwise, it counts all files." msgstr "" #: ../../content/developer/cli.rst:860 msgid "Identifying Extra Modules" msgstr "" #: ../../content/developer/cli.rst:862 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/cli.rst:869 #: ../../content/developer/reference/frontend/services.rst:662 msgid "Error Handling" msgstr "" #: ../../content/developer/cli.rst:871 msgid "Some file cannot be counted by Odoo Cloc. Those file are reported at the end of the output." msgstr "" #: ../../content/developer/cli.rst:875 msgid "Max file size exceeded" msgstr "" #: ../../content/developer/cli.rst:877 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/cli.rst:880 msgid "A generated XML file that contains lots of data. It should be excluded in the manifest." msgstr "" #: ../../content/developer/cli.rst:881 msgid "A JavaScript library that should be placed in the :file:`static/lib` folder." msgstr "" #: ../../content/developer/cli.rst:884 msgid "Syntax Error" msgstr "" #: ../../content/developer/cli.rst:886 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/cli.rst:893 msgid "TSConfig Generator" msgstr "" #: ../../content/developer/cli.rst:897 msgid "When working on javascript, there are ways to help your editor providing you with powerful auto-completion. One of those ways is the use of a tsconfig.json file. Originally meant for typescript, editors can use its information with plain javascript also. With this config file, you will now have full auto-completion across modules." msgstr "" #: ../../content/developer/cli.rst:902 msgid "The command to generate this files takes as many unnamed arguments as you need. Those are relative paths to your addon directories. In the example below, we move up one folder to save the tsconfig file in the folder containing community and enterprise." 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:5 msgid "Tutorials" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:4 msgid "Accounting localization" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:8 msgid "This tutorial requires knowledge about how to build a module in Odoo (see :doc:`/developer/howtos/backend`)." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:13 msgid "Installation procedure" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:15 msgid "On installing the `account `_ 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. Check `post init hook `_ for details." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:19 msgid "For example, `l10n_ch `_ will be installed if the company has ``Switzerland`` as country." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:22 msgid "Building a localization module" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:24 msgid "The structure of a basic ``l10n_XX`` module may be described with the following :file:`__manifest__.py` file:" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:63 msgid "In the first file :file:`data/account_chart_template_data.xml`, we set the name for the chart of accounts along with some basic fields." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:66 msgid ":ref:`Chart Template References `" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:69 msgid "`addons/l10n_ch/data/l10n_ch_chart_data.xml `_" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:80 msgid "Recommended **xmlid** for the record is `chart_template`. If you need many chart of accounts, you can add some suffixes, i.e. `chart_template_XXX`." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:85 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.chart_template_id:1 msgid "Chart of Accounts" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:88 msgid "Account tags" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:91 msgid ":ref:`Account Tag References `" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:93 msgid "Tags are a way to sort accounts. For example, imagine you want to create a financial report having multiple lines but you have no way to find a rule to dispatch the accounts according to their ``code``. The solution is the usage of tags, one for each report line, to filter accounts like you want." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:97 msgid "Put the tags in the :file:`data/account_account_tag_data.xml` file." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:100 msgid "`addons/l10n_lt/data/account.account.template.csv `_" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:108 #: ../../content/developer/howtos/accounting_localization.rst:138 msgid "`addons/l10n_at/data/account_account_template.xml `_" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:119 msgid "Accounts" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:122 msgid ":ref:`Account References `" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:123 msgid ":doc:`/applications/finance/accounting/getting_started/initial_configuration/chart_of_accounts`" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:125 msgid "Obviously, :guilabel:`Chart of Accounts` cannot exist without :guilabel:`Accounts`. You need to specify them in :file:`data/account.account.template.csv`." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:128 msgid "`addons/l10n_ch/data/account.account.template.csv `_" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:135 msgid "CSV is prefered but you may use XML format instead." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:148 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/howtos/accounting_localization.rst:150 msgid "Only one account of type payable/receivable is enough for the generic case. We need to define a PoS receivable account as well however. (linked in the CoA)" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:151 msgid "Don't create too many accounts: 200-300 is enough. But mostly, we try to find a good balance where the CoA needs minimal adapting for most companies afterwards." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:153 msgid "Next settings for the chart of accounts are set in a separate file, because we need to provide a :ref:`list of accounts ` first. In :file:`data/account_chart_post_data.xml`, we set some default accounts:" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:158 msgid "`addons/l10n_ch/data/l10n_ch_chart_post_data.xml `_" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:168 msgid "Account groups" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:171 msgid ":ref:`Account Group References `" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:173 msgid "Account groups allow describing the hierarchical structure of the chart of accounts. The filter needs to be activated in the report and then when you decollapse into journal entries it will show the parents of the account." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:175 msgid "It works with the prefix *start*/*end*, so every account where the code starts with something between *start* and *end* will have this account.group as the parent group. Furthermore, the account groups can have a parent account group as well to form the hierarchy." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:179 msgid "`addons/l10n_il/data/account.group.template.csv `_" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:303 #: ../../content/developer/reference/backend/data/res.country.state.csv:1 msgid "id" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "code_prefix_start" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "code_prefix_end" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:182 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:255 #: ../../content/developer/howtos/rdtraining/08_relations.rst:73 #: ../../content/developer/howtos/rdtraining/08_relations.rst:180 #: ../../content/developer/howtos/rdtraining/C_data.rst:178 #: ../../content/developer/reference/backend/data/res.country.state.csv:1 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountAccountTemplate.name:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountAccountTemplate.currency_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountAccountTemplate.code:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountAccountTemplate.account_type:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountAccountTemplate.reconcile:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountAccountTemplate.note:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountAccountTemplate.tax_ids:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountAccountTemplate.nocreate:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountAccountTemplate.chart_template_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountAccountTemplate.tag_ids:0 #: ../../../odoo/addons/account/models/account_account_tag.py:docstring of odoo.addons.account.models.account_account_tag.AccountAccountTag.name:0 #: ../../../odoo/addons/account/models/account_account_tag.py:docstring of odoo.addons.account.models.account_account_tag.AccountAccountTag.applicability:0 #: ../../../odoo/addons/account/models/account_account_tag.py:docstring of odoo.addons.account.models.account_account_tag.AccountAccountTag.color:0 #: ../../../odoo/addons/account/models/account_account_tag.py:docstring of odoo.addons.account.models.account_account_tag.AccountAccountTag.active:0 #: ../../../odoo/addons/account/models/account_account_tag.py:docstring of odoo.addons.account.models.account_account_tag.AccountAccountTag.tax_negate:0 #: ../../../odoo/addons/account/models/account_account_tag.py:docstring of odoo.addons.account.models.account_account_tag.AccountAccountTag.country_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.name:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.parent_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.code_digits:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.visible:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.currency_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.country_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.use_anglo_saxon:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.bank_account_code_prefix:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.cash_account_code_prefix:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.transfer_account_code_prefix:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.account_ids:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.income_currency_exchange_account_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.expense_currency_exchange_account_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.account_journal_suspense_account_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.account_journal_payment_debit_account_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.account_journal_payment_credit_account_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.default_cash_difference_income_account_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.default_cash_difference_expense_account_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.default_pos_receivable_account_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.property_account_receivable_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.property_account_payable_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.property_account_expense_categ_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.property_account_income_categ_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.property_account_expense_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.property_account_income_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.property_stock_account_input_categ_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.property_stock_account_output_categ_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.property_stock_valuation_account_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.property_tax_payable_account_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.property_tax_receivable_account_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.property_advance_tax_payment_account_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.property_cash_basis_base_account_id:0 #: ../../../odoo/addons/l10n_multilang/models/account.py:docstring of odoo.addons.l10n_multilang.models.account.AccountChartTemplate.spoken_languages:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountFiscalPositionTemplate.sequence:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountFiscalPositionTemplate.name:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountFiscalPositionTemplate.chart_template_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountFiscalPositionTemplate.account_ids:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountFiscalPositionTemplate.tax_ids:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountFiscalPositionTemplate.note:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountFiscalPositionTemplate.auto_apply:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountFiscalPositionTemplate.vat_required:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountFiscalPositionTemplate.country_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountFiscalPositionTemplate.country_group_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountFiscalPositionTemplate.state_ids:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountFiscalPositionTemplate.zip_from:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountFiscalPositionTemplate.zip_to:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountGroupTemplate.parent_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountGroupTemplate.name:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountGroupTemplate.code_prefix_start:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountGroupTemplate.code_prefix_end:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountGroupTemplate.chart_template_id:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.name:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.line_ids:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.column_ids:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.root_report_id:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.chart_template_id:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.country_id:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.only_tax_exigible:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.availability_condition:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.load_more_limit:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.search_bar:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.default_opening_date_filter:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.filter_multi_company:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.filter_date_range:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.filter_show_draft:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.filter_unreconciled:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.filter_unfold_all:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.filter_period_comparison:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.filter_growth_comparison:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.filter_journals:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.filter_analytic:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.filter_hierarchy:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.filter_account_type:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.filter_partner:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.filter_fiscal_position:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReportLine.name:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReportLine.expression_ids:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReportLine.report_id:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReportLine.hierarchy_level:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReportLine.parent_id:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReportLine.children_ids:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReportLine.foldable:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReportLine.print_on_new_page:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReportLine.action_id:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReportLine.hide_if_zero:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.chart_template_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.name:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.type_tax_use:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.tax_scope:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.amount_type:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.active:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.children_tax_ids:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.sequence:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.amount:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.description:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.price_include:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.include_base_amount:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.is_base_affected:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.analytic:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.invoice_repartition_line_ids:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.refund_repartition_line_ids:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.tax_group_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.tax_exigibility:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.cash_basis_transition_account_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxRepartitionLineTemplate.factor_percent:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxRepartitionLineTemplate.repartition_type:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxRepartitionLineTemplate.account_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxRepartitionLineTemplate.invoice_tax_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxRepartitionLineTemplate.refund_tax_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxRepartitionLineTemplate.tag_ids:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxRepartitionLineTemplate.use_in_tax_closing:0 msgid "name" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "chart_template_id/id" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "il_group_100100" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "100100" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "100499" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "Fixed Assets" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "l10n_il.il_chart_template" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "il_group_101110" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "101110" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "101400" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "Current Assets" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "il_group_101401" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "101401" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "101799" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "Bank And Cash" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "il_group_111000" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "111000" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "111999" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "Current Liabilities" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "il_group_112000" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "112000" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "112210" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "Non-current Liabilities" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "il_group_200000" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "200000" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "200199" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "Sales Income" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "il_group_200200" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "200200" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "200300" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "Other Income" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "il_group_201000" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "201000" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "201299" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "Cost of Goods" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "il_group_202000" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "202000" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "220900" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "Expenses" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "il_group_300000" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "300000" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "399999" msgstr "" #: ../../../odoo/addons/l10n_il/data/account.group.template.csv:1 msgid "Capital And Shares" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:188 #: ../../content/developer/reference/standard_modules/account/account_tax.rst:5 msgid "Taxes" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:191 msgid ":ref:`Tax References `" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:192 msgid ":doc:`/applications/finance/accounting/taxation/taxes/taxes`" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:194 msgid "To add taxes you first need to specify tax groups. You normally need just one tax group for every tax rate, except for the 0% as you need to often distinguish between exempt, 0%, not subject, ... taxes. This model only has two required fields: *name* and *country*. Create the file :file:`data/account_tax_group_data.xml` and list the groups:" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:211 msgid "`addons/l10n_ch/data/account_tax_group_data.xml `_" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:220 msgid "`addons/l10n_uk/data/account.tax.group.csv `_" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:227 msgid "Now you can add the taxes via :file:`data/account_tax_template_data.xml` file. The first tax you define that is purchase/sale also becomes the default purchase/sale tax for your products." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:231 msgid "`addons/l10n_ae/data/account_tax_template_data.xml `_" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:239 msgid "If some accounts should use default taxes, you can set them up in :file:`data/account_account_template_post_data.xml`" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:242 msgid "Tax Report" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:248 msgid "The tax report is declared in the :guilabel:`Invoicing` (`account`) app, but the report is only accessible when :guilabel:`Accounting` (`account_accountant`) is installed." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:251 #: ../../content/developer/howtos/accounting_localization.rst:376 msgid ":doc:`/developer/reference/standard_modules/account/account_report_line`" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:252 msgid ":doc:`/applications/finance/accounting/reporting/declarations/tax_returns`" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:254 msgid "In the previous section, you noticed the fields `invoice_repartition_line_ids` or `refund_repartition_line_ids` and probably understood nothing about them. Good news: you are not alone on this incomprehension. Bad news: you have to figure it out a bit. The topic is complicated. Indeed:" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:259 msgid "The simple version is that, in the tax template, you indicate in the invoice/refund repartition lines whether the base or a percentage of the tax needs to be reported in which report line (through the *minus/plus_report_line_ids* fields). It becomes clear also when you check the tax configuration in the Odoo interface (or check the docs :ref:`Tax References `, :ref:`Tax Repartition References `)." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:262 msgid "So, once you have properly configured taxes, you just need to add the :file:`data/account_tax_report_data.xml` file with a record for your `account.report`. For it to be considered as a tax report, you need to provide it with the right `root_report_id`." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:276 msgid "... followed by the declaration of its lines, as `account.report.line` records." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:279 msgid "`addons/l10n_au/data/account_tax_report_data.xml `_" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:290 msgid "Fiscal positions" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:293 msgid ":ref:`Fiscal Position References `" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:294 msgid ":doc:`/applications/finance/accounting/taxation/taxes/fiscal_positions`" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:296 msgid "Specify fiscal positions in the :file:`data/account_fiscal_position_template_data.xml` file." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:299 msgid "`addons/l10n_es/data/account_fiscal_position_template_data.xml `_" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:308 msgid "Final steps" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:310 msgid "The last step when installing a localization module is to try to apply its chart of accounts to the current company (if it does not already have one). The file :file:`data/account_chart_template_try_loading.xml` is responsible for that." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:314 msgid "`addons/l10n_ch/data/account_chart_template_data.xml `_" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:322 msgid "Finally, you may add a demo company, so the localization can easily be tested in demo mode." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:325 msgid "`addons/l10n_ch/demo/demo_company.xml `_" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:334 msgid "Accounting reports" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:341 msgid ":doc:`/applications/finance/accounting/reporting/overview`" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:343 msgid "Accounting reports should be added via a separate module `l10n_XX_reports` that should go to the `enterprise repository `_." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:345 msgid "Basic :file:`__manifest__.py` file for such a module looks as following:" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:366 msgid "Functional overview of financial reports is here: :doc:`/applications/finance/accounting/reporting/overview/main_reports`." msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:368 msgid "Some good examples:" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:370 msgid "`l10n_ch_reports/data/account_financial_html_report_data.xml `_" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:371 msgid "`l10n_be_reports/data/account_financial_html_report_data.xml `_" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:373 msgid "You can check the meaning of the fields here:" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:375 msgid ":doc:`/developer/reference/standard_modules/account/account_report`" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:378 msgid "If you gave a `root_report_id` to your report, it is now available in its variant selector. If not, you still need to add a menu item for it. A default menu item can be created from the form view of the report, by clicking on 'Actions', then 'Create Menu Item'. You'll then need to refresh the page to see it. Alternatively, to create a dedicated section for a totally new report in the :guilabel:`Reporting` menu, you need to create a new `ir.ui.menu` record (usually in the main `l10n_XX` module) and a new `ir.actions.client` (usually in the new report xml file) that calls the `account.report` with the new report id. Then, set the new menu as `parent_id` field in the action model. Example for the Belgian localization:" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:380 msgid "`ir.ui.menu record in l10n_be `_" msgstr "" #: ../../content/developer/howtos/accounting_localization.rst:381 msgid "`parent_id field in l10n_be_reports (v16) `_" 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 `" 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 ` 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 #: ../../content/developer/howtos/rdtraining/01_architecture.rst:58 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 #: ../../content/developer/howtos/rdtraining/01_architecture.rst:68 msgid ":ref:`Object views `" msgstr "" #: ../../content/developer/howtos/backend.rst:57 msgid "Definition of business objects UI display" msgstr "" #: ../../content/developer/howtos/backend.rst:65 #: ../../content/developer/howtos/rdtraining/01_architecture.rst:76 msgid ":ref:`Data files `" msgstr "" #: ../../content/developer/howtos/backend.rst:60 msgid "XML or CSV files declaring the model metadata :" msgstr "" #: ../../content/developer/howtos/backend.rst:62 #: ../../content/developer/howtos/rdtraining/01_architecture.rst:73 msgid ":ref:`views ` or :ref:`reports `," msgstr "" #: ../../content/developer/howtos/backend.rst:63 #: ../../content/developer/howtos/rdtraining/01_architecture.rst:74 msgid "configuration data (modules parametrization, :ref:`security rules `)," msgstr "" #: ../../content/developer/howtos/backend.rst:64 #: ../../content/developer/howtos/rdtraining/01_architecture.rst:75 msgid "demonstration data" msgstr "" #: ../../content/developer/howtos/backend.rst:65 #: ../../content/developer/howtos/rdtraining/01_architecture.rst:76 msgid "and more" msgstr "" #: ../../content/developer/howtos/backend.rst:68 #: ../../content/developer/howtos/rdtraining/01_architecture.rst:79 msgid ":ref:`Web controllers `" msgstr "" #: ../../content/developer/howtos/backend.rst:68 #: ../../content/developer/howtos/rdtraining/01_architecture.rst:79 msgid "Handle requests from web browsers" msgstr "" #: ../../content/developer/howtos/backend.rst:71 #: ../../content/developer/howtos/rdtraining/01_architecture.rst:82 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/howtos/rdtraining/01_architecture.rst:91 msgid "Module structure" msgstr "" #: ../../content/developer/howtos/backend.rst:76 #: ../../content/developer/howtos/rdtraining/01_architecture.rst:93 msgid "Each module is a directory within a *module directory*. Module directories are specified by using the :option:`--addons-path ` option." msgstr "" #: ../../content/developer/howtos/backend.rst:83 msgid "most command-line options can also be set using :ref:`a configuration file `" msgstr "" #: ../../content/developer/howtos/backend.rst:86 #: ../../content/developer/howtos/rdtraining/01_architecture.rst:97 msgid "An Odoo module is declared by its :ref:`manifest `." msgstr "" #: ../../content/developer/howtos/backend.rst:88 msgid "A module is also a `Python package `_ 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 ` has a subcommand :ref:`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 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:17 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 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:107 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 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:212 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 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:236 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 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:239 msgid "The label of the field in UI (visible by users)." msgstr "" #: ../../content/developer/howtos/backend.rst:162 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:241 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 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:246 msgid ":attr:`~odoo.fields.Field.index` (``bool``, default: ``False``)" msgstr "" #: ../../content/developer/howtos/backend.rst:167 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:246 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 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:272 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 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:274 msgid ":attr:`~odoo.fields.Model.create_date` (:class:`~odoo.fields.Datetime`)" msgstr "" #: ../../content/developer/howtos/backend.rst:189 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:275 msgid "Creation date of the record." msgstr "" #: ../../content/developer/howtos/backend.rst:190 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:276 msgid ":attr:`~odoo.fields.Model.create_uid` (:class:`~odoo.fields.Many2one`)" msgstr "" #: ../../content/developer/howtos/backend.rst:191 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:277 msgid "User who created the record." msgstr "" #: ../../content/developer/howtos/backend.rst:192 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:278 msgid ":attr:`~odoo.fields.Model.write_date` (:class:`~odoo.fields.Datetime`)" msgstr "" #: ../../content/developer/howtos/backend.rst:193 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:279 msgid "Last modification date of the record." msgstr "" #: ../../content/developer/howtos/backend.rst:195 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:282 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 `, XML files with ```` elements. Each ```` 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 "```` 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 ` 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 #: ../../content/developer/howtos/rdtraining/06_firstui.rst:63 msgid "by clicking on menu items (linked to specific actions)" msgstr "" #: ../../content/developer/howtos/backend.rst:263 #: ../../content/developer/howtos/rdtraining/06_firstui.rst:64 msgid "by clicking on buttons in views (if these are connected to actions)" msgstr "" #: ../../content/developer/howtos/backend.rst:264 #: ../../content/developer/howtos/rdtraining/06_firstui.rst:65 msgid "as contextual actions on object" msgstr "" #: ../../content/developer/howtos/backend.rst:266 msgid "Because menus are somewhat complex to declare there is a ```` 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 ` 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 ````. 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 #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:85 msgid "Forms are used to create and edit single records." msgstr "" #: ../../content/developer/howtos/backend.rst:356 msgid "Their root element is ``
``. 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 ```` 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/frontend/javascript_reference.rst:1855 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') `" 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 `_" msgstr "" #: ../../content/developer/howtos/backend.rst:486 msgid ":class:`One2many(other_model, related_field) `" 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) `" 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/backend/views.rst:184 #: ../../content/developer/reference/frontend/javascript_reference.rst:199 msgid "Inheritance" msgstr "" #: ../../content/developer/howtos/backend.rst:525 msgid "Model inheritance" msgstr "" #: ../../content/developer/howtos/backend.rst:527 #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:114 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 #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:203 msgid "``expr``" msgstr "" #: ../../content/developer/howtos/backend.rst:579 #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:203 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 #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:219 msgid "``position``" msgstr "" #: ../../content/developer/howtos/backend.rst:582 #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:206 msgid "Operation to apply to the matched element:" msgstr "" #: ../../content/developer/howtos/backend.rst:584 #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:208 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/howtos/rdtraining/13_inheritance.rst:211 #: ../../content/developer/reference/backend/views.rst:284 #: ../../content/developer/reference/frontend/qweb.rst:902 msgid "``replace``" msgstr "" #: ../../content/developer/howtos/backend.rst:587 #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:211 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/howtos/rdtraining/13_inheritance.rst:213 #: ../../content/developer/reference/backend/views.rst:290 #: ../../content/developer/reference/frontend/qweb.rst:896 msgid "``before``" msgstr "" #: ../../content/developer/howtos/backend.rst:590 #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:214 msgid "inserts the ``xpath``'s body as a sibling before the matched element" msgstr "" #: ../../content/developer/howtos/backend.rst:591 #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:215 #: ../../content/developer/reference/backend/views.rst:287 #: ../../content/developer/reference/frontend/qweb.rst:898 msgid "``after``" msgstr "" #: ../../content/developer/howtos/backend.rst:592 #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:216 msgid "inserts the ``xpaths``'s body as a sibling after the matched element" msgstr "" #: ../../content/developer/howtos/backend.rst:595 #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:219 #: ../../content/developer/reference/backend/views.rst:315 #: ../../content/developer/reference/frontend/qweb.rst:907 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 #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:193 #: ../../content/developer/reference/frontend/framework_overview.rst:370 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 #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:59 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 #: ../../content/developer/howtos/rdtraining/08_relations.rst:115 msgid "The object ``self.env`` gives access to request parameters and other useful things:" msgstr "" #: ../../content/developer/howtos/backend.rst:741 #: ../../content/developer/howtos/rdtraining/08_relations.rst:118 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 #: ../../content/developer/howtos/rdtraining/08_relations.rst:120 msgid "``self.env.uid`` or ``self._uid`` is the current user's database id" msgstr "" #: ../../content/developer/howtos/backend.rst:744 #: ../../content/developer/howtos/rdtraining/08_relations.rst:121 msgid "``self.env.user`` is the current user's record" msgstr "" #: ../../content/developer/howtos/backend.rst:745 #: ../../content/developer/howtos/rdtraining/08_relations.rst:122 msgid "``self.env.context`` or ``self._context`` is the context dictionary" msgstr "" #: ../../content/developer/howtos/backend.rst:746 #: ../../content/developer/howtos/rdtraining/08_relations.rst:123 msgid "``self.env.ref(xml_id)`` returns the record corresponding to an XML id" msgstr "" #: ../../content/developer/howtos/backend.rst:747 #: ../../content/developer/howtos/rdtraining/08_relations.rst:124 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 #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:0 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 #: ../../content/developer/howtos/rdtraining/11_constraints.rst:12 msgid "Odoo provides two ways to set up automatically verified invariants: :func:`Python constraints ` and :attr:`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/backend/views.rst:1049 #: ../../content/developer/reference/backend/views.rst:1733 #: ../../content/developer/reference/backend/views.rst:1864 msgid "``decoration-{$name}``" msgstr "" #: ../../content/developer/howtos/backend.rst:861 #: ../../content/developer/reference/backend/views.rst:1036 #: ../../content/developer/reference/backend/views.rst:1729 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/backend/views.rst:104 #: ../../content/developer/reference/backend/views.rst:1039 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/backend/views.rst:109 #: ../../content/developer/reference/backend/views.rst:1044 msgid "``uid``: the id of the current user," msgstr "" #: ../../content/developer/howtos/backend.rst:870 #: ../../content/developer/reference/backend/views.rst:110 #: ../../content/developer/reference/backend/views.rst:1045 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/backend/views.rst:111 #: ../../content/developer/reference/backend/views.rst:1046 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 `_ (``danger``, ``info``, ``muted``, ``primary``, ``success`` or ``warning``)." msgstr "" #: ../../content/developer/howtos/backend.rst:890 #: ../../content/developer/reference/backend/views.rst:1713 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 ```` and their most common attributes are:" msgstr "" #: ../../content/developer/howtos/backend.rst:907 #: ../../content/developer/reference/backend/views.rst:434 #: ../../content/developer/reference/backend/views.rst:1033 #: ../../content/developer/reference/backend/views.rst:2420 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/backend/views.rst:957 #: ../../content/developer/reference/backend/views.rst:1090 #: ../../content/developer/reference/backend/views.rst:1378 #: ../../content/developer/reference/backend/views.rst:1761 #: ../../content/developer/reference/backend/views.rst:1823 #: ../../content/developer/reference/backend/views.rst:2034 #: ../../content/developer/reference/backend/views.rst:2202 #: ../../content/developer/reference/backend/views.rst:2414 #: ../../content/developer/reference/frontend/services.rst:870 #: ../../content/developer/reference/frontend/services.rst:873 #: ../../content/developer/reference/frontend/services.rst:879 #: ../../content/developer/reference/frontend/services.rst:885 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 ```` 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 #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:180 msgid "Search views can also contain ```` 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/backend/views.rst:908 #: ../../content/developer/reference/backend/views.rst:1426 #: ../../content/developer/reference/backend/views.rst:1475 #: ../../content/developer/reference/backend/views.rst:1488 #: ../../content/developer/reference/backend/views.rst:2156 #: ../../content/developer/reference/backend/views.rst:2237 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:1710 #: ../../content/developer/reference/backend/data.rst:72 #: ../../content/developer/reference/backend/views.rst:910 #: ../../content/developer/reference/backend/views.rst:1635 #: ../../content/developer/reference/backend/views.rst:1809 #: ../../content/developer/reference/backend/views.rst:1946 #: ../../content/developer/reference/backend/views.rst:2158 #: ../../content/developer/reference/backend/views.rst:2230 #: ../../content/developer/reference/backend/views.rst:2337 #: ../../content/developer/reference/frontend/services.rst:854 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/backend/views.rst:1005 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 ` version." msgstr "" #: ../../content/developer/howtos/backend.rst:984 msgid "Horizontal bar charts typically used to show project planning and advancement, their root element is ````." 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 ````." msgstr "" #: ../../content/developer/howtos/backend.rst:1007 msgid "Pivot views (element ````) 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 ````" 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 ```` with a mandatory ``@type`` attribute taking the values:" msgstr "" #: ../../content/developer/howtos/backend.rst:1029 #: ../../content/developer/reference/backend/views.rst:2086 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/backend/views.rst:2090 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/backend/views.rst:1521 msgid "Kanban" msgstr "" #: ../../content/developer/howtos/backend.rst:1054 msgid "Used to organize tasks, production processes, etc… their root element is ````." 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 #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:0 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 ` with a ``target`` field set to the value ``new``, which opens the view (usually :ref:`a 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 `__, 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 ` 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/backend/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/backend/reports.rst:31 #: ../../content/developer/reference/backend/security.rst:124 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:1372 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:288 msgid "it is possible to :ref:`disable the automatic creation of some fields `" msgstr "" #: ../../content/developer/howtos/backend.rst:1374 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 ` 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 `" msgstr "" #: ../../content/developer/howtos/company.rst:25 msgid ":ref:`Multi-company consistency `" msgstr "" #: ../../content/developer/howtos/company.rst:26 msgid ":ref:`Default company `" msgstr "" #: ../../content/developer/howtos/company.rst:27 msgid ":ref:`Views `" msgstr "" #: ../../content/developer/howtos/company.rst:28 msgid ":ref:`Security rules `" 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 "" #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel._check_company:1 msgid "Check the companies of the values of the given field names." msgstr "" #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel._check_company:3 msgid "names of relational fields to check" msgstr "" #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel._check_company:0 #: ../../../odoo/odoo/http.py:docstring of odoo.http.Response.load:0 #: ../../../odoo/odoo/api.py:docstring of odoo.api.Environment.company:0 #: ../../../odoo/odoo/api.py:docstring of odoo.api.Environment.companies:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.create:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.write:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.search:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.read:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.read_group:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.get_view:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.unlink:0 #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel.ensure_one:0 #: ../../../odoo/odoo/tests/common.py:docstring of odoo.tests.common.Form.save:0 #: ../../../odoo/odoo/tests/common.py:docstring of odoo.tests.common.O2MProxy.edit:0 #: ../../../odoo/odoo/tests/common.py:docstring of odoo.tests.common.O2MProxy.new:0 #: ../../../odoo/odoo/tests/common.py:docstring of odoo.tests.common.O2MProxy.remove:0 msgid "Raises" msgstr "" #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel._check_company:4 msgid "if the `company_id` of the value of any field is not in `[False, self.company_id]` (or `self` if :class:`~odoo.addons.base.models.res_company`)." msgstr "" #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel._check_company:8 msgid "For :class:`~odoo.addons.base.models.res_users` relational fields, verifies record company is in `company_ids` fields." msgstr "" #: ../../../odoo/odoo/models.py:docstring of odoo.models.BaseModel._check_company:11 msgid "User with main company A, having access to company A and B, could be assigned or linked to records in company B." 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/backend/views.rst:6 #: ../../content/developer/reference/frontend/javascript_reference.rst:1210 msgid "Views" msgstr "" #: ../../content/developer/howtos/company.rst:170 msgid "As stated in :ref:`above `, 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 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 ` and :doc:`writing Odoo code `" 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 stuck, 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 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/rdtraining.rst:39 #: ../../content/developer/howtos/rdtraining.rst:69 #: ../../content/developer/howtos/rdtraining.rst:39 #: ../../content/developer/howtos/rdtraining.rst:69 msgid "Advanced Topics" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:7 msgid "Getting started" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:9 msgid "Welcome to the Getting Started Odoo tutorial! If you reached this page that means you are interested in the development of your own Odoo module. It might also mean that you recently joined the Odoo company for a rather technical position. In any case, your journey to the technical side of Odoo starts here." msgstr "" #: ../../content/developer/howtos/rdtraining.rst:14 msgid "This training is split in two parts:" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:16 msgid "The first part is the :ref:`core training `. Its objective is to give you an insight of the most important parts of the Odoo development framework. The chapters should be followed in their given order since they cover the development of a new Odoo application from scratch in an incremental way. In other words, each chapter depends on the previous one." msgstr "" #: ../../content/developer/howtos/rdtraining.rst:20 msgid "The second part covers a set of :ref:`advanced topics `. Each topic can be followed independently, but requires the :ref:`core training `." msgstr "" #: ../../content/developer/howtos/rdtraining.rst:25 msgid "Are you following this training as part of your technical onboarding as an Odoo employee? Then, we ask you to complete the first part of the training before joining your new team and the second part the month after." msgstr "" #: ../../content/developer/howtos/rdtraining.rst:29 msgid "All topics are built around a business case we will enhance along the way. The reader is expected to actively take part in the training by writing the solution for each exercise." msgstr "" #: ../../content/developer/howtos/rdtraining.rst:32 msgid "Ready? Let's get started!" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:37 msgid "Core training" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:47 msgid ":doc:`rdtraining/01_architecture`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:48 msgid ":doc:`rdtraining/02_setup`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:49 msgid ":doc:`rdtraining/03_newapp`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:50 msgid ":doc:`rdtraining/04_basicmodel`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:51 msgid ":doc:`rdtraining/05_securityintro`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:52 msgid ":doc:`rdtraining/06_firstui`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:53 msgid ":doc:`rdtraining/07_basicviews`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:54 msgid ":doc:`rdtraining/08_relations`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:55 msgid ":doc:`rdtraining/09_compute_onchange`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:56 msgid ":doc:`rdtraining/10_actions`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:57 msgid ":doc:`rdtraining/11_constraints`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:58 msgid ":doc:`rdtraining/12_sprinkles`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:59 msgid ":doc:`rdtraining/13_inheritance`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:60 msgid ":doc:`rdtraining/14_other_module`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:61 msgid ":doc:`rdtraining/15_qwebintro`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:62 msgid ":doc:`rdtraining/16_guidelines_pr`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:67 msgid "Advanced topics" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:81 msgid ":doc:`rdtraining/B_acl_irrules`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:82 msgid ":doc:`rdtraining/C_data`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:83 msgid ":doc:`rdtraining/D_mixins`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:84 msgid ":doc:`rdtraining/E_unittest`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:85 msgid ":doc:`rdtraining/J_reports`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:86 msgid ":doc:`rdtraining/K_dashboard`" msgstr "" #: ../../content/developer/howtos/rdtraining.rst:87 msgid ":doc:`rdtraining/N_security`" msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:5 msgid "Chapter 1: Architecture Overview" msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:8 msgid "Multitier application" msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:10 msgid "Odoo follows a `multitier architecture`_, meaning that the presentation, the business logic and the data storage are separated. More specifically, it uses a three-tier architecture (image from Wikipedia):" msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:None msgid "Three-tier architecture" msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:18 msgid "The presentation tier is a combination of HTML5, JavaScript and CSS. The logic tier is exclusively written in Python, while the data tier only supports PostgreSQL as an RDBMS." msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:21 msgid "Depending on the scope of your module, Odoo development can be done in any of these tiers. Therefore, before going any further, it may be a good idea to refresh your memory if you don't have an intermediate level in these topics." msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:25 msgid "In order to go through this tutorial, you will need a very basic knowledge of HTML and an intermediate level of Python. Advanced topics will require more knowledge in the other subjects. There are plenty of tutorials freely accessible, so we cannot recommend one over another since it depends on your background." msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:30 msgid "For reference this is the official `Python tutorial`_." msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:33 msgid "Since version 15.0, Odoo is actively transitioning to using its own in-house developed `OWL framework `_ as part of its presentation tier. The legacy JavaScript framework is still supported but will be deprecated over time. This will be discussed further in advanced topics." msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:39 msgid "Odoo modules" msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:41 msgid "Both server and client extensions are packaged as *modules* which are optionally loaded in a *database*. A module is a collection of functions and data that target a single purpose." msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:45 msgid "Odoo modules can either add brand new business logic to an Odoo system or alter and extend existing business logic. One module can be created to add your country's accounting rules to Odoo's generic accounting support, while a different module can add support for real-time visualisation of a bus fleet." msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:50 msgid "Everything in Odoo starts and ends with modules." msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:52 msgid "Terminology: developers group their business features in Odoo *modules*. The main user-facing modules are flagged and exposed as *Apps*, but a majority of the modules aren't Apps. *Modules* may also be referred to as *addons* and the directories where the Odoo server finds them form the ``addons_path``." msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:60 msgid "An Odoo module **can** contain a number of elements:" msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:65 msgid ":ref:`Business objects `" msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:63 msgid "A business object (e.g. an invoice) is declared as a Python class. The fields defined in these classes are automatically mapped to database columns thanks to the :abbr:`ORM (Object-Relational Mapping)` layer." msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:68 msgid "Define UI display" msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:71 msgid "XML or CSV files declaring the model data:" msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:82 msgid "Images, CSS or JavaScript files used by the web interface or website" msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:84 msgid "None of these elements are mandatory. Some modules may only add data files (e.g. country-specific accounting configuration), while others may only add business objects. During this training, we will create business objects, object views and data files. :ref:`Web controllers ` and :ref:`static web data ` are advanced topics." msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:99 msgid "When an Odoo module includes business objects (i.e. Python files), they are organized as a `Python package `_ with a ``__init__.py`` file. This file contains import instructions for various Python files in the module." msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:104 msgid "Here is a simplified module directory:" msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:118 msgid "Odoo Editions" msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:120 msgid "Odoo is available in `two versions`_: Odoo Enterprise (licensed & shared sources) and Odoo Community (open-source). In addition to services such as support or upgrades, the Enterprise version provides extra functionalities to Odoo. From a technical point-of-view, these functionalities are simply new modules installed on top of the modules provided by the Community version." msgstr "" #: ../../content/developer/howtos/rdtraining/01_architecture.rst:125 msgid "Ready to start? Before writing actual code, let's go to the :doc:`next chapter <02_setup>` to review the Odoo installation process. Even if Odoo is already running on your system, we strongly suggest you go through this chapter to make sure we start on the same page during the development of our new application." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:3 msgid "Chapter 2: Development environment setup" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:5 msgid "Depending on the intended use case, there are multiple ways to install Odoo. This tutorial will stick to the :ref:`source install ` (:dfn:`running Odoo from the source code`), which is best suited for Odoo developers." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:9 msgid "Throughout this document, we assume that you are installing your development environment on a laptop provided by Odoo with Linux Mint installed and up-to-date. If that is not the case, switch to the :guilabel:`Windows` or :guilabel:`Mac OS` tab if any section of the installation guide, depending on which OS you are on. The steps remain essentially the same." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:15 msgid "Set up Git" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:18 msgid "Install and configure Git" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:20 msgid "The very first step of the installation process is to install the `Git version control system `_ because the Odoo source code is managed on `GitHub `_." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:28 msgid "Check if Git is installed by trying to print Git's version with the following command:" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:34 msgid "Once installed, register your name and email:" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:42 msgid "Configure GitHub" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:44 msgid "You need a GitHub account to fetch the sources and contribute to Odoo's development. If you don't have one yet, create it. For the username, we recommend using your trigram \"xyz\" (or quadrigam) followed by '-odoo': 'xyz-odoo'." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:48 msgid "The easiest way to authenticate with GitHub is to use an SSH connection. Using SSH authentication allows you to connect to GitHub without supplying your username and password every time you type a command." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:53 msgid "The following step-by-step procedure is based based on the `official GitHub documentation `_." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:56 msgid "Generate a new SSH key, add it to the ssh-agent, and copy the SSH key to your clipboard." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:65 msgid "Go to `GitHub.com `_, then click on your profile picture in the upper-right corner of the page and then on :guilabel:`Settings`." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:70 msgid "On the user settings sidebar, click on :guilabel:`SSH and GPG keys`." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:74 msgid "Click on :guilabel:`New SSH key` or on :guilabel:`Add SSH key`." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:78 msgid "In the :guilabel:`Title` field, add a descriptive label for the new key." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:79 msgid "Paste your key into the :guilabel:`Key` field." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:83 msgid "Click on :guilabel:`Add SSH key`." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:86 msgid "Fetch the sources" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:88 msgid "It is time to fetch the source code of Odoo. First, let's create a home for the Git repositories in :file:`$HOME/src/`." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:96 msgid "Then, clone the two repositories with SSH as explained in the :ref:`Installing Odoo guide `." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:100 msgid "Cloning the repositories will take a while, enjoy a cup of coffee while you wait." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:105 msgid "Configure the Git repositories" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:107 msgid "To contribute to an Odoo repository, you first need to `fork it `_, then create a branch containing your changes on the fork, and finally submit a `Pull Request `_ to the repository." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:114 msgid "If you are lucky enough to work at Odoo, the forks already exist. They are hosted on https://github.com/odoo-dev/odoo and https://github.com/odoo-dev/enterprise." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:117 msgid "After your two forks are created, their remote address can be added in your local repositories. In the commands below, replace `odoo-dev/odoo` and `odoo-dev/enterprise` with the name of your forks if needed." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:134 msgid "Install the dependencies" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:136 msgid "As seen in :ref:`howto/rdtraining/01_architecture`, Odoo's server runs on Python and uses PostgreSQL as an RDBMS. In the context of a development machine, the easiest approach is to install everything locally. To do so, follow once again the :ref:`Installing Odoo guide `." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:142 msgid "Some useful SQL commands:" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:156 msgid "Run the server" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:159 msgid "Launch with `odoo-bin`" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:161 msgid "Once all dependencies are set up, Odoo can be launched by running `odoo-bin`, the command-line interface of the server." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:169 msgid "There are multiple :ref:`command-line arguments ` that you can use to run the server. In this training you will only need some of them." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:174 msgid "The database that is going to be used." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:178 msgid "A comma-separated list of directories in which modules are stored. These directories are scanned for modules." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:183 msgid "Prevent the worker from using more than CPU seconds for each request." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:187 msgid "Prevent the worker from taking longer than seconds to process a request." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:190 msgid "The :option:`--limit-time-cpu` and :option:`--limit-time-real` arguments can be used to prevent the worker from being killed when debugging the source code." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:0 msgid "You may face an error similar to `AttributeError: module '' has no attribute '<$ATTRIBUTE'>`. In this case, you may need to re-install the module with :command:`$ pip install --upgrade --force-reinstall `." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:0 msgid "If this error occurs with more than one module, you may need to re-install all the requirements with :command:`$ pip install --upgrade --force-reinstall -r requirements.txt`." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:0 msgid "You can also clear the python cache to solve the issue:" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:204 msgid "Other commonly used arguments are:" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:206 msgid ":option:`-i `: Install some modules before running the server (comma-separated list)." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:208 msgid ":option:`-u `: Update some modules before running the server (comma-separated list)." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:212 msgid "Log in to Odoo" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:214 msgid "Open http://localhost:8069/ on your browser. We recommend using `Chrome `_, `Firefox `_, or any other browser with development tools." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:218 msgid "To log in as the administrator user, use the following credentials:" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:220 msgid "email: `admin`" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:221 msgid "password: `admin`" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:224 msgid "Enable the developer mode" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:226 msgid "The developer or debug mode is useful for training as it gives access to additional (advanced) tools. In the next chapters, **we will always assume that you have enabled the developer mode**." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:229 msgid ":ref:`Enable the developer mode ` now. Choose the method that you prefer; they are all equivalent." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:233 msgid "The main page of the Settings screen is only accessible if at least one application is installed. You will be led into installing your own application in the next chapter." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:237 msgid "Extra tools" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:240 msgid "Useful Git commands" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:242 msgid "Here are some useful Git commands for your day-to-day work." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:0 msgid "Switch branches:" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:0 msgid "When you switch branches, both repositories (odoo and enterprise) must be synchronized, i.e. both need to be in the same branch." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:256 msgid "Fetch and rebase:" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:269 msgid "Code Editor" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:271 msgid "If you are working at Odoo, many of your colleagues are using `VSCode `_, `VSCodium `_ (the open source equivalent), `PyCharm `_, or `Sublime Text `_. However, you are free to choose your preferred editor." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:276 msgid "It is important to configure your linters correctly. Using a linter helps you by showing syntax and semantic warnings or errors. Odoo source code tries to respect Python's and JavaScript's standards, but some of them can be ignored." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:280 msgid "For Python, we use PEP8 with these options ignored:" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:282 msgid "`E501`: line too long" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:283 msgid "`E301`: expected 1 blank line, found 0" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:284 msgid "`E302`: expected 2 blank lines, found 1" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:286 msgid "For JavaScript, we use ESLint and you can find a `configuration file example here `_." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:290 msgid "Administrator tools for PostgreSQL" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:292 msgid "You can manage your PostgreSQL databases using the command line as demonstrated earlier or using a GUI application such as `pgAdmin `_ or `DBeaver `_." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:296 msgid "To connect the GUI application to your database we recommend you connect using the Unix socket." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:298 msgid "Host name/address: `/var/run/postgresql`" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:299 msgid "Port: `5432`" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:300 msgid "Username: `$USER`" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:303 msgid "Python Debugging" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:305 msgid "When facing a bug or trying to understand how the code works, simply printing things out can go a long way, but a proper debugger can save a lot of time." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:308 msgid "You can use a classic Python library debugger (`pdb `_, `pudb `_ or `ipdb `_), or you can use your editor's debugger." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:312 msgid "In the following example we use ipdb, but the process is similar with other libraries." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:314 msgid "Install the library:" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:320 msgid "Place a trigger (breakpoint):" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:339 msgid "Here is a list of commands:" msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:343 msgid "Print the list of available commands if not argument is supplied. With a command as an argument, print the help about that command." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:348 msgid "The value of the `expression` is pretty-printed using the `pprint` module." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:352 msgid "Print a stack trace with the most recent frame at the bottom." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:356 msgid "Move the current frame one level down in the stack trace (to a newer frame)." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:360 msgid "Move the current frame one level up in the stack trace (to an older frame)." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:364 msgid "Continue the execution until the next line in the current function is reached or it returns." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:368 msgid "Continue the execution and only stop when a breakpoint is encountered." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:372 msgid "Execute the current line. Stop at the first possible occasion (either in a function that is called or on the next line in the current function)." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:377 msgid "Quit the debugger. The program being executed is aborted." msgstr "" #: ../../content/developer/howtos/rdtraining/02_setup.rst:381 msgid "Now that your server is running, it's time to start :ref:`writing your own application `!" msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:5 msgid "Chapter 3: A New Application" msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:7 msgid "The purpose of this chapter is to lay the foundation for the creation of a completely new Odoo module. We will start from scratch with the minimum needed to have our module recognized by Odoo. In the upcoming chapters, we will progressively add features to build a realistic business case." msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:12 msgid "The Real Estate Advertisement module" msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:14 msgid "Our new module will cover a business area which is very specific and therefore not included in the standard set of modules: real estate. It is worth noting that before developing a new module, it is good practice to verify that Odoo doesn't already provide a way to answer the specific business case." msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:19 msgid "Here is an overview of the main list view containing some advertisements:" msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:None msgid "List view 01" msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:25 msgid "The top area of the form view summarizes important information for the property, such as the name, the property type, the postcode and so on. The first tab contains information describing the property: bedrooms, living area, garage, garden..." msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:None msgid "Form view 01" msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:33 msgid "The second tab lists the offers for the property. We can see here that potential buyers can make offers above or below the expected selling price. It is up to the seller to accept an offer." msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:None msgid "Form view 02" msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:40 msgid "Here is a quick video showing the workflow of the module." msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:42 msgid "Hopefully, this video will be recorded soon :-)" msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:45 msgid "Prepare the addon directory" msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:47 msgid "**Reference**: the documentation related to this topic can be found in :ref:`manifest `." msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:52 msgid "**Goal**: the goal of this section is to have Odoo recognize our new module, which will be an empty shell for now. It will be listed in the Apps:" msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:0 msgid "The new module appears in the list" msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:59 msgid "The first step of module creation is to create a new directory. To ease the development, we suggest you first create the directory ``/home/$USER/src/custom``. In this directory we add another directory ``estate``, which is our module." msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:63 msgid "A module must contain at least 2 files: the ``__manifest__.py`` file and a ``__init__.py`` file. The ``__init__.py`` file can remain empty for now and we'll come back to it in the next chapter. On the other hand, the ``__manifest__.py`` file must describe our module and cannot remain empty. Its only required field is the ``name``, but it usually contains much more information." msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:68 msgid "Take a look at the `CRM file `__ as an example. In addition to providing the description of the module (``name``, ``category``, ``summary``, ``website``...), it lists its dependencies (``depends``). A dependency means that the Odoo framework will ensure that these modules are installed before our module is installed. Moreover, if one of these dependencies is uninstalled, then our module and **any other that depends on it will also be uninstalled**. Think about your favorite Linux distribution package manager (``apt``, ``dnf``, ``pacman``...): Odoo works in the same way." msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:77 msgid "Create the required addon files." msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:79 msgid "Create the following folders and files:" msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:81 msgid "``/home/$USER/src/custom/estate/__init__.py``" msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:82 msgid "``/home/$USER/src/custom/estate/__manifest__.py``" msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:84 msgid "The ``__manifest__.py`` file should only define the name and the dependencies of our modules. The only necessary framework module for now is ``base``." msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:88 msgid "Restart the Odoo server and add the ``custom`` folder to the ``addons-path``:" msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:94 msgid "Go to Apps, click on Update Apps List, search for ``estate`` and... tadaaa, your module appears! Did it not appear? Maybe try removing the default 'Apps' filter ;-)" msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:98 msgid "Remember to enable the :ref:`developer mode ` as explained in the previous chapter. You won't see the :guilabel:`Update Apps List` button otherwise." msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:101 msgid "Make your module an 'App'." msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:103 msgid "Add the appropriate key to your ``__manifest__.py`` so that the module appears when the 'Apps' filter is on." msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:106 msgid "You can even install the module! But obviously it's an empty shell, so no menu will appear." msgstr "" #: ../../content/developer/howtos/rdtraining/03_newapp.rst:108 msgid "All good? If yes, then let's :ref:`create our first model `!" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:5 msgid "Chapter 4: Models And Basic Fields" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:7 msgid "At the end of the :ref:`previous chapter `, we were able to create an Odoo module. However, at this point it is still an empty shell which doesn't allow us to store any data. In our real estate module, we want to store the information related to the properties (name, description, price, living area...) in a database. The Odoo framework provides tools to facilitate database interactions." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:13 msgid "Before moving forward in the exercise, make sure the ``estate`` module is installed, i.e. it must appear as 'Installed' in the Apps list." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:19 msgid "**Reference**: the documentation related to this topic can be found in the :ref:`reference/orm/model` API." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:24 msgid "**Goal**: at the end of this section, the table ``estate_property`` should be created:" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:35 msgid "A key component of Odoo is the `ORM`_ layer. This layer avoids having to manually write most `SQL`_ and provides extensibility and security services\\ [#rawsql]_." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:39 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/rdtraining/04_basicmodel.rst:43 msgid "Models can be configured by setting attributes in 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 minimum definition of a model::" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:54 msgid "This definition is enough for the ORM to generate a database table named ``test_model``. The ``.`` in the model ``_name`` is automatically converted into a ``_`` by the ORM. By convention all models are located in a ``models`` directory and each model is defined in its own Python file." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:59 msgid "Take a look at how the ``crm_recurring_plan`` table is defined and how the corresponding Python file is imported:" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:62 msgid "The model is defined in the file ``crm/models/crm_recurring_plan.py`` (see `here `__)" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:64 msgid "The file ``crm_recurring_plan.py`` is imported in ``crm/models/__init__.py`` (see `here `__)" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:66 msgid "The folder ``models`` is imported in ``crm/__init__.py`` (see `here `__)" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:69 msgid "Define the real estate properties model." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:71 msgid "Based on example given in the CRM module, create the appropriate files and folder for the ``estate_property`` table." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:74 msgid "When the files are created, add a minimum definition for the ``estate.property`` model." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:77 msgid "Any modification of the Python files requires a restart of the Odoo server. When we restart the server, we will add the parameters ``-d`` and ``-u``:" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:84 msgid "``-u estate`` means we want to upgrade the ``estate`` module, i.e. the ORM will apply database schema changes. In this case it creates a new table. ``-d rd-demo`` means that the upgrade should be performed on the ``rd-demo`` database. ``-u`` should always be used in combination with ``-d``." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:89 msgid "During the startup you should see the following warnings:" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:99 msgid "If this is the case, then you should be good! To be sure, double check with ``psql`` as demonstrated in the **Goal**." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:102 msgid "Add a description." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:104 msgid "Add a ``_description`` to your model to get rid of one of the warnings." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:109 msgid "**Reference**: the documentation related to this topic can be found in the :ref:`reference/orm/fields` API." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:112 msgid "Fields are used to define what the model can store and where they are stored. Fields are defined as attributes in the model class::" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:123 msgid "The ``name`` field is a :class:`~odoo.fields.Char` which will be represented as a Python unicode ``str`` and a SQL ``VARCHAR``." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:131 msgid "**Goal**: at the end of this section, several basic fields should have been added to the table ``estate_property``:" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:167 msgid "There are two broad categories of fields: 'simple' fields, which are atomic values stored directly in the model's table, and 'relational' fields, which link records (of the same or different models)." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:171 msgid "Simple field examples are :class:`~odoo.fields.Boolean`, :class:`~odoo.fields.Float`, :class:`~odoo.fields.Char`, :class:`~odoo.fields.Text`, :class:`~odoo.fields.Date` and :class:`~odoo.fields.Selection`." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:175 msgid "Add basic fields to the Real Estate Property table." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:177 msgid "Add the following basic fields to the table:" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:180 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:253 #: ../../content/developer/howtos/rdtraining/08_relations.rst:71 #: ../../content/developer/howtos/rdtraining/08_relations.rst:178 #: ../../content/developer/howtos/rdtraining/08_relations.rst:241 #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:173 #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:215 #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:262 #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:155 #: ../../content/developer/howtos/rdtraining/C_data.rst:176 #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:301 msgid "Field" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:180 #: ../../content/developer/howtos/rdtraining/08_relations.rst:71 #: ../../content/developer/howtos/rdtraining/08_relations.rst:178 #: ../../content/developer/howtos/rdtraining/08_relations.rst:241 #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:173 #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:215 #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:262 #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:155 #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:301 #: ../../content/developer/reference/frontend/assets.rst:300 #: ../../content/developer/reference/frontend/framework_overview.rst:262 #: ../../content/developer/reference/frontend/hooks.rst:224 #: ../../content/developer/reference/frontend/odoo_editor.rst:147 #: ../../content/developer/reference/frontend/odoo_editor.rst:173 #: ../../content/developer/reference/frontend/odoo_editor.rst:217 #: ../../content/developer/reference/frontend/owl_components.rst:237 #: ../../content/developer/reference/frontend/owl_components.rst:316 #: ../../content/developer/reference/frontend/owl_components.rst:383 #: ../../content/developer/reference/frontend/owl_components.rst:427 #: ../../content/developer/reference/frontend/owl_components.rst:631 #: ../../content/developer/reference/frontend/services.rst:246 #: ../../content/developer/reference/frontend/services.rst:438 #: ../../content/developer/reference/frontend/services.rst:466 #: ../../content/developer/reference/frontend/services.rst:737 #: ../../content/developer/reference/frontend/services.rst:852 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountAccountTemplate.account_type:1 msgid "Type" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:182 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:184 #: ../../content/developer/howtos/rdtraining/08_relations.rst:73 #: ../../content/developer/howtos/rdtraining/08_relations.rst:180 msgid "Char" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:183 #: ../../content/developer/howtos/rdtraining/C_data.rst:180 msgid "description" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:183 msgid "Text" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:184 #: ../../content/developer/howtos/rdtraining/C_data.rst:181 msgid "postcode" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:185 #: ../../content/developer/howtos/rdtraining/C_data.rst:182 msgid "date_availability" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:185 #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:176 msgid "Date" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:186 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:256 #: ../../content/developer/howtos/rdtraining/C_data.rst:183 msgid "expected_price" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:186 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:187 #: ../../content/developer/howtos/rdtraining/08_relations.rst:243 msgid "Float" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:187 #: ../../content/developer/howtos/rdtraining/C_data.rst:184 msgid "selling_price" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:188 #: ../../content/developer/howtos/rdtraining/C_data.rst:185 msgid "bedrooms" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:188 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:189 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:190 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:193 #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:175 #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:217 #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:264 #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:303 msgid "Integer" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:189 #: ../../content/developer/howtos/rdtraining/C_data.rst:186 msgid "living_area" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:190 #: ../../content/developer/howtos/rdtraining/C_data.rst:187 msgid "facades" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:191 #: ../../content/developer/howtos/rdtraining/C_data.rst:188 msgid "garage" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:191 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:192 msgid "Boolean" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:192 #: ../../content/developer/howtos/rdtraining/C_data.rst:189 msgid "garden" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:193 #: ../../content/developer/howtos/rdtraining/C_data.rst:190 msgid "garden_area" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:194 #: ../../content/developer/howtos/rdtraining/C_data.rst:191 msgid "garden_orientation" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:194 #: ../../content/developer/howtos/rdtraining/08_relations.rst:244 #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:304 #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:306 msgid "Selection" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:197 msgid "The ``garden_orientation`` field must have 4 possible values: 'North', 'South', 'East' and 'West'. The selection list is defined as a list of tuples, see `here `__ for an example." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:202 msgid "When the fields are added to the model, restart the server with ``-u estate``" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:208 msgid "Connect to ``psql`` and check the structure of the table ``estate_property``. You'll notice that a couple of extra fields were also added to the table. We will revisit them later." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:216 msgid "**Goal**: at the end of this section, the columns ``name`` and ``expected_price`` should be not nullable in the table ``estate_property``:" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:231 msgid "Much like the model itself, fields can be configured by passing configuration attributes as parameters::" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:238 msgid ":attr:`~odoo.fields.Field.string` (``str``, default: field's name)" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:241 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/rdtraining/04_basicmodel.rst:243 msgid ":attr:`~odoo.fields.Field.help` (``str``, default: ``''``)" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:244 msgid "Provides long-form help tooltip for users in the UI." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:248 msgid "Set attributes for existing fields." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:250 msgid "Add the following attributes:" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:253 #: ../../content/developer/reference/frontend/javascript_reference.rst:1825 msgid "Attribute" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:255 #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:256 #: ../../content/developer/howtos/rdtraining/08_relations.rst:73 #: ../../content/developer/howtos/rdtraining/08_relations.rst:180 #: ../../content/developer/howtos/rdtraining/08_relations.rst:245 #: ../../content/developer/howtos/rdtraining/08_relations.rst:246 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountAccountTemplate.name:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountAccountTemplate.code:0 #: ../../../odoo/addons/account/models/account_account_tag.py:docstring of odoo.addons.account.models.account_account_tag.AccountAccountTag.name:0 #: ../../../odoo/addons/account/models/account_account_tag.py:docstring of odoo.addons.account.models.account_account_tag.AccountAccountTag.applicability:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.name:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.code_digits:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.currency_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.bank_account_code_prefix:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.cash_account_code_prefix:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.transfer_account_code_prefix:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountFiscalPositionTemplate.name:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountFiscalPositionTemplate.chart_template_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountGroupTemplate.name:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountGroupTemplate.chart_template_id:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.name:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReportLine.name:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReportLine.report_id:0 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReportLine.hierarchy_level:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.chart_template_id:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.name:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.type_tax_use:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.amount_type:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.sequence:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.amount:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxRepartitionLineTemplate.factor_percent:0 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxRepartitionLineTemplate.repartition_type:0 msgid "required" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:259 msgid "After restarting the server, both fields should be not nullable." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:262 msgid "Automatic Fields" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:264 msgid "**Reference**: the documentation related to this topic can be found in :ref:`reference/fields/automatic`." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:267 msgid "You may have noticed your model has a few fields you never defined. Odoo creates a few fields in all models\\ [#autofields]_. These fields are managed by the system and can't be written to, but they can be read if useful or necessary:" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:273 msgid "The unique identifier for a record of the model." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:281 msgid "User who last modified the record." msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:284 msgid "Now that we have created our first model, let's :ref:`add some security `!" msgstr "" #: ../../content/developer/howtos/rdtraining/04_basicmodel.rst:290 msgid "writing raw SQL queries is possible, but requires caution as this bypasses all Odoo authentication and security mechanisms." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:5 msgid "Chapter 5: Security - A Brief Introduction" msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:7 msgid "In the :ref:`previous chapter `, we created our first table intended to store business data. In a business application such as Odoo, one of the first questions to consider is who\\ [#who]_ can access the data. Odoo provides a security mechanism to allow access to the data for specific groups of users." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:12 msgid "The topic of security is covered in more detail in :ref:`howto/rdtraining/B_acl_irrules`. This chapter aims to cover the minimum required for our new module." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:16 msgid "Data Files (CSV)" msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:18 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. One way to load data is through a CSV file. One example is the `list of country states `__ which is loaded at installation of the ``base`` module." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:33 #: ../../content/developer/howtos/rdtraining/06_firstui.rst:83 msgid "``id`` is an :term:`external identifier`. It can be used to refer to the record (without knowing its in-database identifier)." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:35 msgid "``country_id:id`` refers to the country by using its :term:`external identifier`." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:36 msgid "``name`` is the name of the state." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:37 msgid "``code`` is the code of the state." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:39 msgid "These three fields are `defined `__ in the ``res.country.state`` model." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:43 msgid "By convention, a file importing data is located in the ``data`` folder of a module. When the data is related to security, it is located in the ``security`` folder. When the data is related to views and actions (we will cover this later), it is located in the ``views`` folder. Additionally, all of these files must be declared in the ``data`` list within the ``__manifest__.py`` file. Our example file is defined `in the manifest of the base module `__." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:50 msgid "Also note that the content of the data files is only loaded when a module is installed or updated." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:55 msgid "The data files are sequentially loaded following their order in the ``__manifest__.py`` file. This means that if data ``A`` refers to data ``B``, you must make sure that ``B`` is loaded before ``A``." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:59 msgid "In the case of the country states, you will note that the `list of countries `__ is loaded **before** the `list of country states `__. This is because the states refer to the countries." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:65 msgid "Why is all this important for security? Because all the security configuration of a model is loaded through data files, as we'll see in the next section." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:69 #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:140 #: ../../content/developer/reference/backend/security.rst:45 msgid "Access Rights" msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:71 msgid "**Reference**: the documentation related to this topic can be found in :ref:`reference/security/acl`." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:76 msgid "**Goal**: at the end of this section, the following warning should not appear anymore:" msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:82 msgid "When no access rights are defined on a model, Odoo determines that no users can access the data. It is even notified in the log:" msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:89 msgid "Access rights are defined as records of the model ``ir.model.access``. Each access right is associated with a model, a group (or no group for global access) and a set of permissions: create, read, write and unlink\\ [#unlink]_. Such access rights are usually defined in a CSV file named ``ir.model.access.csv``." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:95 msgid "Here is an example for our previous ``test.model``:" msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:102 msgid "``id`` is an :term:`external identifier`." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:103 msgid "``name`` is the name of the ``ir.model.access``." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:104 msgid "``model_id/id`` refers to the model which the access right applies to. The standard way to refer to the model is ``model_``, where ```` is the ``_name`` of the model with the ``.`` replaced by ``_``. Seems cumbersome? Indeed it is..." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:107 msgid "``group_id/id`` refers to the group which the access right applies to. We will cover the concept of groups in the :ref:`advanced topic ` dedicated to the security." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:109 msgid "``perm_read,perm_write,perm_create,perm_unlink``: read, write, create and unlink permissions" msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:111 msgid "Add access rights." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:113 msgid "Create the ``ir.model.access.csv`` file in the appropriate folder and define it in the ``__manifest__.py`` file." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:116 msgid "Give the read, write, create and unlink permissions to the group ``base.group_user``." msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:118 msgid "Tip: the warning message in the log gives you most of the solution ;-)" msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:120 msgid "Restart the server and the warning message should have disappeared!" msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:122 msgid "It's now time to finally :ref:`interact with the UI `!" msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:124 msgid "meaning which Odoo user (or group of users)" msgstr "" #: ../../content/developer/howtos/rdtraining/05_securityintro.rst:126 msgid "'unlink' is the equivalent of 'delete'" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:5 msgid "Chapter 6: Finally, Some UI To Play With" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:7 msgid "Now that we've created our new :ref:`model ` and its corresponding :ref:`access rights `, it is time to interact with the user interface." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:11 msgid "At the end of this chapter, we will have created a couple of menus in order to access a default list and form view." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:15 msgid "Data Files (XML)" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:17 msgid "**Reference**: the documentation related to this topic can be found in :ref:`reference/data`." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:20 msgid "In :ref:`howto/rdtraining/05_securityintro`, we added data through a CSV file. The CSV format is convenient when the data to load has a simple format. When the format is more complex (e.g. load the structure of a view or an email template), we use the XML format. For example, this `help field `__ contains HTML tags. While it would be possible to load such data through a CSV file, it is more convenient to use an XML file." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:28 msgid "The XML files must be added to the same folders as the CSV files and defined similarly in the ``__manifest__.py``. The content of the data files is also sequentially loaded when a module is installed or updated, therefore all remarks made for CSV files hold true for XML files. When the data is linked to views, we add them to the ``views`` folder." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:33 msgid "In this chapter we will load our first action and menus though an XML file. Actions and menus are standard records in the database." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:38 msgid "When performance is important, the CSV format is preferred over the XML format. This is the case in Odoo where loading a CSV file is faster than loading an XML file." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:41 msgid "In Odoo, the user interface (actions, menus and views) is largely defined by creating and composing records defined in an XML file. A common pattern is Menu > Action > View. To access records the user navigates through several menu levels; the deepest level is an action which triggers the opening of a list of the records." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:47 #: ../../content/developer/iot.rst:138 #: ../../content/developer/reference/backend/actions.rst:6 msgid "Actions" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:49 msgid "**Reference**: the documentation related to this topic can be found in :ref:`reference/actions`." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:54 msgid "**Goal**: at the end of this section, an action should be loaded in the system. We won't see anything yet in the UI, but the file should be loaded in the log:" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:61 msgid "Actions can be triggered in three ways:" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:67 msgid "We will only cover the first case in this chapter. The second case will be covered in a :ref:`later chapter ` while the last is the focus of an advanced topic. In our Real Estate example, we would like to link a menu to the ``estate.property`` model, so we are able to create a new record. The action can be viewed as the link between the menu and the model." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:73 msgid "A basic action for our ``test.model`` is:" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:85 msgid "``model`` has a fixed value of ``ir.actions.act_window`` (:ref:`reference/actions/window`)." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:86 msgid "``name`` is the name of the action." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:87 msgid "``res_model`` is the model which the action applies to." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:88 msgid "``view_mode`` are the views that will be available; in this case they are the list (tree) and form views. We'll see :ref:`later ` that there can be other view modes." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:91 msgid "Examples can be found everywhere in Odoo, but `this `__ is a good example of a simple action. Pay attention to the structure of the XML data file since you will need it in the following exercise." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:96 msgid "Add an action." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:98 msgid "Create the ``estate_property_views.xml`` file in the appropriate folder and define it in the ``__manifest__.py`` file." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:101 msgid "Create an action for the model ``estate.property``." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:103 msgid "Restart the server and you should see the file loaded in the log." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:106 msgid "Menus" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:108 msgid "**Reference**: the documentation related to this topic can be found in :ref:`reference/data/shortcuts`." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:113 msgid "**Goal**: at the end of this section, three menus should be created and the default view is displayed:" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:0 #: ../../content/developer/howtos/rdtraining/06_firstui.rst:0 msgid "Root menus" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:0 #: ../../content/developer/howtos/rdtraining/06_firstui.rst:0 msgid "First level and action menus" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:0 msgid "Default form view" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:128 msgid "To reduce the complexity in declaring a menu (``ir.ui.menu``) and connecting it to the corresponding action, we can use the ```` shortcut ." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:131 msgid "A basic menu for our ``test_model_action`` is:" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:137 msgid "The menu ``test_model_menu_action`` is linked to the action ``test_model_action``, and the action is linked to the model ``test.model``. As previously mentioned, the action can be seen as the link between the menu and the model." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:141 msgid "However, menus always follow an architecture, and in practice there are three levels of menus:" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:143 msgid "The root menu, which is displayed in the App switcher (the Odoo Community App switcher is a dropdown menu)" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:145 msgid "The first level menu, displayed in the top bar" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:146 msgid "The action menus" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:156 msgid "The easiest way to define the structure is to create it in the XML file. A basic structure for our ``test_model_action`` is:" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:167 msgid "The name for the third menu is taken from the name of the ``action``." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:169 msgid "Add menus." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:171 msgid "Create the ``estate_menus.xml`` file in the appropriate folder and define it in the ``__manifest__.py`` file. Remember the sequential loading of the data files ;-)" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:174 msgid "Create the three levels of menus for the ``estate.property`` action created in the previous exercise. Refer to the **Goal** of this section for the expected result." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:177 msgid "Restart the server and **refresh the browser**\\ [#refresh]_. You should now see the menus, and you'll even be able to create your first real estate property advertisement!" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:181 msgid "Fields, Attributes And View" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:185 msgid "**Goal**: at the end of this section, the selling price should be read-only and the number of bedrooms and the availability date should have default values. Additionally the selling price and availability date values won't be copied when the record is duplicated." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:None msgid "Interaction between model and view" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:193 msgid "The reserved fields ``active`` and ``state`` are added to the ``estate.property`` model." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:195 msgid "So far we have only used the generic view for our real estate property advertisements, but in most cases we want to fine tune the view. There are many fine-tunings possible in Odoo, but usually the first step is to make sure that:" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:199 msgid "some fields have a default value" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:200 msgid "some fields are read-only" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:201 msgid "some fields are not copied when duplicating the record" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:203 msgid "In our real estate business case, we would like the following:" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:205 msgid "The selling price should be read-only (it will be automatically filled in later)" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:206 msgid "The availability date and the selling price should not be copied when duplicating a record" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:207 msgid "The default number of bedrooms should be 2" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:208 msgid "The default availability date should be in 3 months" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:211 msgid "Some New Attributes" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:213 msgid "Before moving further with the view design, let's step back to our model definition. We saw that some attributes, such as ``required=True``, impact the table schema in the database. Other attributes will impact the view or provide default values." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:217 msgid "Add new attributes to the fields." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:219 msgid "Find the appropriate attributes (see :class:`~odoo.fields.Field`) to:" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:221 msgid "set the selling price as read-only" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:222 msgid "prevent copying of the availability date and the selling price values" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:224 msgid "Restart the server and refresh the browser. You should not be able to set any selling prices. When duplicating a record, the availability date should be empty." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:228 msgid "Default Values" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:230 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 model and returning a value::" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:237 msgid "The ``name`` field will have the value 'Unknown' by default while the ``last_seen`` field will be set as the current time." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:240 msgid "Set default values." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:242 msgid "Add the appropriate default attributes so that:" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:244 msgid "the default number of bedrooms is 2" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:245 msgid "the default availability date is in 3 months" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:247 msgid "Tip: this might help you: :meth:`~odoo.fields.Date.today`" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:249 msgid "Check that the default values are set as expected." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:252 msgid "Reserved Fields" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:254 msgid "**Reference**: the documentation related to this topic can be found in :ref:`reference/orm/fields/reserved`." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:257 msgid "A few field names are reserved for pre-defined behaviors. They should be defined on a model when the related behavior is desired." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:260 msgid "Add active field." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:262 msgid "Add the ``active`` field to the ``estate.property`` model." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:264 msgid "Restart the server, create a new property, then come back to the list view... The property will not be listed! ``active`` is an example of a reserved field with a specific behavior: when a record has ``active=False``, it is automatically removed from any search. To display the created property, you will need to specifically search for inactive records." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:None msgid "Inactive records" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:273 msgid "Set a default value for active field." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:275 msgid "Set the appropriate default value for the ``active`` field so it doesn't disappear anymore." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:277 msgid "Note that the default ``active=False`` value was assigned to all existing records." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:279 msgid "Add state field." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:281 msgid "Add a ``state`` field to the ``estate.property`` model. Five values are possible: New, Offer Received, Offer Accepted, Sold and Canceled. It must be required, should not be copied and should have its default value set to 'New'." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:285 msgid "Make sure to use the correct type!" msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:287 msgid "The ``state`` will be used later on for several UI enhancements." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:289 msgid "Now that we are able to interact with the UI thanks to the default views, the next step is obvious: we want to define :ref:`our own views `." msgstr "" #: ../../content/developer/howtos/rdtraining/06_firstui.rst:292 msgid "A refresh is needed since the web client keeps a cache of the various menus and views for performance reasons." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:5 msgid "Chapter 7: Basic Views" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:7 msgid "We have seen in the :ref:`previous chapter ` that Odoo is able to generate default views for a given model. In practice, the default view is **never** acceptable for a business application. Instead, we should at least organize the various fields in a logical manner." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:12 msgid "Views are defined in XML files with actions and menus. They are instances of the ``ir.ui.view`` model." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:15 msgid "In our real estate module, we need to organize the fields in a logical way:" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:17 msgid "in the list (tree) view, we want to display more than just the name." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:18 msgid "in the form view, the fields should be grouped." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:19 msgid "in the search view, we must be able to search on more than just the name. Specifically, we want a filter for the 'Available' properties and a shortcut to group by postcode." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:23 #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:317 #: ../../content/developer/reference/backend/views.rst:1692 msgid "List" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:25 msgid "**Reference**: the documentation related to this topic can be found in :ref:`reference/views/list`." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:30 msgid "**Goal**: at the end of this section, the list view should look like this:" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:0 msgid "List view" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:36 msgid "List views, also called tree views, display records in a tabular form." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:38 msgid "Their root element is ````. The most basic version of this view simply lists all the fields to display in the table (where each field is a column):" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:48 msgid "A simple example can be found `here `__." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:51 msgid "Add a custom list view." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:53 msgid "Define a list view for the ``estate.property`` model in the appropriate XML file. Check the **Goal** of this section for the fields to display." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:56 #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:378 #: ../../content/developer/howtos/rdtraining/14_other_module.rst:117 msgid "Tips:" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:58 msgid "do not add the ``editable=\"bottom\"`` attribute that you can find in the example above. We'll come back to it later." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:60 msgid "some field labels may need to be adapted to match the reference." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:63 msgid "As always, you need to restart the server (do not forget the ``-u`` option) and refresh the browser to see the result." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:68 msgid "You will probably use some copy-paste in this chapter, therefore always make sure that the ``id`` remains unique for each view!" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:72 #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:234 #: ../../content/developer/reference/backend/views.rst:774 msgid "Form" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:74 msgid "**Reference**: the documentation related to this topic can be found in :ref:`reference/views/form`." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:79 msgid "**Goal**: at the end of this section, the form view should look like this:" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:0 msgid "Form view" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:87 msgid "Their root element is ````. They are composed of high-level structure elements (groups and notebooks) and interactive elements (buttons and fields):" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:110 msgid "It is possible to use regular HTML tags such as ``div`` and ``h1`` as well as the the ``class`` attribute (Odoo provides some built-in classes) to fine-tune the look." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:113 msgid "A simple example can be found `here `__." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:116 msgid "Add a custom form view." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:118 msgid "Define a form view for the ``estate.property`` model in the appropriate XML file. Check the **Goal** of this section for the expected final design of the page." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:121 msgid "This might require some trial and error before you get to the expected result ;-) It is advised that you add the fields and the tags one at a time to help understand how it works." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:124 msgid "In order to avoid relaunching the server every time you do a modification to the view, it can be convenient to use the ``--dev xml`` parameter when launching the server:" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:131 msgid "This parameter allows you to just refresh the page to view your view modifications." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:134 #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:385 #: ../../content/developer/reference/backend/views.rst:2175 msgid "Search" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:136 msgid "**Reference**: the documentation related to this topic can be found in :ref:`reference/views/search`." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:141 msgid "**Goal**: at the end of this section, the search view should look like this:" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:0 msgid "Search fields" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:0 #: ../../content/developer/reference/backend/orm.rst:1033 msgid "Filter" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:0 msgid "Group By" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:155 msgid "Search views are slightly different from the list and form views since they don't display *content*. Although they apply to a specific model, they are used to filter other views' content (generally aggregated views such as :ref:`reference/views/list`). Beyond the difference in use case, they are defined the same way." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:160 msgid "Their root element is ````. The most basic version of this view simply lists all the fields for which a shortcut is desired:" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:170 msgid "The default search view generated by Odoo provides a shortcut to filter by ``name``. It is very common to add the fields which the user is likely to filter on in a customized search view." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:173 msgid "Add a custom search view." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:175 msgid "Define a search view for the ``estate.property`` model in the appropriate XML file. Check the first image of this section's **Goal** for the list of fields." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:178 msgid "After restarting the server, it should be possible to filter on the given fields." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:183 msgid "``domain``: adds the given domain to the current search" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:184 msgid "``context``: adds some context to the current search; uses the key ``group_by`` to group results on the given field name" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:187 msgid "A simple example can be found `here `__." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:190 msgid "Before going further in the exercise, it is necessary to introduce the 'domain' concept." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:195 msgid "**Reference**: the documentation related to this topic can be found in :ref:`reference/orm/domains`." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:198 msgid "In Odoo, a domain encodes conditions on records: a domain is a list of criteria used to select a subset of a model's records. Each criterion is a triplet with a *field name*, an *operator* and a *value*. A record satisfies a criterion if the specified field meets the condition of the operator applied to the value." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:203 msgid "For instance, when used on the *Product* model the following domain selects all *services* with a unit price greater than *1000*::" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:208 msgid "By default criteria are combined with an implicit AND, meaning *every* criterion needs to be satisfied for a record to match a domain. 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/rdtraining/07_basicviews.rst:221 msgid "Add filter and Group By." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:223 msgid "The following should be added to the previously created search view:" msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:225 msgid "a filter which displays available properties, i.e. the state should be 'New' or 'Offer Received'." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:227 msgid "the ability to group results by postcode." msgstr "" #: ../../content/developer/howtos/rdtraining/07_basicviews.rst:229 msgid "Looking good? At this point we are already able to create models and design a user interface which makes sense business-wise. However, a key component is still missing: the :ref:`link between models `." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:5 msgid "Chapter 8: Relations Between Models" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:7 msgid "The :ref:`previous chapter ` covered the creation of custom views for a model containing basic fields. However, in any real business scenario we need more than one model. Moreover, links between models are necessary. One can easily imagine one model containing the customers and another one containing the list of users. You might need to refer to a customer or a user on any existing business model." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:13 msgid "In our real estate module, we want the following information for a property:" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:15 msgid "the customer who bought the property" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:16 msgid "the real restate agent who sold the property" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:17 msgid "the property type: house, apartment, penthouse, castle..." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:18 msgid "a list of tags characterizing the property: cozy, renovated..." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:19 msgid "a list of the offers received" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:22 #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:305 #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:307 msgid "Many2one" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:24 msgid "**Reference**: the documentation related to this topic can be found in :class:`~odoo.fields.Many2one`." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:29 #: ../../content/developer/howtos/rdtraining/08_relations.rst:136 #: ../../content/developer/howtos/rdtraining/08_relations.rst:199 #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:26 #: ../../content/developer/howtos/rdtraining/10_actions.rst:27 #: ../../content/developer/howtos/rdtraining/11_constraints.rst:24 #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:20 #: ../../content/developer/howtos/rdtraining/14_other_module.rst:18 msgid "**Goal**: at the end of this section:" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:31 msgid "a new ``estate.property.type`` model should be created with the corresponding menu, action and views." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:0 msgid "Property type" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:37 msgid "three Many2one fields should be added to the ``estate.property`` model: property type, buyer and seller." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:0 #: ../../content/developer/howtos/rdtraining/08_relations.rst:0 msgid "Property" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:43 msgid "In our real estate module, we want to define the concept of property type. A property type is, for example, a house or an apartment. It is a standard business need to categorize properties according to their type, especially to refine filtering." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:47 msgid "A property can have **one** type, but the same type can be assigned to **many** properties. This is supported by the **many2one** concept." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:50 msgid "A many2one is a simple link to another object. For example, in order to define a link to the ``res.partner`` in our test model, we can write::" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:55 msgid "By convention, many2one fields have the ``_id`` suffix. Accessing the data in the partner can then be easily done with::" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:62 msgid "`foreign keys `_" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:64 msgid "In practice a many2one can be seen as a dropdown list in a form view." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:66 msgid "Add the Real Estate Property Type table." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:68 msgid "Create the ``estate.property.type`` model and add the following field:" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:71 #: ../../content/developer/howtos/rdtraining/08_relations.rst:178 #: ../../content/developer/howtos/rdtraining/08_relations.rst:241 #: ../../content/developer/reference/backend/views.rst:68 msgid "Attributes" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:76 #: ../../content/developer/howtos/rdtraining/08_relations.rst:183 msgid "Add the menus as displayed in this section's **Goal**" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:77 msgid "Add the field ``property_type_id`` into your ``estate.property`` model and its form, tree and search views" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:80 msgid "This exercise is a good recap of the previous chapters: you need to create a :ref:`model `, set the :ref:`model `, add an :ref:`action and a menu `, and :ref:`create a view `." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:86 msgid "Tip: do not forget to import any new Python files in ``__init__.py``, add new data files in ``__manifest.py__`` or add the access rights ;-)" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:89 msgid "Once again, restart the server and refresh to see the results!" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:91 msgid "In the real estate module, there are still two missing pieces of information we want on a property: the buyer and the salesperson. The buyer can be any individual, but on the other hand the salesperson must be an employee of the real estate agency (i.e. an Odoo user)." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:95 msgid "In Odoo, there are two models which we commonly refer to:" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:97 msgid "``res.partner``: a partner is a physical or legal entity. It can be a company, an individual or even a contact address." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:99 msgid "``res.users``: the users of the system. Users can be 'internal', i.e. they have access to the Odoo backend. Or they can be 'portal', i.e. they cannot access the backend, only the frontend (e.g. to access their previous orders in eCommerce)." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:103 msgid "Add the buyer and the salesperson." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:105 msgid "Add a buyer and a salesperson to the ``estate.property`` model using the two common models mentioned above. They should be added in a new tab of the form view, as depicted in this section's **Goal**." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:108 msgid "The default value for the salesperson must be the current user. The buyer should not be copied." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:110 msgid "Tip: to get the default value, check the note below or look at an example `here `__." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:126 msgid "Now let's have a look at other types of links." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:129 msgid "Many2many" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:131 msgid "**Reference**: the documentation related to this topic can be found in :class:`~odoo.fields.Many2many`." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:138 msgid "a new ``estate.property.tag`` model should be created with the corresponding menu and action." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:0 msgid "Property tag" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:144 msgid "tags should be added to the ``estate.property`` model:" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:150 msgid "In our real estate module, we want to define the concept of property tags. A property tag is, for example, a property which is 'cozy' or 'renovated'." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:153 msgid "A property can have **many** tags and a tag can be assigned to **many** properties. This is supported by the **many2many** concept." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:156 msgid "A many2many is a bidirectional multiple relationship: any record on one side can be related to any number of records on the other side. For example, in order to define a link to the ``account.tax`` model on our test model, we can write::" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:162 msgid "By convention, many2many fields have the ``_ids`` suffix. This means that several taxes can be added to our test model. It behaves as a list of records, meaning that accessing the data must be done in a loop::" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:169 msgid "A list of records is known as a *recordset*, i.e. an ordered collection of records. It supports standard Python operations on collections, such as ``len()`` and ``iter()``, plus extra set operations like ``recs1 | recs2``." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:173 msgid "Add the Real Estate Property Tag table." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:175 msgid "Create the ``estate.property.tag`` model and add the following field:" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:184 msgid "Add the field ``tag_ids`` to your ``estate.property`` model and in its form and tree views" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:186 msgid "Tip: in the view, use the ``widget=\"many2many_tags\"`` attribute as demonstrated `here `__. The ``widget`` attribute will be explained in detail in :ref:`a later chapter of the training `. For now, you can try to adding and removing it and see the result ;-)" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:192 msgid "One2many" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:194 msgid "**Reference**: the documentation related to this topic can be found in :class:`~odoo.fields.One2many`." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:201 msgid "a new ``estate.property.offer`` model should be created with the corresponding form and tree view." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:202 msgid "offers should be added to the ``estate.property`` model:" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:0 msgid "Property offers" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:208 msgid "In our real estate module, we want to define the concept of property offers. A property offer is an amount a potential buyer offers to the seller. The offer can be lower or higher than the expected price." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:212 msgid "An offer applies to **one** property, but the same property can have **many** offers. The concept of **many2one** appears once again. However, in this case we want to display the list of offers for a given property so we will use the **one2many** concept." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:216 msgid "A one2many is the inverse of a many2one. For example, we defined on our test model a link to the ``res.partner`` model thanks to the field ``partner_id``. We can define the inverse relation, i.e. the list of test models linked to our partner::" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:222 msgid "The first parameter is called the ``comodel`` and the second parameter is the field we want to inverse." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:225 msgid "By convention, one2many fields have the ``_ids`` suffix. They behave as a list of records, meaning that accessing the data must be done in a loop::" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:233 msgid "Because a :class:`~odoo.fields.One2many` is a virtual relationship, there *must* be a :class:`~odoo.fields.Many2one` field defined in the comodel." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:236 msgid "Add the Real Estate Property Offer table." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:238 msgid "Create the ``estate.property.offer`` model and add the following fields:" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:241 #: ../../content/developer/howtos/rdtraining/C_data.rst:176 #: ../../content/developer/howtos/rdtraining/C_data.rst:176 msgid "Values" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:243 msgid "price" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:244 msgid "status" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:244 msgid "no copy" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:244 msgid "Accepted, Refused" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:245 msgid "partner_id" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:245 msgid "Many2one (``res.partner``)" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:246 #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:305 msgid "property_id" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:246 msgid "Many2one (``estate.property``)" msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:249 msgid "Create a tree view and a form view with the ``price``, ``partner_id`` and ``status`` fields. No need to create an action or a menu." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:251 msgid "Add the field ``offer_ids`` to your ``estate.property`` model and in its form view as depicted in this section's **Goal**." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:254 msgid "There are several important things to notice here. First, we don't need an action or a menu for all models. Some models are intended to be accessed only through another model. This is the case in our exercise: an offer is always accessed through a property." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:258 msgid "Second, despite the fact that the ``property_id`` field is required, we did not include it in the views. How does Odoo know which property our offer is linked to? Well that's part of the magic of using the Odoo framework: sometimes things are defined implicitly. When we create a record through a one2many field, the corresponding many2one is populated automatically for convenience." msgstr "" #: ../../content/developer/howtos/rdtraining/08_relations.rst:264 msgid "Still alive? This chapter is definitely not the easiest one. It introduced a couple of new concepts while relying on everything that was introduced before. The :ref:`next chapter ` will be lighter, don't worry ;-)" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:5 msgid "Chapter 9: Computed Fields And Onchanges" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:7 msgid "The :ref:`relations between models ` are a key component of any Odoo module. They are necessary for the modelization of any business case. However, we may want links between the fields within a given model. Sometimes the value of one field is determined from the values of other fields and other times we want to help the user with data entry." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:13 msgid "These cases are supported by the concepts of computed fields and onchanges. Although this chapter is not technically complex, the semantics of both concepts is very important. This is also the first time we will write Python logic. Until now we haven't written anything other than class definitions and field declarations." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:19 #: ../../../odoo/odoo/fields.py:docstring of odoo.fields.Field:96 #: ../../content/developer/reference/backend/orm.rst:241 msgid "Computed Fields" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:21 msgid "**Reference**: the documentation related to this topic can be found in :ref:`reference/fields/compute`." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:28 msgid "In the property model, the total area and the best offer should be computed:" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:0 msgid "Compute fields" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:34 msgid "In the property offer model, the validity date should be computed and can be updated:" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:0 msgid "Compute field with inverse" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:40 msgid "In our real estate module, we have defined the living area as well as the garden area. It is then natural to define the total area as the sum of both fields. We will use the concept of a computed field for this, i.e. the value of a given field will be computed from the value of other fields." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:44 msgid "So far fields have been stored directly in and retrieved directly from the database. Fields can also be *computed*. In this 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/rdtraining/09_compute_onchange.rst:49 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 set the value of the computed field for every record in ``self``." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:54 msgid "By convention, :attr:`~odoo.fields.Field.compute` methods are private, meaning that they cannot be called from the presentation tier, only from the business tier (see :ref:`howto/rdtraining/01_architecture`). Private methods have a name starting with an underscore ``_``." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:61 msgid "The value of a computed field usually depends on the values of other fields in 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/rdtraining/09_compute_onchange.rst:80 msgid "``self`` is a collection." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:83 msgid "The object ``self`` is a *recordset*, i.e. an ordered collection of records. It supports the standard Python operations on collections, e.g. ``len(self)`` and ``iter(self)``, plus extra set operations such as ``recs1 | recs2``." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:88 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, e.g. ``record.name``." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:92 msgid "Many examples of computed fields can be found in Odoo. `Here `__ is a simple one." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:96 msgid "Compute the total area." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:98 msgid "Add the ``total_area`` field to ``estate.property``. It is defined as the sum of the ``living_area`` and the ``garden_area``." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:101 msgid "Add the field in the form view as depicted on the first image of this section's **Goal**." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:103 msgid "For relational fields it's possible to use paths through a field as a dependency::" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:113 msgid "The example is given with a :class:`~odoo.fields.Many2one`, but it is valid for :class:`~odoo.fields.Many2many` or a :class:`~odoo.fields.One2many`. An example can be found `here `__." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:117 msgid "Let's try it in our module with the following exercise!" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:119 msgid "Compute the best offer." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:121 msgid "Add the ``best_price`` field to ``estate.property``. It is defined as the highest (i.e. maximum) of the offers' ``price``." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:124 msgid "Add the field to the form view as depicted in the first image of this section's **Goal**." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:126 msgid "Tip: you might want to try using the :meth:`~odoo.models.BaseModel.mapped` method. See `here `__ for a simple example." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:131 msgid "Inverse Function" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:133 msgid "You might have noticed that computed fields are read-only by default. This is expected since the user is not supposed to set a value." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:136 msgid "In some cases, it might be useful to still be able to set a value directly. In our real estate example, we can define a validity duration for an offer and set a validity date. We would like to be able to set either the duration or the date with one impacting the other." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:140 msgid "To support this Odoo provides the ability to use an ``inverse`` function::" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:159 msgid "An example can be found `here `__." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:162 msgid "A compute method sets the field while an inverse method sets the field's dependencies." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:165 msgid "Note that the ``inverse`` method is called when saving the record, while the ``compute`` method is called at each change of its dependencies." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:168 msgid "Compute a validity date for offers." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:170 msgid "Add the following fields to the ``estate.property.offer`` model:" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:173 msgid "Default" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:175 msgid "validity" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:175 msgid "7" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:176 msgid "date_deadline" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:179 msgid "Where ``date_deadline`` is a computed field which is defined as the sum of two fields from the offer: the ``create_date`` and the ``validity``. Define an appropriate inverse function so that the user can set either the date or the validity." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:183 msgid "Tip: the ``create_date`` is only filled in when the record is created, therefore you will need a fallback to prevent crashing at time of creation." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:186 msgid "Add the fields in the form view and the list view as depicted on the second image of this section's **Goal**." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:189 #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:275 msgid "Additional Information" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:191 msgid "Computed fields are **not stored** in the database by default. Therefore it is **not possible** to search on a computed field unless a ``search`` method is defined. This topic is beyond the scope of this training, so we won't cover it. An example can be found `here `__." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:196 msgid "Another solution is to store the field with the ``store=True`` attribute. While this is usually convenient, pay attention to the potential computation load added to your model. Lets re-use our example::" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:208 msgid "Every time the partner ``name`` is changed, the ``description`` is automatically recomputed for **all the records** referring to it! This can quickly become prohibitive to recompute when millions of records need recomputation." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:212 msgid "It is also worth noting that a computed field can depend on another computed field. The ORM is smart enough to correctly recompute all the dependencies in the right order... but sometimes at the cost of degraded performance." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:216 msgid "In general performance must always be kept in mind when defining computed fields. The more complex is your field to compute (e.g. with a lot of dependencies or when a computed field depends on other computed fields), the more time it will take to compute. Always take some time to evaluate the cost of a computed field beforehand. Most of the time it is only when your code reaches a production server that you realize it slows down a whole process. Not cool :-(" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:223 msgid "Onchanges" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:225 msgid "**Reference**: the documentation related to this topic can be found in :func:`~odoo.api.onchange`:" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:230 msgid "**Goal**: at the end of this section, enabling the garden will set a default area of 10 and an orientation to North." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:237 msgid "In our real estate module, we also want to help the user with data entry. When the 'garden' field is set, we want to give a default value for the garden area as well as the orientation. Additionally, when the 'garden' field is unset we want the garden area to reset to zero and the orientation to be removed. In this case, the value of a given field modifies the value of other fields." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:243 msgid "The 'onchange' mechanism provides a way for the client interface to update a form without saving anything to the database whenever the user has filled in a field value. To achieve this, we define a method where ``self`` represents the record in the form view and decorate it with :func:`~odoo.api.onchange` to specify which field it is triggered by. Any change you make on ``self`` will be reflected on the form::" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:264 msgid "In this example, changing the partner will also change the name and the description values. It is up to the user whether or not to change the name and description values afterwards. Also note that we do not loop on ``self``, this is because the method is only triggered in a form view, where ``self`` is always a single record." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:269 msgid "Set values for garden area and orientation." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:271 msgid "Create an ``onchange`` in the ``estate.property`` model in order to set values for the garden area (10) and orientation (North) when garden is set to True. When unset, clear the fields." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:277 msgid "Onchanges methods can also return a non-blocking warning message (`example `__)." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:281 msgid "How to use them?" msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:283 msgid "There is no strict rule for the use of computed fields and onchanges." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:285 msgid "In many cases, both computed fields and onchanges may be used to achieve the same result. Always prefer computed fields since they are also triggered outside of the context of a form view. Never ever use an onchange to add business logic to your model. This is a **very bad** idea since onchanges are not automatically triggered when creating a record programmatically; they are only triggered in the form view." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:291 msgid "The usual pitfall of computed fields and onchanges is trying to be 'too smart' by adding too much logic. This can have the opposite result of what was expected: the end user is confused from all the automation." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:295 msgid "Computed fields tend to be easier to debug: such a field is set by a given method, so it's easy to track when the value is set. Onchanges, on the other hand, may be confusing: it is very difficult to know the extent of an onchange. Since several onchange methods may set the same fields, it easily becomes difficult to track where a value is coming from." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:300 msgid "When using stored computed fields, pay close attention to the dependencies. When computed fields depend on other computed fields, changing a value can trigger a large number of recomputations. This leads to poor performance." msgstr "" #: ../../content/developer/howtos/rdtraining/09_compute_onchange.rst:304 msgid "In the :ref:`next chapter`, we'll see how we can trigger some business logic when buttons are clicked." msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:5 msgid "Chapter 10: Ready For Some Action?" msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:7 msgid "So far we have mostly built our module by declaring fields and views. We just introduced business logic in the :ref:`previous chapter ` thanks to computed fields and onchanges. In any real business scenario, we would want to link some business logic to action buttons. In our real estate example, we would like to be able to:" msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:12 msgid "cancel or set a property as sold" msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:13 msgid "accept or refuse an offer" msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:15 msgid "One could argue that we can already do these things by changing the state manually, but this is not really convenient. Moreover, we want to add some extra processing: when an offer is accepted we want to set the selling price and the buyer for the property." msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:20 msgid "Action Type" msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:22 msgid "**Reference**: the documentation related to this topic can be found in :ref:`reference/actions` and :ref:`reference/exceptions`." msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:29 msgid "You should be able to cancel or set a property as sold:" msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:0 msgid "Cancel and set to sold" msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:35 msgid "A canceled property cannot be sold and a sold property cannot be canceled. For the sake of clarity, the ``state`` field has been added on the view." msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:38 msgid "You should be able to accept or refuse an offer:" msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:0 msgid "Accept or refuse an offer" msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:44 msgid "Once an offer is accepted, the selling price and the buyer should be set:" msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:0 msgid "Accept an offer" msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:50 msgid "In our real estate module, we want to link business logic with some buttons. The most common way to do this is to:" msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:53 msgid "Add a button in the view, for example in the ``header`` of the view:" msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:66 msgid "and link this button to business logic:" msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:82 msgid "By assigning ``type=\"object\"`` to our button, the Odoo framework will execute a Python method with ``name=\"action_do_something\"`` on the given model." msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:85 msgid "The first important detail to note is that our method name isn't prefixed with an underscore (``_``). This makes our method a **public** method, which can be called directly from the Odoo interface (through an RPC call). Until now, all methods we created (compute, onchange) were called internally, so we used **private** methods prefixed by an underscore. You should always define your methods as private unless they need to be called from the user interface." msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:91 msgid "Also note that we loop on ``self``. Always assume that a method can be called on multiple records; it's better for reusability." msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:94 msgid "Finally, a public method should always return something so that it can be called through XML-RPC. When in doubt, just ``return True``." msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:97 msgid "There are hundreds of examples in the Odoo source code. One example is this `button in a view `__ and its `corresponding Python method `__" msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:102 msgid "Cancel and set a property as sold." msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:104 msgid "Add the buttons 'Cancel' and 'Sold' to the ``estate.property`` model. A canceled property cannot be set as sold, and a sold property cannot be canceled." msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:107 msgid "Refer to the first image of the **Goal** for the expected result." msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:109 msgid "Tip: in order to raise an error, you can use the :ref:`UserError` function. There are plenty of examples in the Odoo source code ;-)" msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:112 msgid "Add the buttons 'Accept' and 'Refuse' to the ``estate.property.offer`` model." msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:114 msgid "Refer to the second image of the **Goal** for the expected result." msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:116 msgid "Tip: to use an icon as a button, have a look `at this example `__." msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:119 msgid "When an offer is accepted, set the buyer and the selling price for the corresponding property." msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:121 msgid "Refer to the third image of the **Goal** for the expected result." msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:123 msgid "Pay attention: in real life only one offer can be accepted for a given property!" msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:126 msgid "Object Type" msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:128 msgid "In :ref:`howto/rdtraining/06_firstui`, we created an action that was linked to a menu. You may be wondering if it is possible to link an action to a button. Good news, it is! One way to do it is:" msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:136 msgid "We use ``type=\"action\"`` and we refer to the :term:`external identifier` in the ``name``." msgstr "" #: ../../content/developer/howtos/rdtraining/10_actions.rst:138 msgid "In the :ref:`next chapter ` we'll see how we can prevent encoding incorrect data in Odoo." msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:5 msgid "Chapter 11: Constraints" msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:7 msgid "The :ref:`previous chapter ` introduced the ability to add some business logic to our model. We can now link buttons to business code, but how can we prevent users from entering incorrect data? For example, in our real estate module nothing prevents users from setting a negative expected price." msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:17 msgid "SQL" msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:19 msgid "**Reference**: the documentation related to this topic can be found in :ref:`reference/orm/models` and in the `PostgreSQL's documentation`_." msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:26 msgid "Amounts should be (strictly) positive" msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:0 msgid "Constraints on amounts" msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:32 msgid "Property types and tags should have a unique name" msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:0 msgid "Constraints on names" msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:38 msgid "SQL constraints are defined through the model attribute :attr:`~odoo.models.Model._sql_constraints`. This attribute is assigned a list of triples containing 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/rdtraining/11_constraints.rst:44 msgid "You can find a simple example `here `__." msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:47 msgid "Add SQL constraints." msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:49 msgid "Add the following constraints to their corresponding models:" msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:51 msgid "A property expected price must be strictly positive" msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:52 msgid "A property selling price must be positive" msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:53 msgid "An offer price must be strictly positive" msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:54 msgid "A property tag name and property type name must be unique" msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:56 msgid "Tip: search for the ``unique`` keyword in the Odoo codebase for examples of unique names." msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:58 msgid "Restart the server with the ``-u estate`` option to see the result. Note that you might have data that prevents a SQL constraint from being set. An error message similar to the following might pop up:" msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:65 msgid "For example, if some offers have a price of zero, then the constraint can't be applied. You can delete the problematic data in order to apply the new constraints." msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:69 #: ../../content/developer/reference/backend/security.rst:450 #: ../../content/developer/reference/backend/security.rst:452 #: ../../content/developer/reference/backend/testing.rst:716 #: ../../content/developer/reference/frontend/qweb.rst:354 #: ../../content/developer/reference/frontend/qweb.rst:468 msgid "Python" msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:71 msgid "**Reference**: the documentation related to this topic can be found in :func:`~odoo.api.constrains`." msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:76 msgid "**Goal**: at the end of this section, it will not possible to accept an offer lower than 90% of the expected price." msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:0 msgid "Python constraint" msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:83 msgid "SQL constraints are an efficient way of ensuring data consistency. However it may be necessary to make more complex checks which require Python code. In this case we need a Python constraint." msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:86 msgid "A Python constraint is defined as a method decorated with :func:`~odoo.api.constrains` and is invoked on a recordset. The decorator specifies which fields are involved in the constraint. The constraint is automatically evaluated when any of these fields are modified . The method is expected to raise an exception if its invariant is not satisfied::" msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:103 msgid "A simple example can be found `here `__." msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:106 msgid "Add Python constraints." msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:108 msgid "Add a constraint so that the selling price cannot be lower than 90% of the expected price." msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:110 msgid "Tip: the selling price is zero until an offer is validated. You will need to fine tune your check to take this into account." msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:115 msgid "Always use the :meth:`~odoo.tools.float_utils.float_compare` and :meth:`~odoo.tools.float_utils.float_is_zero` methods from `odoo.tools.float_utils` when working with floats!" msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:119 msgid "Ensure the constraint is triggered every time the selling price or the expected price is changed!" msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:121 msgid "SQL constraints are usually more efficient than Python constraints. When performance matters, always prefer SQL over Python constraints." msgstr "" #: ../../content/developer/howtos/rdtraining/11_constraints.rst:124 msgid "Our real estate module is starting to look good. We added some business logic, and now we make sure the data is consistent. However, the user interface is still a bit rough. Let's see how we can improve it in the :ref:`next chapter `." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:5 msgid "Chapter 12: Add The Sprinkles" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:7 msgid "Our real estate module now makes sense from a business perspective. We created :ref:`specific views `, added several :ref:`action buttons ` and :ref:`constraints `. However our user interface is still a bit rough. We would like to add some colors to the list views and make some fields and buttons conditionally disappear. For example, the 'Sold' and 'Cancel' buttons should disappear when the property is sold or canceled since it is no longer allowed to change the state at this point." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:15 msgid "This chapter covers a very small subset of what can be done in the views. Do not hesitate to read the reference documentation for a more complete overview." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:18 msgid "**Reference**: the documentation related to this chapter can be found in :ref:`reference/views`." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:22 msgid "Inline Views" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:26 msgid "**Goal**: at the end of this section, a specific list of properties should be added to the property type view:" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:0 msgid "Inline list view" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:33 msgid "In the real estate module we added a list of offers for a property. We simply added the field ``offer_ids`` with:" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:40 msgid "The field uses the specific view for ``estate.property.offer``. In some cases we want to define a specific list view which is only used in the context of a form view. For example, we would like to display the list of properties linked to a property type. However, we only want to display 3 fields for clarity: name, expected price and state." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:45 msgid "To do this, we can define *inline* list views. An inline list view is defined directly inside a form view. For example:" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:81 msgid "In the form view of the ``test.model``, we define a specific list view for ``test.model.line`` with fields ``field_1`` and ``field_2``." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:84 msgid "An example can be found `here `__." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:87 msgid "Add an inline list view." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:89 msgid "Add the ``One2many`` field ``property_ids`` to the ``estate.property.type`` model." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:90 msgid "Add the field in the ``estate.property.type`` form view as depicted in the **Goal** of this section." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:94 #: ../../content/developer/reference/frontend/javascript_reference.rst:278 #: ../../content/developer/reference/frontend/javascript_reference.rst:2092 msgid "Widgets" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:96 msgid "**Reference**: the documentation related to this section can be found in :ref:`reference/js/widgets`." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:101 msgid "**Goal**: at the end of this section, the state of the property should be displayed using a specific widget:" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:None msgid "Statusbar widget" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:108 msgid "Four states are displayed: New, Offer Received, Offer Accepted and Sold." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:110 msgid "Whenever we've added fields to our models, we've (almost) never had to worry about how these fields would look like in the user interface. For example, a date picker is provided for a ``Date`` field and a ``One2many`` field is automatically displayed as a list. Odoo chooses the right 'widget' depending on the field type." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:115 msgid "However, in some cases, we want a specific representation of a field which can be done thanks to the ``widget`` attribute. We already used it for the ``tag_ids`` field when we used the ``widget=\"many2many_tags\"`` attribute. If we hadn't used it, then the field would have displayed as a list." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:120 msgid "Each field type has a set of widgets which can be used to fine tune its display. Some widgets also take extra options. An exhaustive list can be found in :ref:`reference/js/widgets`." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:123 msgid "Use the status bar widget." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:125 msgid "Use the ``statusbar`` widget in order to display the ``state`` of the ``estate.property`` as depicted in the **Goal** of this section." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:128 msgid "Tip: a simple example can be found `here `__." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:131 msgid "Same field multiple times in a view" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:133 msgid "Add a field only **once** to a list or a form view. Adding it multiple times is not supported." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:137 msgid "List Order" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:139 msgid "**Reference**: the documentation related to this section can be found in :ref:`reference/orm/models`." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:144 msgid "**Goal**: at the end of this section, all lists should display by default in a deterministic order. Property types can be ordered manually." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:147 msgid "During the previous exercises, we created several list views. However, at no point did we specify which order the records had to be listed in by default. This is a very important thing for many business cases. For example, in our real estate module we would want to display the highest offers on top of the list." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:153 #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:182 #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:215 #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:262 #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:249 #: ../../content/developer/reference/backend/orm.rst:95 msgid "Model" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:155 msgid "Odoo provides several ways to set a default order. The most common way is to define the ``_order`` attribute directly in the model. This way, the retrieved records will follow a deterministic order which will be consistent in all views including when records are searched programmatically. By default there is no order specified, therefore the records will be retrieved in a non-deterministic order depending on PostgreSQL." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:161 msgid "The ``_order`` attribute takes a string containing a list of fields which will be used for sorting. It will be converted to an order_by_ clause in SQL. For example:" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:175 msgid "Our records are ordered by descending ``id``, meaning the highest comes first." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:177 msgid "Add model ordering." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:179 msgid "Define the following orders in their corresponding models:" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:182 msgid "Order" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:184 #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:305 msgid "``estate.property``" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:184 msgid "Descending ID" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:185 msgid "``estate.property.offer``" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:185 msgid "Descending Price" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:186 #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:264 msgid "``estate.property.tag``" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:186 #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:187 #: ../../content/developer/reference/frontend/framework_overview.rst:261 #: ../../content/developer/reference/frontend/hooks.rst:21 #: ../../content/developer/reference/frontend/odoo_editor.rst:146 #: ../../content/developer/reference/frontend/odoo_editor.rst:172 #: ../../content/developer/reference/frontend/odoo_editor.rst:216 #: ../../content/developer/reference/frontend/owl_components.rst:236 #: ../../content/developer/reference/frontend/owl_components.rst:315 #: ../../content/developer/reference/frontend/owl_components.rst:630 #: ../../content/developer/reference/frontend/services.rst:245 #: ../../content/developer/reference/frontend/services.rst:437 #: ../../content/developer/reference/frontend/services.rst:465 #: ../../content/developer/reference/frontend/services.rst:736 #: ../../content/developer/reference/frontend/services.rst:851 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountAccountTemplate.name:1 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.name:1 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountGroupTemplate.name:1 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReport.name:1 #: ../../../odoo/addons/account/models/account_report.py:docstring of odoo.addons.account.models.account_report.AccountReportLine.name:1 msgid "Name" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:187 #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:217 #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:307 msgid "``estate.property.type``" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:191 #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:319 msgid "View" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:193 msgid "Ordering is possible at the model level. This has the advantage of a consistent order everywhere a list of records is retrieved. However, it is also possible to define a specific order directly in a view thanks to the ``default_order`` attribute (`example `__)." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:199 msgid "Manual" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:201 msgid "Both model and view ordering allow flexibility when sorting records, but there is still one case we need to cover: the manual ordering. A user may want to sort records depending on the business logic. For example, in our real estate module we would like to sort the property types manually. It is indeed useful to have the most used types appear at the top of the list. If our real estate agency mainly sells houses, it is more convenient to have 'House' appear before 'Apartment'." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:207 msgid "To do so, a ``sequence`` field is used in combination with the ``handle`` widget. Obviously the ``sequence`` field must be the first field in the ``_order`` attribute." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:210 msgid "Add manual ordering." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:212 #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:259 msgid "Add the following field:" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:217 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountFiscalPositionTemplate.sequence:1 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.sequence:1 msgid "Sequence" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:220 msgid "Add the sequence to the ``estate.property.type`` list view with the correct widget." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:222 msgid "Tip: you can find an example here: `model `__ and `view `__." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:228 msgid "Attributes and options" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:230 msgid "It would be prohibitive to detail all the available features which allow fine tuning of the look of a view. Therefore, we'll stick to the most common ones." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:238 msgid "**Goal**: at the end of this section, the property form view will have:" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:240 msgid "Conditional display of buttons and fields" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:241 msgid "Tag colors" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:0 msgid "Form view with sprinkles" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:248 msgid "In our real estate module, we want to modify the behavior of some fields. For example, we don't want to be able to create or edit a property type from the form view. Instead we expect the types to be handled in their appropriate menu. We also want to give tags a color. In order to add these behavior customizations, we can add the ``options`` attribute to several field widgets." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:253 msgid "Add widget options." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:255 msgid "Add the appropriate option to the ``property_type_id`` field to prevent the creation and the editing of a property type from the property form view. Have a look at the :ref:`Many2one widget documentation ` for more info." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:264 msgid "Color" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:267 msgid "Then add the appropriate option to the ``tag_ids`` field to add a color picker on the tags. Have a look at the :ref:`FieldMany2ManyTags widget documentation ` for more info." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:271 msgid "In :ref:`howto/rdtraining/06_firstui`, we saw that reserved fields were used for specific behaviors. For example, the ``active`` field is used to automatically filter out inactive records. We added the ``state`` as a reserved field as well. It's now time to use it! A ``state`` field is used in combination with a ``states`` attribute in the view to display buttons conditionally." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:277 msgid "Add conditional display of buttons." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:279 msgid "Use the ``states`` attribute to display the header buttons conditionally as depicted in this section's **Goal** (notice how the 'Sold' and 'Cancel' buttons change when the state is modified)." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:282 msgid "Tip: do not hesitate to search for ``states=`` in the Odoo XML files for some examples." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:284 msgid "More generally, it is possible to make a field ``invisible``, ``readonly`` or ``required`` based on the value of other fields thanks to the ``attrs`` attribute. Note that ``invisible`` can also be applied to other elements of the view such as ``button`` or ``group``." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:288 msgid "The ``attrs`` is a dictionary with the property as a key and a domain as a value. The domain gives the condition in which the property applies. For example:" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:298 msgid "This means that the ``description`` field is invisible when ``is_partner`` is ``False``. It is important to note that a field used in an ``attrs`` **must** be present in the view. If it should not be displayed to the user, we can use the ``invisible`` attribute to hide it." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:302 msgid "Use ``attrs``." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:304 msgid "Make the garden area and orientation invisible in the ``estate.property`` form view when there is no garden." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:306 msgid "Make the 'Accept' and 'Refuse' buttons invisible once the offer state is set." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:307 msgid "Do not allow adding an offer when the property state is 'Offer Accepted', 'Sold' or 'Canceled'. To do this use the ``readonly`` ``attrs``." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:312 msgid "Using a (conditional) ``readonly`` attribute in the view can be useful to prevent data entry errors, but keep in mind that it doesn't provide any level of security! There is no check done server-side, therefore it's always possible to write on the field through a RPC call." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:321 msgid "**Goal**: at the end of this section, the property and offer list views should have color decorations. Additionally, offers and tags will be editable directly in the list, and the availability date will be hidden by default." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:0 msgid "List view with decorations and optional field" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:0 msgid "Editable list" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:333 msgid "When the model only has a few fields, it can be useful to edit records directly through the list view and not have to open the form view. In the real estate example, there is no need to open a form view to add an offer or create a new tag. This can be achieved thanks to the ``editable`` attribute." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:337 msgid "Make list views editable." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:339 msgid "Make the ``estate.property.offer`` and ``estate.property.tag`` list views editable." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:341 msgid "On the other hand, when a model has a lot of fields it can be tempting to add too many fields in the list view and make it unclear. An alternative method is to add the fields, but make them optionally hidden. This can be achieved thanks to the ``optional`` attribute." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:345 msgid "Make a field optional." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:347 msgid "Make the field ``date_availability`` on the ``estate.property`` list view optional and hidden by default." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:350 msgid "Finally, color codes are useful to visually emphasize records. For example, in the real estate module we would like to display refused offers in red and accepted offers in green. This can be achieved thanks to the ``decoration-{$name}`` attribute (see :ref:`reference/js/widgets` for a complete list):" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:362 msgid "The records where ``is_partner`` is ``True`` will be displayed in green." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:364 msgid "Add some decorations." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:366 msgid "On the ``estate.property`` list view:" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:368 msgid "Properties with an offer received are green" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:369 msgid "Properties with an offer accepted are green and bold" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:370 msgid "Properties sold are muted" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:372 msgid "On the ``estate.property.offer`` list view:" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:374 msgid "Refused offers are red" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:375 msgid "Accepted offers are green" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:376 msgid "The state should not be visible anymore" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:380 msgid "Keep in mind that **all** fields used in attributes must be in the view!" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:381 msgid "If you want to test the color of the \"Offer Received\" and \"Offer Accepted\" states, add the field in the form view and change it manually (we'll implement the business logic for this later)." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:387 msgid "**Reference**: the documentation related to this section can be found in :ref:`reference/views/search` and :ref:`reference/views/search/defaults`." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:392 msgid "**Goal**: at the end of this section, the available properties will be filtered by default, and searching on the living area returns results where the area is larger than the given number." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:0 msgid "Default filters and domains" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:400 msgid "Last but not least, there are some tweaks we would like to apply when searching. First of all, we want to have our 'Available' filter applied by default when we access the properties. To make this happen, we need to use the ``search_default_{$name}`` action context, where ``{$name}`` is the filter name. This means that we can define which filter(s) will be activated by default at the action level." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:405 msgid "Here is an example of an `action `__ with its `corresponding filter `__." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:410 msgid "Add a default filter." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:412 msgid "Make the 'Available' filter selected by default in the ``estate.property`` action." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:414 msgid "Another useful improvement in our module would be the ability to search efficiently by living area. In practice, a user will want to search for properties of 'at least' the given area. It is unrealistic to expect users would want to find a property of an exact living area. It is always possible to make a custom search, but that's inconvenient." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:419 msgid "Search view ```` 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 ``name`` and ``description`` fields." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:431 msgid "Change the living area search." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:433 msgid "Add a ``filter_domain`` to the living area to include properties with an area equal to or greater than the given value." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:437 msgid "Stat Buttons" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:441 msgid "**Goal**: at the end of this section, there will be a stat button on the property type form view which shows the list of all offers related to properties of the given type when it is clicked on." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:0 msgid "Stat button" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:448 msgid "If you've already used some functional modules in Odoo, you've probably already encountered a 'stat button'. These buttons are displayed on the top right of a form view and give a quick access to linked documents. In our real estate module, we would like to have a quick link to the offers related to a given property type as depicted in the **Goal** of this section." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:453 msgid "At this point of the tutorial we have already seen most of the concepts to do this. However, there is not a single solution and it can still be confusing if you don't know where to start from. We'll describe a step-by-step solution in the exercise. It can always be useful to find some examples in the Odoo codebase by looking for ``oe_stat_button``." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:458 msgid "The following exercise might be a bit more difficult than the previous ones since it assumes you are able to search for examples in the source code on your own. If you are stuck there is probably someone nearby who can help you ;-)" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:462 msgid "The exercise introduces the concept of :ref:`reference/fields/related`. The easiest way to understand it is to consider it as a specific case of a computed field. The following definition of the ``description`` field:" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:473 msgid "is equivalent to:" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:487 msgid "Every time the partner name is changed, the description is modified." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:489 msgid "Add a stat button to property type." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:491 msgid "Add the field ``property_type_id`` to ``estate.property.offer``. We can define it as a related field on ``property_id.property_type_id`` and set it as stored." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:494 msgid "Thanks to this field, an offer will be linked to a property type when it's created. You can add the field to the list view of offers to make sure it works." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:497 msgid "Add the field ``offer_ids`` to ``estate.property.type`` which is the One2many inverse of the field defined in the previous step." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:500 msgid "Add the field ``offer_count`` to ``estate.property.type``. It is a computed field that counts the number of offers for a given property type (use ``offer_ids`` to do so)." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:503 msgid "At this point, you have all the information necessary to know how many offers are linked to a property type. When in doubt, add ``offer_ids`` and ``offer_count`` directly to the view. The next step is to display the list when clicking on the stat button." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:507 msgid "Create a stat button on ``estate.property.type`` pointing to the ``estate.property.offer`` action. This means you should use the ``type=\"action\"`` attribute (go back to the end of :ref:`howto/rdtraining/10_actions` if you need a refresher)." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:511 msgid "At this point, clicking on the stat button should display all offers. We still need to filter out the offers." msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:514 msgid "On the ``estate.property.offer`` action, add a domain that defines ``property_type_id`` as equal to the ``active_id`` (= the current record, `here is an example `__)" msgstr "" #: ../../content/developer/howtos/rdtraining/12_sprinkles.rst:518 msgid "Looking good? If not, don't worry, the :ref:`next chapter ` doesn't require stat buttons ;-)" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:5 msgid "Chapter 13: Inheritance" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:7 msgid "A powerful aspect of Odoo is its modularity. A module is dedicated to a business need, but modules can also interact with one another. This is useful for extending the functionality of an existing module. For example, in our real estate scenario we want to display the list of a salesperson's properties directly in the regular user view." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:12 msgid "But before going through the specific Odoo module inheritance, let's see how we can alter the behavior of the standard CRUD (Create, Retrieve, Update or Delete) methods." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:16 msgid "Python Inheritance" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:22 msgid "It should not be possible to delete a property which is not new or canceled." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:0 #: ../../content/developer/reference/backend/orm.rst:972 msgid "Unlink" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:28 msgid "When an offer is created, the property state should change to 'Offer Received'" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:29 msgid "It should not be possible to create an offer with a lower price than an existing offer" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:0 msgid "Create" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:35 msgid "In our real estate module, we never had to develop anything specific to be able to do the standard CRUD actions. The Odoo framework provides the necessary tools to do them. In fact, such actions are already included in our model thanks to classical Python inheritance::" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:48 msgid "Our ``class TestModel`` inherits from :class:`~odoo.models.Model` which provides :meth:`~odoo.models.Model.create`, :meth:`~odoo.models.Model.read`, :meth:`~odoo.models.Model.write` and :meth:`~odoo.models.Model.unlink`." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:52 msgid "These methods (and any other method defined on :class:`~odoo.models.Model`) can be extended to add specific business logic::" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:70 msgid "The decorator :func:`~odoo.api.model` is necessary for the :meth:`~odoo.models.Model.create` method because the content of the recordset ``self`` is not relevant in the context of creation, but it is not necessary for the other CRUD methods." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:74 msgid "It is also important to note that even though we can directly override the :meth:`~odoo.models.Model.unlink` method, you will almost always want to write a new method with the decorator :func:`~odoo.api.ondelete` instead. Methods marked with this decorator will be called during :meth:`~odoo.models.Model.unlink` and avoids some issues that can occur during uninstalling the model's module when :meth:`~odoo.models.Model.unlink` is directly overridden." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:80 msgid "In Python 3, ``super()`` is equivalent to ``super(TestModel, self)``. The latter may be necessary when you need to call the parent method with a modified recordset." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:85 msgid "It is very important to **always** call ``super()`` to avoid breaking the flow. There are only a few very specific cases where you don't want to call it." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:87 msgid "Make sure to **always** return data consistent with the parent method. For example, if the parent method returns a ``dict()``, your override must also return a ``dict()``." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:90 msgid "Add business logic to the CRUD methods." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:92 msgid "Prevent deletion of a property if its state is not 'New' or 'Canceled'" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:94 msgid "Tip: create a new method with the :func:`~odoo.api.ondelete` decorator and remember that ``self`` can be a recordset with more than one record." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:97 msgid "At offer creation, set the property state to 'Offer Received'. Also raise an error if the user tries to create an offer with a lower amount than an existing offer." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:100 msgid "Tip: the ``property_id`` field is available in the ``vals``, but it is an ``int``. To instantiate an ``estate.property`` object, use ``self.env[model_name].browse(value)`` (`example `__)" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:105 msgid "Model Inheritance" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:107 msgid "**Reference**: the documentation related to this topic can be found in :ref:`reference/orm/inheritance`." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:110 msgid "In our real estate module, we would like to display the list of properties linked to a salesperson directly in the Settings / Users & Companies / Users form view. To do this, we need to add a field to the ``res.users`` model and adapt its view to show it." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:116 msgid "The first inheritance mechanism allows modules to modify the behavior of a model defined in an another module by:" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:119 msgid "adding fields to the model," msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:120 msgid "overriding the definition of fields in the model," msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:121 msgid "adding constraints to the model," msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:122 msgid "adding methods to the model," msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:123 msgid "overriding existing methods in the model." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:125 msgid "The second inheritance mechanism (delegation) allows every record of a model to be linked to a parent model's record and provides transparent access to the fields of this parent record." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:None msgid "Inheritance Methods" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:133 msgid "In Odoo, the first mechanism is by far the most used. In our case, we want to add a field to an existing model, which means we will use the first mechanism. For example::" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:143 msgid "A practical example where two fields are added to a model can be found `here `__." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:147 msgid "By convention, each inherited model is defined in its own Python file. In our example, it would be ``models/inherited_model.py``." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:150 msgid "Add a field to Users." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:152 msgid "Add the following field to ``res.users``:" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:157 msgid "property_ids" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:157 msgid "One2many inverse of ``user_id`` to ``estate.property``" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:160 msgid "Add a domain to the field so it only lists the available properties." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:162 msgid "In the next section let's add the field to the view and check that everything is working well!" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:165 msgid "View Inheritance" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:167 msgid "**Reference**: the documentation related to this topic can be found in :ref:`reference/views/inheritance`." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:172 msgid "**Goal**: at the end of this section, the list of available properties linked to a salesperson should be displayed in their user form view" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:0 msgid "Users" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:179 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. These extension can both add and remove content from their parent view." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:183 msgid "An extension view references its parent using the ``inherit_id`` field. Instead of a single view, its ``arch`` field contains a number of ``xpath`` elements that select and alter the content of their parent view:" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:209 msgid "appends ``xpath``'s body to the end of the matched element" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:218 msgid "alters the attributes of the matched element using the special ``attribute`` elements in the ``xpath``'s body" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:221 msgid "When matching a single element, the ``position`` attribute can be set directly on the element to be found. Both inheritances below have the same result." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:234 msgid "An example of a view inheritance extension can be found `here `__." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:237 msgid "Add fields to the Users view." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:239 msgid "Add the ``property_ids`` field to the ``base.view_users_form`` in a new notebook page." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:241 msgid "Tip: an example an inheritance of the users' view can be found `here `__." msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:244 msgid "Inheritance is extensively used in Odoo due to its modular concept. Do not hesitate to read the corresponding documentation for more info!" msgstr "" #: ../../content/developer/howtos/rdtraining/13_inheritance.rst:247 msgid "In the :ref:`next chapter `, we will learn how to interact with other modules." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:5 msgid "Chapter 14: Interact With Other Modules" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:7 msgid "In the :ref:`previous chapter `, we used inheritance to modify the behavior of a module. In our real estate scenario, we would like to go a step further and be able to generate invoices for our customers. Odoo provides an Invoicing module, so it would be neat to create an invoice directly from our real estate module, i.e. once a property is set to 'Sold', an invoice is created in the Invoicing application." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:14 msgid "Concrete Example: Account Move" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:20 msgid "A new module ``estate_account`` should be created" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:21 msgid "When a property is sold, an invoice should be issued for the buyer" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:0 msgid "Invoice creation" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:27 msgid "Any time we interact with another module, we need to keep in mind the modularity. If we intend to sell our application to real estate agencies, some may want the invoicing feature but others may not want it." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:32 msgid "Link Module" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:34 msgid "The common approach for such use cases is to create a 'link' module. In our case, the module would depend on ``estate`` and ``account`` and would include the invoice creation logic of the estate property. This way the real estate and the accounting modules can be installed independently. When both are installed, the link module provides the new feature." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:39 msgid "Create a link module." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:41 msgid "Create the ``estate_account`` module, which depends on the ``estate`` and ``account`` modules. For now, it will be an empty shell." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:44 msgid "Tip: you already did this at the :ref:`beginning of the tutorial `. The process is very similar." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:47 msgid "When the ``estate_account`` module appears in the list, go ahead and install it! You'll notice that the Invoicing application is installed as well. This is expected since your module depends on it. If you uninstall the Invoicing application, your module will be uninstalled as well." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:54 msgid "Invoice Creation" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:56 msgid "It's now time to generate the invoice. We want to add functionality to the ``estate.property`` model, i.e. we want to add some extra logic for when a property is sold. Does that sound familiar? If not, it's a good idea to go back to the :ref:`previous chapter ` since you might have missed something ;-)" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:61 msgid "As a first step, we need to extend the action called when pressing the :ref:`'Sold' button ` on a property. To do so, we need to create a :ref:`model inheritance ` in the ``estate_account`` module for the ``estate.property`` model. For now, the overridden action will simply return the ``super`` call. Maybe an example will make things clearer::" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:75 msgid "A practical example can be found `here `__." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:78 msgid "Add the first step of invoice creation." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:80 msgid "Create a ``estate_property.py`` file in the correct folder of the ``estate_account`` module." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:81 msgid "``_inherit`` the ``estate.property`` model." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:82 msgid "Override the ``action_sold`` method (you might have named it differently) to return the ``super`` call." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:85 msgid "Tip: to make sure it works, add a ``print`` or a debugger breakpoint in the overridden method." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:87 msgid "Is it working? If not, maybe check that all Python files are correctly imported." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:89 msgid "If the override is working, we can move forward and create the invoice. Unfortunately, there is no easy way to know how to create any given object in Odoo. Most of the time, it is necessary to have a look at its model to find the required fields and provide appropriate values." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:93 msgid "A good way to learn is to look at how other modules already do what you want to do. For example, one of the basic flows of Sales is the creation of an invoice from a sales order. This looks like a good starting point since it does exactly what we want to do. Take some time to read and understand the `_create_invoices `__ method. When you are done crying because this simple task looks awfully complex, we can move forward in the tutorial." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:100 msgid "To create an invoice, we need the following information:" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:102 msgid "a ``partner_id``: the customer" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:103 msgid "a ``move_type``: it has several `possible values `__" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:104 msgid "a ``journal_id``: the accounting journal" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:106 msgid "This is enough to create an empty invoice." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:108 msgid "Add the second step of invoice creation." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:110 msgid "Create an empty ``account.move`` in the override of the ``action_sold`` method:" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:112 msgid "the ``partner_id`` is taken from the current ``estate.property``" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:113 msgid "the ``move_type`` should correspond to a 'Customer Invoice'" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:114 msgid "the ``journal_id`` must be a ``sale`` journal (when in doubt, have a look `here `__)" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:119 msgid "to create an object, use ``self.env[model_name].create(values)``, where ``values`` is a ``dict``." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:121 msgid "the ``create`` method doesn't accept recordsets as field values." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:123 msgid "When a property is set to 'Sold', you should now have a new customer invoice created in Invoicing / Customers / Invoices." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:126 msgid "Obviously we don't have any invoice lines so far. To create an invoice line, we need the following information:" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:129 msgid "``name``: a description of the line" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:130 msgid "``quantity``" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:131 msgid "``price_unit``" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:133 msgid "Moreover, an invoice line needs to be linked to an invoice. The easiest and most efficient way to link a line to an invoice is to include all lines at invoice creation. To do this, the ``invoice_line_ids`` field is included in the ``account.move`` creation, which is a :class:`~odoo.fields.One2many`. One2many and Many2many use special 'commands' which have been made human readable with the :class:`~odoo.fields.Command` namespace. This namespace represents a triplet command to execute on a set of records. The triplet was originally the only option to do these commands, but it is now standard to use the namespace instead. The format is to place them in a list which is executed sequentially. Here is a simple example to include a One2many field ``line_ids`` at creation of a ``test.model``::" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:159 msgid "Add the third step of invoice creation." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:161 msgid "Add two invoice lines during the creation of the ``account.move``. Each property sold will be invoiced following these conditions:" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:164 msgid "6% of the selling price" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:165 msgid "an additional 100.00 from administrative fees" msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:167 msgid "Tip: Add the ``invoice_line_ids`` at creation following the example above. For each line, we need a ``name``, ``quantity`` and ``price_unit``." msgstr "" #: ../../content/developer/howtos/rdtraining/14_other_module.rst:170 msgid "This chapter might be one of the most difficult that has been covered so far, but it is the closest to what Odoo development will be in practice. In the :ref:`next chapter `, we will introduce the templating mechanism used in Odoo." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:5 msgid "Chapter 15: A Brief History Of QWeb" msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:7 msgid "So far the interface design of our real estate module has been rather limited. Building a list view is straightforward since only the list of fields is necessary. The same holds true for the form view: despite the use of a few tags such as ```` or ````, there is very little to do in terms of design." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:12 msgid "However, if we want to give a unique look to our application, it is necessary to go a step further and be able to design new views. Moreover, other features such as PDF reports or website pages need another tool to be created with more flexibility: a templating_ engine." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:16 msgid "You might already be familiar with existing engines such as Jinja (Python), ERB (Ruby) or Twig (PHP). Odoo comes with its own built-in engine: :ref:`reference/qweb`. QWeb is the primary templating engine used by Odoo. It is an XML templating engine and used mostly to generate HTML fragments and pages." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:21 msgid "You probably already have come across the `kanban board`_ in Odoo where the records are displayed in a card-like structure. We will build such a view for our real estate module." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:25 msgid "Concrete Example: A Kanban View" msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:27 msgid "**Reference**: the documentation related to this topic can be found in :ref:`reference/views/kanban`." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:32 msgid "**Goal**: at the end of this section a Kanban view of the properties should be created:" msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:38 msgid "In our estate application, we would like to add a Kanban view to display our properties. Kanban views are a standard Odoo view (like the form and list views), but their structure is much more flexible. In fact, the structure of each card is a mix of form elements (including basic HTML) and QWeb. The definition of a Kanban view is similar to the definition of the list and form views, except that their root element is ````. In its simplest form, a Kanban view looks like:" msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:57 msgid "Let's break down this example:" msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:59 msgid "````: defines a list of :ref:`reference/qweb` templates. Kanban views *must* define at least one root template ``kanban-box``, which will be rendered once for each record." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:61 msgid "````: ```` is a placeholder element for QWeb directives. In this case, it is used to set the ``name`` of the template to ``kanban-box``" msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:63 msgid "``
``: the ``oe_kanban_global_click`` makes the ``
`` clickable to open the record." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:65 msgid "````: this will add the ``name`` field to the view." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:67 msgid "Make a minimal kanban view." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:69 msgid "Using the simple example provided, create a minimal Kanban view for the properties. The only field to display is the ``name``." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:72 msgid "Tip: you must add ``kanban`` in the ``view_mode`` of the corresponding ``ir.actions.act_window``." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:75 msgid "Once the Kanban view is working, we can start improving it. If we want to display an element conditionally, we can use the ``t-if`` directive (see :ref:`reference/qweb/conditionals`)." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:94 msgid "We added a few things:" msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:96 msgid "``t-if``: the ``
`` element is rendered if the condition is true." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:97 msgid "``record``: 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 and the latter is the direct value from a :meth:`~odoo.models.Model.read`." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:101 msgid "In the above example, the field ``name`` was added in the ```` element, but ``state`` is outside of it. When we need the value of a field but don't want to display it in the view, it is possible to add it outside of the ```` element." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:105 msgid "Improve the Kanban view." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:107 msgid "Add the following fields to the Kanban view: expected price, best price, selling price and tags. Pay attention: the best price is only displayed when an offer is received, while the selling price is only displayed when an offer is accepted." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:111 #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:121 msgid "Refer to the **Goal** of the section for a visual example." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:113 msgid "Let's give the final touch to our view: the properties must be grouped by type by default. You might want to have a look at the various options described in :ref:`reference/views/kanban`." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:116 msgid "Add default grouping." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:118 msgid "Use the appropriate attribute to group the properties by type by default. You must also prevent drag and drop." msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:123 msgid "Kanban views are a typical example of how it is always a good idea to start from an existing view and fine tune it instead of starting from scratch. There are many options and classes available, so... read and learn!" msgstr "" #: ../../content/developer/howtos/rdtraining/15_qwebintro.rst:127 msgid "It is now time to add the :ref:`final touches to our application and submit it on GitHub `!" msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:5 msgid "Chapter 16: Polish Your Code And Submit Your PR" msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:7 msgid "In the previous chapters we saw how to create a fully functional business application. Now we will prepare our code to be shared and learn how to share it." msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:11 msgid "Coding guidelines" msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:13 msgid "We will start refactoring the code to match to the Odoo coding guidelines. The guidelines aim to improve the quality of the Odoo Apps code." msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:17 msgid "**Reference**: you will find the Odoo coding guidelines in :doc:`/contributing/development/coding_guidelines`." msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:20 msgid "Polish your code." msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:22 msgid "Refactor your code to respect the coding guidelines. Don't forget to run your linter and respect the module structure, the variable names, the method name convention, the model attribute order and the xml ids." msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:27 msgid "Your first Pull Request (PR)" msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:29 msgid "**The following is intended to be used by Odoo staff members only. All repositories mentioned are not accessible for third-parties.**" msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:32 msgid "Now that your code respects the Odoo code guidelines and is polished up, let's share it with others." msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:35 msgid "Configure development repository" msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:37 msgid "We will start by creating a git development environment for the 'custom' folder, like we did in the beginning for 'odoo' and 'enterprise'. The PR will target the `odoo/technical-training-sandbox` repository." msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:40 msgid "To do this the first step is to `fork `__ in GitHub `this repository `__ to create your own development repository." msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:45 msgid "After you successfully created your development repository, we will configure your existing `$HOME/src/custom` folder to be able to commit your work." msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:60 msgid "Note that if your work is already in a :ref:`Git and GitHub configured folder ` the previous steps are not needed. This is the case when you start working in the 'odoo' or 'enterprise' folders." msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:65 msgid "Branch, Commit & Push" msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:67 msgid "Before creating the PR, a new working branch has to be created and used to commit the code. Afterwards the branch will be pushed to the development repository." msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:70 msgid "Create your working branch:" msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:76 msgid "Your branch name must follow the following name structure : --" msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:78 msgid "Example: The branch master-sale-fixes-abc on odoo-dev/odoo is a branch containing fixes for the sales app in the odoo/odoo repository, to be deployed in master and done by ABC." msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:81 msgid "Commit your code:" msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:90 msgid "**Everyone reads your commit messages!**" msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:92 msgid "The commit message is very important, follow the :ref:`Git guidelines `." msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:96 msgid "Push your new branch to your development repository:" msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:102 msgid "NEVER use `git push --force` (or `git push -f`) with a branch that does not belong to you or in a stable branch. Never, never, never!" msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:105 msgid "Remember that you can use `git status` at any point to check the current status of your branch" msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:106 msgid "You can create git aliases to shorten some of these commands. Ask your colleagues if they use git aliases and get inspired by their work." msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:110 msgid "Create your first PR" msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:112 msgid "After pushing your branch to your development repository you will see an output similar to:" msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:130 msgid "There are two ways to create the PR:" msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:132 msgid "Click on the link displayed in the output of the push command." msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:133 msgid "Open a browser in your development repository `https://github.com/xyz-odoo/technical-training-sandbox`. There will be a button to create a new pull request." msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:138 msgid "You will notice that your commit message is used as the pull request message. This occurs if you have only 1 commit. If you have multiple commits, you can either make a summary of the commits as the PR message or if there aren't that many commits you can just copy/paste your commit messages as the PR message." msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:145 msgid "Test on the runbot" msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:147 msgid "Odoo has its own :abbr:`CI (Continuous integration)` server named `runbot `__. All commits, branches and PR will be tested to avoid regressions or breaking of the stable versions. All the runs that pass the tests are deployed on their own server with demo data." msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:151 msgid "Play with the runbot." msgstr "" #: ../../content/developer/howtos/rdtraining/16_guidelines_pr.rst:153 msgid "Feel free to go to the runbot website and open the last stable version of Odoo to check out all the available applications and functionalities." msgstr "" #: ../../content/developer/howtos/rdtraining/A_i18n.rst:7 msgid "Advanced A: Internationalization" msgstr "" #: ../../content/developer/howtos/rdtraining/A_i18n.rst:9 #: ../../content/developer/howtos/rdtraining/F_jstour.rst:9 #: ../../content/developer/howtos/rdtraining/G_website.rst:9 #: ../../content/developer/howtos/rdtraining/H_adv_views.rst:9 #: ../../content/developer/howtos/rdtraining/I_jswidget.rst:9 #: ../../content/developer/howtos/rdtraining/L_cron.rst:9 #: ../../content/developer/howtos/rdtraining/M_migration.rst:9 #: ../../content/developer/howtos/rdtraining/O_perf.rst:9 msgid "Hopefully, this topic will be written soon :-)" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:5 msgid "Advanced B: ACL and Record Rules" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:7 msgid "ACL stands for \"Access Control List\"" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:11 msgid "This tutorial assumes you have completed the :ref:`Core Training `." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:14 #: ../../content/developer/howtos/rdtraining/J_reports.rst:12 #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:12 msgid "To follow the exercise, it is recommended that you fetch the branch 15.0-core from the `technical training solutions `__ repository. It contains a version of the module created during the core training we can use as a starting point." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:20 msgid "So far we have mostly concerned ourselves with implementing useful features. However in most business scenarios *security* quickly becomes a concern: currently," msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:24 msgid "Any employee (which is what ``group_user`` stands for) can create, read, update or delete properties, property types, or property tags." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:26 msgid "If ``estate_account`` is installed then only agents allowed to interact with invoicing can confirm sales as that's necessary to :ref:`create an invoice `." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:30 msgid "However:" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:32 msgid "We do not want third parties to be able to access properties directly." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:33 msgid "Not all our employees may be real-estate agents (e.g. administrative personnel, property managers, ...), we don't want non-agents to see the available properties." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:36 msgid "Real-estate agents don't need or get to decide what property types or tags are *available*." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:38 msgid "Real-estate agents can have *exclusive* properties, we do not want one agent to be able to manage another's exclusives." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:40 msgid "All real-estate agents should be able to confirm the sale of a property they can manage, but we do not want them to be able to validate or mark as paid any invoice in the system." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:46 msgid "We may actually be fine with some or most of these for a small business." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:48 msgid "Because it's easier for users to disable unnecessary security rules than it is to create them from nothing, it's better to err on the side of caution and limit access: users can relax that access if necessary or convenient." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:53 msgid "Groups" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:57 msgid "The documentation related to this topic can be found in :ref:`the security reference `." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:60 msgid ":doc:`/contributing/development/coding_guidelines` document the format and location of master data items." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:63 #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:145 #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:210 #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:279 #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:323 #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:400 #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:471 msgid "**Goal**" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:65 #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:147 msgid "At the end of this section," msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:67 msgid "We can make employees *real-estate agents* or *real-estate managers*." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:68 msgid "The ``admin`` user is a real-estate manager." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:69 msgid "We have a new *real-estate agent* employee with no access to invoicing or administration." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:72 msgid "It would not be practical to attach individual security rules to employees any time we need a change so *groups* link security rules and users. They correspond to roles that can be assigned to employees." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:76 msgid "For most Odoo applications [#app]_ a good baseline is to have *user* and *manager* (or administrator) roles: the manager can change the configuration of the application and oversee the entirety of its use while the user can well, use the application [#appuser]_." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:81 msgid "This baseline seems sufficient for us:" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:83 msgid "Real estate managers can configure the system (manage available types and tags) as well as oversee every property in the pipeline." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:85 msgid "Real estate agents can manage the properties under their care, or properties which are not specifically under the care of any agent." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:88 msgid "In keeping with Odoo's data-driven nature, a group is no more than a record of the ``res.groups`` model. They are normally part of a module's :ref:`master data `, defined in one of the module's data files." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:92 msgid "As simple example `can be found here `_." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:96 msgid "Create the ``security.xml`` file in the appropriate folder and add it to the ``__manifest__.py`` file." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:98 msgid "If not already, add a ``'category'`` field to your ``__manifest__.py`` with value ``Real Estate/Brokerage``." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:100 msgid "Add a record creating a group with the id ``estate_group_user``, the name \"Agent\" and the category ``base.module_category_real_estate_brokerage``." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:103 msgid "Below that, add a record creating a group with the id ``estate_group_manager``, the name \"Manager\" and the category ``base.module_category_real_estate_brokerage``. The ``estate_group_manager`` group needs to imply ``estate_group_user``." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:109 msgid "Where does that **category** comes from ? It's a *module category*. Here we used the category id ``base.module_category_real_estate_brokerage`` which was automatically generated by Odoo based on the `category` set in the ``__manifest__.py`` of the module. You can also find here the list of `default module categories `_ provided by Odoo." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:118 msgid "Since we modified data files, remember to restart Odoo and update the module using ``-u estate``." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:121 msgid "If you go to :menuselection:`Settings --> Manage Users` and open the ``admin`` user (\"Mitchell Admin\"), you should see a new section:" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:126 msgid "Set the admin user to be a *Real Estate manager*." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:130 msgid "Via the web interface, create a new user with only the \"real estate agent\" access. The user should not have any Invoicing or Administration access." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:133 msgid "Use a private tab or window to log in with the new user (remember to set a password), as the real-estate agent you should only see the real estate application, and possibly the Discuss (chat) application:" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:142 msgid "The documentation related to this topic can be found at :ref:`reference/security/acl`." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:149 msgid "Employees who are not at least real-estate agents will not see the real-estate application." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:151 msgid "Real-estate agents will not be able to update the property types or tags." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:153 msgid "Access rights were first introduced in :ref:`howto/rdtraining/05_securityintro`." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:155 msgid "Access rights are a way to give users access to models *via* groups: associate an access right to a group, then all users with that group will have the access." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:158 msgid "For instance we don't want real-estate agents to be able to modify what property types are available, so we would not link that access to the \"user\" group." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:161 msgid "Access rights can only give access, they can't remove it: when access is checked, the system looks to see if *any* access right associated with the user (via any group) grants that access." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:166 msgid "group" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:166 msgid "create" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:166 msgid "read" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:166 msgid "update" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:166 msgid "delete" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:168 msgid "A" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:168 #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:168 #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:169 #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:170 msgid "X" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:169 msgid "B" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:170 msgid "C" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:173 msgid "A user with the groups A and C will be able to do anything but delete the object while one with B and C will be able to read and update it, but not create or delete it." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:178 msgid "The group of an access right can be omitted, this means the ACL applies to *every user*, this is a useful but risky fallback as depending on the applications installed it can grant even non-users access to the model." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:181 msgid "If no access right applies to a user, they are not granted access (default-deny)." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:183 msgid "If a menu item points to a model to which a user doesn't have access and has no submenus which the user can see, the menu will not be displayed." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:186 msgid "Update the access rights file to:" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:188 msgid "Give full access to all objects to your Real Estate Manager group." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:189 msgid "Give agents (real estate users) only read access to types and tags." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:190 msgid "Give nobody the right to delete properties." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:191 msgid "Check that your agent user is not able to alter types or tags, or to delete properties, but that they can otherwise create or update properties." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:197 msgid "Remember to give different xids to your ``ir.model.access`` records otherwise they will overwrite one another." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:200 msgid "Since the \"demo\" user was not made a real-estate agent or manager, they should not even be able to see the real-estate application. Use a private tab or window to check for this (the \"demo\" user has the password \"demo\")." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:205 #: ../../content/developer/reference/backend/security.rst:83 msgid "Record Rules" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:207 msgid "The documentation related to this topic can be found at :ref:`reference/security/rules`." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:212 msgid "At the end of this section, agents will not be able to see the properties exclusive to their colleagues; but managers will still be able to see everything." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:216 msgid "Access rights can grant access to an entire model but often we need to be more specific: while an agent can interact with properties in general we may not want them to update or even see properties managed by one of their colleagues." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:220 msgid "Record *rules* provide that precision: they can grant or reject access to individual records:" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:236 msgid "The :ref:`reference/orm/domains` is how access is managed: if the record passes then access is granted, otherwise access is rejected." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:241 msgid "Because rules tends to be rather complex and not created in bulk, they're usually created in XML rather than the CSV used for access rights." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:244 msgid "The rule above:" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:246 msgid "Only applies to the \"create\", \"update\" (write) and \"delete\" (unlink) operations: here we want every employee to be able to see other users' records but only the author / assignee can update a record." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:249 msgid "Is :ref:`non-global ` so we can provide an additional rule for e.g. managers." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:251 msgid "Allows the operation if the current user (``user.id``) is set (e.g. created, or is assigned) on the record, or if the record has no associated user at all." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:256 msgid "If no rule is defined or applies to a model and operation, then the operation is allowed (*default-allow*), this can have odd effects if access rights are not set up correctly (are too permissive)." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:262 msgid "Define a rule which limits agents to only being able to see or modify properties which have no salesperson, or for which they are the salesperson." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:265 msgid "You may want to create a second real-estate agent user, or create a few properties for which the salesperson is a manager or some other user." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:268 msgid "Verify that your real estate manager(s) can still see all properties. If not, why not? Remember:" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:271 msgid "The ``estate_group_manager`` group needs to imply ``estate_group_user``." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:274 msgid "Security Override" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:277 msgid "Bypassing Security" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:281 msgid "At the end of this section, agents should be able to confirm property sales without needing invoicing access." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:284 msgid "If you try to mark a property as \"sold\" as the real estate agent, you should get an access error:" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:289 msgid "This happens because ``estate_account`` tries to create an invoice during the process, but creating an invoice requires the right to all invoice management." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:292 msgid "We want agents to be able to confirm a sale without them having full invoicing access, which means we need to *bypass* the normal security checks of Odoo in order to create an invoice *despite* the current user not having the right to do so." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:297 msgid "There are two main ways to bypass existing security checks in Odoo, either wilfully or as a side-effect:" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:300 msgid "The ``sudo()`` method will create a new recordset in \"sudo mode\", this ignores all access rights and record rules (although hard-coded group and user checks may still apply)." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:303 msgid "Performing raw SQL queries will bypass access rights and record rules as a side-effect of bypassing the ORM itself." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:308 msgid "Update ``estate_account`` to bypass access rights and rules when creating the invoice." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:313 msgid "These features should generally be avoided, and only used with extreme care, after having checked that the current user and operation should be able to bypass normal access rights validation." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:317 msgid "Operations performed in such modes should also rely on user input as little as possible, and should validate it to the maximum extent they can." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:321 msgid "Programmatically checking security" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:325 msgid "At the end of this section, the creation of the invoice should be resilient to security issues regardless to changes to ``estate``." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:328 msgid "In Odoo, access rights and record rules are only checked *when performing data access via the ORM* e.g. creating, reading, searching, writing, or unlinking a record via ORM methods. Other methods do *not* necessarily check against any sort of access rights." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:333 msgid "In the previous section, we bypassed the record rules when creating the invoice in ``action_sold``. This bypass can be reached by any user without any access right being checked:" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:337 msgid "Add a print to ``action_sold`` in ``estate_account`` before the creation of the invoice (as creating the invoice accesses the property, therefore triggers an ACL check) e.g.::" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:343 msgid "You should see ``reached`` in your Odoo log, followed by an access error." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:345 msgid "Just because you're already in Python code does not mean any access right or rule has or will be checked." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:348 msgid "*Currently* the accesses are implicitly checked by accessing data on ``self`` as well as calling ``super()`` (which does the same and *updates* ``self``), triggering access errors and cancelling the transaction \"uncreating\" our invoice." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:353 msgid "*However* if this changes in the future, or we add side-effects to the method (e.g. reporting the sale to a government agency), or bugs are introduced in ``estate``, ... it would be possible for non-agents to trigger operations they should not have access to." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:358 msgid "Therefore when performing non-CRUD operations, or legitimately bypassing the ORM or security, or when triggering other side-effects, it is extremely important to perform *explicit security checks*." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:362 msgid "Explicit security checks can be performed by:" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:364 msgid "Checking who the current user is (``self.env.user``) and match them against specific models or records." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:366 msgid "Checking that the current user has specific groups hard-coded to allow or deny an operation (``self.env.user.has_group``)." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:368 msgid "Calling the ``check_access_rights(operation)`` method on a recordset, this verifies whether the current user has access to the model itself." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:370 msgid "Calling ``check_access_rule(operations)`` on a non-empty recordset, this verifies that the current user is allowed to perform the operation on *every* record of the set." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:374 msgid "Checking access rights and checking record rules are separate operations, if you're checking record rules you usually want to also check access rights beforehand." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:380 msgid "Before creating the invoice, use ``check_access_rights`` and ``check_access_rule`` to ensure that the current user can update properties in general as well as the specific property the invoice is for." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:384 msgid "Re-run the bypass script, check that the error occurs before the print." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:389 msgid "Multi-company security" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:393 msgid ":ref:`reference/howtos/company` for an overview of multi-company facilities in general, and :ref:`multi-company security rules ` in particular." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:397 msgid "Documentation on rules in general can, again, be found at :ref:`reference/security/rules`." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:402 msgid "At the end of this section, agents should only have access to properties of their agency (or agencies)." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:405 msgid "For one reason or another we might need to manage our real-estate business as multiple companies e.g. we might have largely autonomous agencies, a franchise setup, or multiple brands (possibly from having acquired other real-estate businesses) which remain legally or financially separate from one another." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:411 msgid "Odoo can be used to manage multiple companies inside the same system, however the actual handling is up to individual modules: Odoo itself provides the tools to manage the issue of company-dependent fields and *multi-company rules*, which is what we're going to concern ourselves with." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:416 msgid "We want different agencies to be \"siloed\" from one another, with properties belonging to a given agency and users (whether agents or managers) only able to see properties linked to their agency." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:420 msgid "As before, because this is based on non-trivial records it's easier for a user to relax rules than to tighten them so it makes sense to default to a relatively stronger security model." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:424 msgid "Multi-company rules are simply record rules based on the ``company_ids`` or ``company_id`` fields:" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:427 msgid "``company_ids`` is all the companies to which the current user has access" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:428 msgid "``company_id`` is the currently active company (the one the user is currently working in / for)." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:431 msgid "Multi-company rules will *usually* use the former i.e. check if the record is associated with *one* of the companies the user has access to:" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:447 msgid "Multi-company rules are usually :ref:`global `, otherwise there is a high risk that additional rules would allow bypassing the multi-company rules." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:453 msgid "Add a ``company_id`` field to ``estate.property``, it should be required (we don't want agency-less properties), and should default to the current user's current company." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:456 msgid "Create a new company, with a new estate agent in that company." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:457 msgid "The manager should be a member of both companies." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:458 msgid "The old agent should only be a member of the old company." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:459 msgid "Create a few properties in each company (either use the company selector as the manager or use the agents). Unset the default salesman to avoid triggering *that* rule." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:462 msgid "All agents can see all companies, which is not desirable, add the record rule restricting this behaviour." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:465 msgid "remember to ``--update`` your module when you change its model or data" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:469 msgid "Visibility != security" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:473 msgid "At the end of this section, real-estate agents should not see the Settings menu of the real-estate application, but should still be able to set the property type or tags." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:477 msgid "Specific Odoo models can be associated directly with groups (or companies, or users). It is important to figure out whether this association is a *security* or a *visibility* feature before using it:" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:481 msgid "*Visibility* features mean a user can still access the model or record otherwise, either through another part of the interface or by :doc:`performing operations remotely using RPC <../../api/external_api>`, things might just not be visible in the web interface in some contexts." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:485 msgid "*Security* features mean a user can not access records, fields or operations." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:487 msgid "Here are some examples:" msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:489 msgid "Groups on *model fields* (in Python) are a security feature, users outside the group will not be able to retrieve the field, or even know it exists." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:492 msgid "Example: in server actions, `only system users can see or update Python code `_." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:494 msgid "Groups on *view elements* (in XML) are a visibility feature, users outside the group will not be able to see the element or its content in the form but they will otherwise be able to interact with the object (including that field)." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:498 msgid "Example: `only managers have an immediate filter to see their teams' leaves `_." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:500 msgid "Groups on menus and actions are visibility features, the menu or action will not be shown in the interface but that doesn't prevent directly interacting with the underlying object." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:504 msgid "Example: `only system administrators can see the elearning settings menu `_." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:509 msgid "Real Estate agents can not add property types or tags, but can see their options from the Property form view when creating it." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:512 msgid "The Settings menu just adds noise to their interface, make it only visible to managers." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:515 msgid "Despite not having access to the Property Types and Property Tags menus anymore, agents can still access the underlying objects since they can still select tags or a type to set on their properties." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:519 msgid "An Odoo Application is a group of related modules covering a business area or field, usually composed of a base module and a number of expansions on that base to add optional or specific features, or link to other business areas." msgstr "" #: ../../content/developer/howtos/rdtraining/B_acl_irrules.rst:524 msgid "For applications which would be used by most or every employees, the \"application user\" role might be done away with and its abilities granted to all employees directly e.g. generally all employees can submit expenses or take time off." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:5 msgid "Advanced C: Master and Demo Data" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:7 #: ../../content/developer/howtos/rdtraining/E_unittest.rst:7 msgid "This tutorial assumes you followed the Core Training." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:9 #: ../../content/developer/howtos/rdtraining/E_unittest.rst:9 msgid "To do the exercise, fetch the branch 15.0-core from the `technical training solutions `__ repository. It contains a basic module we will use as a starting point" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:14 msgid "Data Types" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:17 msgid "Master Data" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:19 msgid "Master data is usually part of the technical or business requirements for the module. In other words, such data is often necessary for the module to work properly. This data will always be installed when installing the module." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:23 msgid "We already met technical data previously since we have defined :ref:`security rules`, :ref:`views` and :ref:`actions`. Those are one kind of master data." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:27 msgid "On top of technical data, business data can be defined, e.g. countries, currencies, units of measure, as well as complete country localization (legal reports, tax definitions, chart of account), and much more..." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:32 msgid "Demo Data" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:34 msgid "In additional to master data, which are requirements for a module to work properly, we also like having data for demonstration purposes:" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:37 msgid "Help the sales representatives make their demos quickly." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:38 msgid "Have a set of working data for developers to test new features and see how these new features look with data they might not have added themselves." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:40 msgid "Test that the data is loaded correctly, without raising an error." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:41 msgid "Setup most of the features to be used quickly when creating a new database." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:43 msgid "Demo data is automatically loaded when you start the server if you don't explicitly say you don't want it. This can be done in the database manager or with the command line." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:66 msgid "Data Declaration" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:69 #: ../../content/developer/reference/backend/module.rst:11 msgid "Manifest" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:71 msgid "**Reference**: the documentation related to this topic can be found in :ref:`Module Manifests`." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:74 msgid "Data is declared either in CSV or in XML. Each file containing data must be added in the manifest for them to be loaded." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:77 msgid "The keys to use in the manifest to add new data are ``data`` for the master data and ``demo`` for the demo data. Both values should be a list of strings representing the relative paths to the files declaring the data." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:81 msgid "Usually, demo data is in a ``demo`` folder, views and actions are in a ``views`` folder, security related data is in a ``security`` folder, and other data is in a ``data`` folder." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:85 msgid "If your work tree looks like this:" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:104 msgid "Your manifest should look like this:" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:127 msgid "CSV" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:129 msgid "**Reference**: the documentation related to this topic can be found in :ref:`CSV data files`." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:132 msgid "The easiest way to declare simple data is by using the CSV format. This is however limited in terms of features: use it for long lists of simple models, but prefer XML otherwise." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:141 msgid "Your IDE has probably an extension to have a syntax highlighting of the CSV files" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:143 msgid "`Atom `__." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:144 msgid "`PyCharm/IntelliJ `__." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:145 msgid "`Vim `__." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:146 msgid "`Visual Studio `__." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:148 msgid "Add some standard Real Estate Property Types for the `estate` module: Residential, Commercial, Industrial and Land. These should always be installed." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:152 msgid "XML" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:154 msgid "**Reference**: the documentation related to this topic can be found in :ref:`Data Files`." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:157 msgid "When the data to create is more complex it can be useful, or even necessary, to do it in XML." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:173 msgid "Create some demo data for the `estate` module." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:178 #: ../../content/developer/howtos/rdtraining/C_data.rst:242 #: ../../content/developer/howtos/rdtraining/C_data.rst:243 #: ../../content/developer/howtos/rdtraining/C_data.rst:244 msgid "Big Villa" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:178 msgid "Trailer home" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:179 msgid "state" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:179 msgid "New" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:179 msgid "Canceled" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:180 msgid "A nice and big villa" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:180 msgid "Home in a trailer park" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:181 msgid "12345" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:181 msgid "54321" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:182 msgid "2020-02-02" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:182 msgid "1970-01-01" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:183 msgid "1,600,000" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:183 msgid "100,000" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:184 msgid "120,000" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:186 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxRepartitionLineTemplate.factor_percent:1 msgid "100" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:186 msgid "10" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:187 #: ../../content/developer/howtos/rdtraining/C_data.rst:187 msgid "4" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:188 #: ../../content/developer/howtos/rdtraining/C_data.rst:189 #: ../../content/developer/reference/backend/mixins.rst:154 #: ../../content/developer/reference/backend/mixins.rst:182 #: ../../content/developer/reference/backend/mixins.rst:192 #: ../../../odoo/addons/account/models/account_account_tag.py:docstring of odoo.addons.account.models.account_account_tag.AccountAccountTag.active:1 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.visible:1 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.active:1 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.is_base_affected:1 msgid "True" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:188 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountAccountTemplate.reconcile:1 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountAccountTemplate.nocreate:1 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountChartTemplate.use_anglo_saxon:1 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.price_include:1 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountTaxTemplate.include_base_amount:1 msgid "False" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:190 msgid "100000" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:191 msgid "South" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:195 msgid "Data Extension" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:197 msgid "During the Core Training, we saw in the :ref:`howto/rdtraining/13_inheritance` chapter we could inherit (extend) an existing view. This was a special case of data extension: any data can be extended in a module." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:201 msgid "When you are adding new fields to an existing model in a new module, you might want to populate those fields on the records created in the modules you are depending on. This is done by giving the `xml_id` of the record you want to extend. It won't replace it, in this case we will set the ``field_c`` to the given value for both records." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:220 #: ../../content/developer/reference/backend/data.rst:104 msgid "``ref``" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:222 msgid "Related fields can be set using the ``ref`` key. The value of that key is the ``xml_id`` of the record you want to link. Remember the ``xml_id`` is composed of the name of the module where the data is first declared, followed by a dot, followed by the ``id`` of the record (just the ``id`` works too if you are in the module declaring it)." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:235 msgid "Create some demo data offers for the properties you created." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:237 msgid "Create offers using the partners defined in ``base``" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:240 msgid "Partner" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:240 msgid "Estate" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:240 msgid "Price" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:240 msgid "Validity" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:242 #: ../../content/developer/howtos/rdtraining/C_data.rst:243 msgid "Azure Interior" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:242 msgid "10000" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:242 #: ../../content/developer/howtos/rdtraining/C_data.rst:243 #: ../../content/developer/howtos/rdtraining/C_data.rst:244 msgid "14" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:243 msgid "1500000" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:244 msgid "Deco Addict" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:244 msgid "1500001" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:247 msgid "Ensure both of your demo properties are created with their Property Type set to Residential." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:250 #: ../../content/developer/reference/backend/data.rst:145 msgid "``eval``" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:252 msgid "The value to assign to a field is not always a simple string and you might need to compute it. It can also be used to optimize the insertion of related values, or because a constraint forces you to add the related values in batch. See ::ref:`Add X2many fields `." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:264 msgid "The offers you added should always be in a date relative to the installation of the module." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:268 #: ../../content/developer/reference/backend/data.rst:98 #: ../../content/developer/reference/backend/data.rst:159 msgid "``search``" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:270 msgid "Sometimes, you need to call the ORM to do a ``search``. This is not feasible with the CSV format." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:283 msgid "In this code snippet, it is needed because the master data depends on the localization installed." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:287 #: ../../content/developer/reference/backend/data.rst:164 msgid "``function``" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:289 msgid "You might also need to execute python code when loading data." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:297 msgid "Validate one of the demo data offers by using the \"Accept Offer\" button. Refuse the others." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:304 msgid "Add X2many fields" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:306 msgid "**Reference**: the documentation related to this topic can be found in :class:`~odoo.fields.Command`." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:309 msgid "If you need to add related data in a One2many or a Many2many field, you can do so by using the :class:`~odoo.fields.Command` methods." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:328 msgid "Create one new Property, but this time with some offers created directly inside the One2many field linked to the Offers." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:332 #: ../../content/developer/howtos/website.rst:234 msgid "Accessing the data" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:334 msgid "You should never access demo data outside of the demo data declaration, not even in tests." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:337 msgid "There are multiple ways to access the master/demo data." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:339 msgid "In python code, you can use the ``env.ref(self, xml_id, raise_if_not_found=True)`` method. It returns the recordset linked to the ``xml_id`` you specify." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:342 msgid "In XML, you can use the `ref` key like this" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:352 msgid "It will call the ref method, and store the id of the record returned on the field ``related_id`` of the record of type ``tutorial.example`` with id ``id1``." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:355 msgid "In CSV, the title of the column must be suffixed with ``:id`` or ``/id``." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:364 msgid "In SQL, it is more complicated, see :ref:`the advanced section`." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:366 msgid "Data can always be deleted by the user. Always code defensively, taking this into account." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:373 msgid "Advanced" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:378 msgid "What is the XML id?" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:380 msgid "Because we don't want a column ``xml_id`` in every single SQL table of the database, we need a mechanism to store it. This is done with the ``ir.model.data`` model." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:383 msgid "It contains the name of the record (the ``xml_id``) along with the module in which it is defined, the model defining it, and the id of it." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:387 msgid "No update" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:389 msgid "The records created with the ``noupdate`` flag won't be updated when upgrading the module that created them, but it will be created if it didn't exist yet." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:392 msgid "``odoo-bin -i module`` will bypass this setting and always load the data. But normally one shouldn't do this on a production database." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:405 msgid "Import as SQL" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:407 msgid "In some cases, it makes sense to do the import directly in SQL. This is however discouraged as it bypasses all the features of the ORM, computed fields (including metadata) and python constraints." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:410 msgid "Generally using raw SQL also bypasses ACLs and increases the risks of injections." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:412 msgid "**Reference**: :ref:`Security in Odoo`" msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:414 msgid "It can help to speed the import time by a lot `with huge files `__." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:416 msgid "For more complex imports like for the `translations `__." msgstr "" #: ../../content/developer/howtos/rdtraining/C_data.rst:418 msgid "It can be necessary to `initialize the database `__." msgstr "" #: ../../content/developer/howtos/rdtraining/D_mixins.rst:5 msgid "Advanced D: Mixins" msgstr "" #: ../../content/developer/howtos/rdtraining/D_mixins.rst:7 msgid "If you need to interface with common Odoo features such as the chatter, you can rely on :doc:`mixins <../../reference/backend/mixins>`. They are Odoo models exposing useful methods through inheritance." msgstr "" #: ../../content/developer/howtos/rdtraining/D_mixins.rst:11 msgid "To learn and play with mixins, visit `this repository `_. This module for a plant nursery is training material developed for the OXP 2018. You don't need to code it on your side. But you can check the presentations in the :file:`/static/pdf` directory and play with the module to discover some magic features in Odoo." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:5 msgid "Advanced E: Python Unit Tests" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:13 msgid "**Reference**: `Odoo's Test Framework: Learn Best Practices `__ (Odoo Experience 2020) on Youtube." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:17 msgid "Writing tests is a necessity for multiple reasons. Here is a non exhaustive list:" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:19 msgid "Ensure code will not be broken in the future" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:20 msgid "Define the scope of your code" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:21 msgid "Give examples of use cases" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:22 msgid "It is one way to technically document the code" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:23 msgid "Help your coding by defining your goal before working towards it" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:26 msgid "Running Tests" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:28 msgid "Before knowing how to write tests, we need to know how to run them." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:80 msgid "Integration Bots" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:82 msgid "This section is only for Odoo employees and people that are contributing to `github.com/odoo`. We highly recommend having your own CI otherwise." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:85 msgid "When a test is written, it is important to make sure it always passes when modifications are applied to the source code. To automate this task, we use a development practice called Continuous Integration (CI). This is why we have some bots running all the tests at different moments. Whether you are working at Odoo or not, if you are trying to merge something inside `odoo/odoo`, `odoo/enterprise`, `odoo/upgrade` or on odoo.sh, you will have to go through the CI. If you are working on another project, you should think of adding your own CI." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:94 msgid "Runbot" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:96 msgid "**Reference**: the documentation related to this topic can be found in `Runbot FAQ `__." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:99 msgid "Most of the tests are run on `Runbot `__ every time a commit is pushed on GitHub." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:102 msgid "You can see the state of a commit/branch by filtering on the runbot dashboard." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:104 msgid "A **bundle** is created for each branch. A bundle consists of a configuration and batches." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:107 msgid "A **batch** is a set of builds, depending on the parameters of the bundle. A batch is green (i.e. passes the tests) if all the builds are green." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:110 msgid "A **build** is when we launch a server. It can be divided in sub-builds. Usually there are builds for the community version, the enterprise version (only if there is an enterprise branch but you can force the build), and the migration of the branch. A build is green if every sub-build is green." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:115 msgid "A **sub-build** only does some parts of what a full build does. It is used to speed up the CI process. Generally it is used to split the post install tests in 4 parallel instances. A sub-build is green if all the tests are passing and there are no errors/warnings logged." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:120 msgid "All tests are run regardless of the modifications done. Correcting a typo in an error message or refactoring a whole module triggers the same tests. All modules will be installed as well. This means something might not work even if the Runbot is green, i.e. your changes depend on a module that the module the changes are in doesn't depend on." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:124 msgid "The localization modules (i.e. country-specific modules) are not installed on Runbot (except the generic one). Some modules with external dependencies can also be excluded." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:126 msgid "There is a nightly build running additional tests: module operations, localization, single module installs, multi-builds for nondeterministic bugs, etc. These are not kept in the standard CI to shorten the time of execution." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:130 msgid "You can also login to a build built by Runbot. There are 3 users usable: `admin`, `demo` and `portal`. The password is the same as the login. This is useful to quickly test things on different versions without having to build it locally. The full logs are also available; these are used for monitoring." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:136 msgid "Robodoo" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:138 msgid "You will most likely have to gain a little bit more experience before having the rights to summon robodoo, but here are a few remarks anyways." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:141 msgid "Robodoo is the guy spamming the CI status as tags on your PRs, but he is also the guy that kindly integrates your commits into the main repositories." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:144 msgid "When the last batch is green, the reviewer can ask robodoo to merge your PR (it is more a `rebase` than a `merge`). It will then go to the mergebot." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:148 msgid "Mergebot" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:150 msgid "`Mergebot `__ is the last testing phase before merging a PR." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:152 msgid "It will take the commits in your branch not yet present on the target, stage it and rerun the tests one more time, including the enterprise version even if you are only changing something in community." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:156 msgid "This step can fail with a `Staging failed` error message. This could be due to" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:158 msgid "a nondeterministic bug that is already on the target. If you are an Odoo employee, you can check those here: https://runbot.odoo.com/runbot/errors" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:160 msgid "a nondeterministic bug that you introduced but wasn't detected in the CI before" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:161 msgid "an incompatibility with another commit merged right before and what you are trying to merge" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:162 msgid "an incompatibility with the enterprise repository if you only did changes in the community repo" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:164 msgid "Always check that the issue does not come from you before asking the merge bot to retry: rebase your branch on the target and rerun the tests locally." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:168 msgid "Modules" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:170 msgid "Because Odoo is modular, the tests need to be also modular. This means tests are defined in the module that adds the functionality you are adding in and tests cannot depend on functionality coming from modules your module doesn't depend on." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:174 msgid "**Reference**: the documentation related to this topic can be found in :ref:`Special Tags`." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:195 msgid "If the behavior you want to test can be changed by the installation of another module, you need to ensure that the tag `at_install` is set; otherwise you can use the tag `post_install` to speed up the CI and ensure it is not changed if it shouldn't." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:200 msgid "Writing a test" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:202 msgid "**Reference**: the documentation related to this topic can be found in `Python unittest `__. and :ref:`Testing Odoo`." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:206 msgid "Here are a few things to take into consideration before writing a test" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:208 msgid "The tests should be independent from the data currently in the database (including demo data)" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:209 msgid "Tests should not impact the database by leaving/changing residual data. This is usually done by the test framework by doing a rollback. This is why you must never call ``cr.commit`` in a test (nor anywhere else in the business code)." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:212 msgid "For a bug fix, the test should fail before applying the fix and pass after." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:213 msgid "Don't test something that is already tested elsewhere; you can trust the ORM. Most of the tests in business modules should only test the business flows." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:215 msgid "You shouldn't need to flush data into the database." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:217 msgid "Remember that ``onchange`` only applies in the Form views, not by changing the attributes in python. This also applies in the tests. If you want to emulate a Form view, you can use ``odoo.tests.common.Form``." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:221 msgid "The tests should be located in a ``tests`` folder in the root of your module. Each test file name should start with `test_` and be imported in the ``__init__.py`` of the test folder. You shouldn't import the test folder/module in the ``__init__.py`` of the module." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:237 msgid "All the tests should extend ``odoo.tests.common.TransactionCase``. You usually define a ``setUpClass`` and the tests. After writing the `setUpClass`, you have an `env` available in the class and can start interacting with the ORM." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:241 msgid "These test classes are built on top of the ``unittest`` python module." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:284 msgid "For better readability, split your tests into multiple files depending on the scope of the tests. You can also have a Common class that most of the tests should inherit from; this common class can define the whole set up for the module. For instance in `account `__." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:289 msgid "Update the code so no one can:" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:291 msgid "Create an offer for a sold property" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:292 msgid "Sell a property with no accepted offers on it" msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:294 msgid "and create tests for both of these cases. Additionally check that selling a property that can be sold is correctly marked as sold after selling it." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:298 msgid "Someone keeps breaking the reset of Garden Area and Orientation when you uncheck the Garden checkbox. Make sure it doesn't happen again." msgstr "" #: ../../content/developer/howtos/rdtraining/E_unittest.rst:301 msgid "Tip: remember the note about `Form` a little bit above." msgstr "" #: ../../content/developer/howtos/rdtraining/F_jstour.rst:7 msgid "Advanced F: JS Tours" msgstr "" #: ../../content/developer/howtos/rdtraining/G_website.rst:7 msgid "Advanced G: Controllers & Website" msgstr "" #: ../../content/developer/howtos/rdtraining/H_adv_views.rst:7 msgid "Advanced H: Advanced Views" msgstr "" #: ../../content/developer/howtos/rdtraining/I_jswidget.rst:7 msgid "Advanced I: Custom JS Widget" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:5 msgid "Advanced J: PDF Reports" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:9 msgid "This tutorial assumes you have completed the :ref:`Core Training ` and have installed :ref:`wkhtmltopdf `." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:18 msgid "We were previously :ref:`introduced to QWeb ` in the Core Training where it was used to build a kanban view. Now we will expand on one of QWeb's other main uses: creating PDF reports. A common business requirement is the ability to create documents to send to customers and to use internally. These reports can be used to summarize and display information in an organized template to support the business in different ways. Odoo can additionally add our company's header and footer to our reports with minimal extra effort." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:25 msgid "The documentation related to this topic can be found in :ref:`reference/qweb`, :ref:`reference/reports/report` and the :ref:`reference/actions/report` section of the Actions reference." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:30 #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:35 msgid "File Structure" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:32 msgid "The bulk of a PDF report is its QWeb template. It also typically needs a corresponding ``ir.actions.report`` to include the report within a module's business logic. There is no strict rule for the file names or where they are located, but these two parts are typically stored in 2 separate files within a ``report`` folder in the top level of your module's directory. If a module has many or multiple long report templates, then they are often organized in a logical manner across different files named after the report(s) they contain. All actions for the reports are usually stored in the same file ending with ``_reports.xml`` regardless of the number of reports it contains." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:41 msgid "Therefore it is expected that your work tree will look something like:" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:59 msgid "Note that you will often see other non-QWeb and non-XML files containing \"report\" in their name also within the report folder. These are unrelated to the reports covered in this tutorial and are covered in :ref:`another advanced topic `. For now you can think of them as customized views that use direct SQL queries (sometimes referred to as SQL Views)." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:64 msgid "Don't forget to add whatever files your template and action view will be located in to your ``__manifest__.py``. In this case you will want to add the files to the ``data`` list and remember that the files listed in a manifest are loaded sequentially!" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:69 msgid "Basic Report" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:73 msgid "**Goal**: at the end of this section, we will can print a report that displays all offers for a property." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:0 msgid "Simple PDF report" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:80 msgid "In our real estate example there are many useful reports that we could create. One simple report we can create is one that displays all of a property's offers." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:84 msgid "Report Data" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:86 msgid "Before we do anything we first need some data to populate our reports or else this tutorial won't be very interesting. When creating reports, you will need some data to test your report code and check that the resulting look is as expected. It is a good idea to test with data that will cover most or all of your expected use cases. A good representation set for our simple report is:" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:91 msgid "At least 3 properties where 1 is \"sold\", 1 is \"offer received\" and 1 is \"new\"." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:92 msgid "At least 2-3 offers for our \"sold\" and \"offer received\" properties" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:94 #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:117 msgid "If you don't have a set of data like this already, you can either:" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:96 #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:119 msgid "Complete :ref:`howto/rdtraining/C_data` (if you haven't done so already) and add the extra cases to your demo data (you may need to create a new database to load in the demo data)." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:98 #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:121 msgid "Manually create the data in your database." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:99 msgid "Copy this `data file `__ into a new directory (data) in your estate module and copy `these lines `__ into your __manifest__.py file (you may need to create a new database to load in the demo data)." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:104 msgid "Before continuing, click through your data in your database and make sure your data is as expected. Of course you can add the data after you write your report code, but then you will not be able to incrementally test portions of your code as you write it. This can make checking for mistakes and debugging your code more difficult in the long run for complicated reports." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:110 msgid "Minimal Template" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:112 msgid "A minimal viable template is viewable under the \"Minimal viable template\" section of the :ref:`reference/reports/templates` documentation. We can modify this example to build our minimal property offers template file:" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:154 msgid "Most of the Odoo specific (i.e. non-HTML) items in our file are explained in the minimal viable template section. Some additional features in our template are:" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:157 msgid "The use of the ``class=\"table\"`` attribute so our table has some nice formatting. Twitter Bootstrap (we're using its table class in this case) and FontAwesome (useful for adding icons) classes can be used in your report template." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:160 msgid "The use of ``t-set``, ``t-value``, ``t-foreach`` and ``t-as`` so that we can loop over all of the ``offer_ids``." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:162 msgid "If you are already familiar with website templating engines, then the QWeb directives (i.e. the `t-` commands) probably don't need much explanation and you can just look at its :ref:`documentation ` and skip ahead to the next subsection." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:166 msgid "Otherwise you are encouraged to read more about them ( `Wikipedia `__ has a good high level description), but the general idea is that QWeb provides the ability to dynamically generate web code based on Odoo data and simple commands. I.e. QWeb can access recordset data (and methods) and process simple programming operations such as setting and accessing temporary variables. For example, in the above example:" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:172 msgid "``t-set`` creates a temporary variable called \"offers\" that has its value set by ``t-value`` to the current ``estate.property`` recordset's ``offer_ids``." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:174 msgid "the ``t-foreach`` and ``t-as`` usage is the equivalent to the Python:" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:181 msgid "Report Action" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:183 msgid "Now that we have a template, we need to make it accessible in our app via a ``ir.actions.report``. A practical example of ``ir.actions.report`` is `here `__ corresponding to `this template `__. Its contents are all explained in :ref:`the documentation `." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:190 msgid "An ``ir.actions.report`` is primarily used via the Print menu of a model's view. In the practical example, the ``binding_model_id`` specifies which model's views the report should show in and Odoo will auto-magically add it for you. Another common use case of the report action is to link it to a button like we learned in :ref:`howto/rdtraining/10_actions`. This is handy for reports that only make sense under specific conditions. For example, if we wanted to make a \"Final Sale\" report, then we can link it to a \"Print Sale Info\" button that appears in the form view only when the property is \"Sold\"." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:None msgid "Print Menu Button" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:202 msgid "You may have noticed or are wondered why our report template loops through a recordset. When our template is passed more than one record, it can produce one PDF report for all of the records. Using the Print menu in the list view with multiple records selected will demonstrate this." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:207 msgid "Make a Report" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:209 msgid "Finally, you now know where to create your files and how the content of the files should look. Happy report making!" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:211 msgid "Make a report." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:213 msgid "Add the property offers report from the minimal template subsection to the Print menu of the Property views." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:215 msgid "Improve the report by adding more data. Refer to the **Goal** of this section to see what additional data you can add and feel free to add even more." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:218 msgid "Bonus: Make an extra flexible report by adding in some logic so that when there are no offers on a property then we don't create a table and instead write something about how there are no offers yet. Hint: you will need to use ``t-if`` and ``t-else``." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:222 msgid "Remember to check that your PDF reports match your data as expected." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:226 msgid "Sub-templates" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:230 msgid "**Goal**: at the end of this section, we will have a sub-template that we use in 2 reports." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:0 msgid "Report using a subtemplate" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:236 msgid "There are two main reasons for using sub-templates. One is to make the code easier to read when working with extra long or complicated templates. The other is to reuse code where possible. Our simple property offers report is useful, but listing property offers information can be useful for more than just one report template. One example is a report that lists all of a salesman's properties' offers." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:241 msgid "See if you can understand how to call a sub-template by reading the :ref:`documentation ` on it and/or by looking at an `example `__ (remember QWeb uses the same control flows regardless if it is for a report or a view in Odoo.)" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:246 msgid "Create and use a sub-template." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:248 msgid "Split the table portion of the offers into its own template. Remember to check that your original report still prints correctly afterwards." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:251 msgid "Add a new report for ``res.users`` that allows you to print all of the Real Estate Properties that are visible in their form view (i.e. in the \"Settings\" app). Include the offers for each of those saleman's properties in the same report. Hint: since the ``binding_model_id`` in this case will not be within the estate module, you will need to use ``ref=\"base.model_res_users\"``." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:256 msgid "Your end result should look similar to the image in the **Goal** of this section." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:258 msgid "Remember to check that your reports match your data as expected!" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:261 msgid "Report Inheritance" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:265 msgid "**Goal**: at the end of this section, we will inherit the property report in the ``estate_account`` module." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:0 msgid "An inherited report" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:272 msgid "Inheritance in QWeb uses the same ``xpath`` elements as :ref:`views inheritance `. A QWeb template refers to its parent template in a different way though. It is even easier to do by just adding the ``inherit_id`` attribute to the ``template`` element and setting it equal to the *module.parent_template_id*." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:276 msgid "We didn't add any new fields to any of the estate models in `estate_account`, but we can still add information to our existing property report. For example, we know that any \"Sold\" properties will already have an invoice created for them, so we can add this information to our report." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:280 msgid "Inherit a report." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:282 msgid "Extend the property report to include some information about the invoice. You can look at the **Goal** of this section for inspiration (i.e. print a line when the property is Done, otherwise print nothing)." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:285 msgid "Again, remember to check that your reports match your data as expected!" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:288 msgid "Additional Features" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:290 msgid "All of the following extra features are described further in the :ref:`reference/reports/report` documentation, including how to implement each of them." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:294 #: ../../content/developer/howtos/web.rst:1227 msgid "Translations" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:296 msgid "We all know Odoo is used in multiple languages thanks to automated and manual translating. QWeb reports are no exception! Note that sometimes the translations do not work properly if there are unnecessary spaces in your template's text content so try to avoid them when possible (especially leading spaces)." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:301 #: ../../content/developer/reference/backend/reports.rst:309 msgid "Reports are web pages" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:303 msgid "You probably are tired of hearing that QWeb creates HTML, but we're saying it again! One of the neat features about reports being written in QWeb is they can be viewed within the web browser. This can be useful if you want to embed a hyperlink that leads to a specific report. Note that the usual security checks will still apply to prevent unauthorized users from accessing the reports." msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:309 #: ../../content/developer/reference/backend/reports.rst:148 msgid "Barcodes" msgstr "" #: ../../content/developer/howtos/rdtraining/J_reports.rst:311 msgid "Odoo has a built-in barcode image creator that allows for barcodes to be embedded in your reports. Check out the corresponding `code `__ to see all the supported barcode types." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:5 msgid "Advanced K: Dashboards" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:9 msgid "This tutorial assumes you have completed the :ref:`Core Training ` and have access to Odoo Enterprise features." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:18 msgid "The term \"Dashboard\" is used in Odoo for objects that display data, but involves different implementations. This tutorial will only focus on the Enterprise view that is used to provide aggregated data visualization. They can be added as a ``view_mode`` to an existing model (i.e. a view you can switch to via the view buttons in the top right of a view), but they are also often used as a view for to a special model customized for data visualization. You may hear these special views referred to as SQL views." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:25 msgid "It is useful to note there is a \"Dashboard\" app in Odoo Community. This app allows users to create their own customized view of data, but the customization is only visible to each user and can only be viewed within the \"Dashboard\" app. Technically it is possible to make global dashboards using this ``board`` module, but it is much easier to do as an Enterprise view. Plus it looks nicer and has extra features not available in ``board``. Some other dashboards within Odoo also exist, but they are custom made and are beyond the scope of this tutorial." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:32 msgid "The documentation related to this topic can be found in :ref:`reference/views/dashboard`." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:37 msgid "You probably have already guessed that since dashboard views are an Enterprise view, they must have a dependency on an Enterprise module. The Enterprise module is ``web_dashboard``. Don't forget to add it to your manifest file! It is standard to add dashboards intended to be used as a ``view_mode`` for one of your module's models (in the ``model`` folder``) to the views directory (i.e. the same file that contains the other views for the same model)." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:43 msgid "It is standard to create a separate Enterprise module to add extra Enterprise views and features to a Community module. This is done in a similar manner as the module link technique covered within :ref:`howto/rdtraining/14_other_module`. The difference is that instead of linking 2 different modules, we are extending our `estate` module. We do this by creating a new module and adding both the Community module and its necessary Enterprise module dependencies to its manifest. You will commonly see \"enterprise\" in the module's directory name. To keep this tutorial simple, we will add dashboards to our existing ``estate`` module." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:51 msgid "SQL Views have 2 parts: their xml file (don't forget to add it to your manifest file) and their Python file (don't forget to add it to the appropriate ``__init.py__`` files). The former is the same format as the ``view_mode`` xml while the latter contains a custom model and SQL code to populate its fields. It is standard to add SQL view files to the ``report/`` directory. It is also common to include \"report\" in the name of the SQL view's files. You may be wondering why do we put the files in a report directory? We saw earlier that the dashboard is for data visualization, therefore it is not editable. You can think of dashboards as interactive reports where you can click on statistics, graphs, and charts to see the specific data contributing to them. Note it is also standard to store the xml code for :ref:`PDF report templates ` in the report directory." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:62 msgid "It is expected that your work tree will look something like:" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:83 msgid "Dashboard View" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:87 msgid "**Goal**: at the end of this section, we will have a new dashboard view that displays different property statistics." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:0 msgid "Basic Dashboard view" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:94 msgid "Dashboards can display data in different ways, including:" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:96 msgid "showing an ``aggregate`` of a field" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:97 msgid "using aggregated fields in a ``formula``" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:98 msgid "using a ``widget``" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:99 msgid "using another ``view`` as a subview" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:101 msgid "There are many useful statistics and visuals we can provide for our real estate example using these options. A full example to reference while doing the exercises in this section is `viewable here `__ (restricted github repository link)." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:107 msgid "Data" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:108 msgid "To fully enjoy our dashboard view, we will need good test data to populate it. Test data will allow us to check that the resulting look and statistics are correct. It is a good idea to test with data that will cover most or all of your expected use cases, but is also easy to verify with that your statistics are correct. In our goal's case we are looking at count, sum, average, minimum, and maximum statistics, therefore a good representation set for our dashboard is:" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:114 msgid "At least 3 properties with different property types, expected prices, and average living area." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:115 msgid "At least 1 sold property and at least 1 canceled property" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:122 msgid "Copy this `data file `__ into a new directory called ``data`` in your estate module and copy `these lines `__ into your __manifest__.py file (you may need to create a new database to load in the demo data)." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:127 msgid "Click through your database data and make sure it is what you expect. Of course you can add the data after you write your dashboard code and then test that your view is working as expected." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:131 msgid "Aggregations" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:132 msgid "Building a dashboard view is very similar to what you have previously done in :ref:`howto/rdtraining/07_basicviews`. For the dashboard view, we use the `dashboard` root element and choose from its possible tags (see all the possibilities and their attributes in the :ref:`reference/views/dashboard` documentation). So a simple dashboard example is:" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:146 msgid "In this example, ```` adds styling and ```` declares an aggregation. We indicate which ``field`` we want to aggregate, what ``string`` to display with the value, and how to aggregate it with the `group_operator` attribute. The `group_operator` can use any valid PostgreSQL aggregate function plus the special Odoo defined ``count_distinct``." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:151 msgid "Hopefully you remember how to add views to a window action `view_mode` (hint, it was covered in :ref:`howto/rdtraining/06_firstui`). Now let's make some dashboards!" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:154 msgid "Make a dashboard view." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:156 msgid "Create a dashboard of aggregated values for the ``estate.property`` model. You can look at the **Goal** of this section for some inspiration. Remember to check that your statistics are calculating as you expect and note that the calculated values take into consideration any applied view filters!" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:161 msgid "Bonus: Add in some aggregations that need a `domain` to make sense (remember domains were also covered in :ref:`howto/rdtraining/07_basicviews`)." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:165 msgid "Pie Charts" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:166 msgid "Adding pie charts to dashboards is a piece of cake using the `` element. An example is:" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:176 msgid "In this example, we indicate that we're using the `pie_chart` widget with the `name` attribute, the ``title`` for the pie chart, and that we're grouping it by property type." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:179 msgid "Add some pie charts." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:181 msgid "Add the pie charts from the **Goal** of this section to your dashboard. Hint: you will need to add `'measure': selling_price` to your pie chart `attrs` if you want to show selling prices grouped by property type." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:185 msgid "Hover over and click on the pie charts to check your charts counts values and don't forget that filters will also apply to the charts." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:188 msgid "Bonus: Add a domain to your selling price pie chart to only include \"sold\" properties (i.e. not \"offer_accepted\" ones). Note that the `'` will need to be escaped since it is declared as part of the `attrs`." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:193 msgid "Subviews" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:194 msgid "Similar to how we can use the list view within the form view (we saw this automatically happen for One2many relationships in :ref:`howto/rdtraining/08_relations`), we can add other views within our dashboard view. The most commonly added are the pivot and graph views, but the cohort view is also an option. These views are covered in more depth in :ref:`howto/rdtraining/H_adv_views`. For this topic you are only required to know their names. A dashboard with only subviews is:" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:207 msgid "The `ref` attribute can be added to `` elements to use a specific xml id for that view. If no xml id is provided for a graph or pivot view then the default view will be used. The cohort view will not work in the dashboard without a specific xml id. If you have already created some of these views then you are welcome to add them to your dashboard! Sample graph and pivot views are included in the `solution code `__ that you are welcome to use as well." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:215 msgid "Add subviews." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:217 msgid "Add in a graph and a pivot view to your dashboard. Try playing around with the layout of your subviews in relation to your pie charts and aggregated values and refer to the **Goal** of this section for an often used layout. Remember to check that your subviews are displaying your data as expected (and yes, they are also affected by the filters!)." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:223 msgid "SQL Views" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:227 msgid "This section expects you to have a basic knowledge of SQL. If you have little to no SQL knowledge then `this is a good tutorial to start with `__ and these `exercises `__ are good for those who need a refresher or extra practice." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:234 msgid "**Goal**: at the end of this section, we will have a new SQL view that displays different property statistics." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:0 msgid "SQL view" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:242 msgid "Occasionally we want to show data that goes beyond what our model already has in it. We could add a lot of stored computed or related fields (non-stored fields cannot be aggregated or displayed in pie charts), but it would be impractical to store a bunch of fields only for this purpose. We can instead add a custom SQL view to minimize the computational load and keep our model clean of unnecessary fields." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:250 msgid "We will start with the more difficult part: our special report model. This file starts the same as any other model except that we add 2 attributes ``_auto`` and ``_rec_name``::" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:262 msgid "``_auto = False`` indicates that we do not want to store the model in the database and we will create a custom table by overriding the ``BaseModel.init()`` method. ``_rec_name`` indicates which of the model's fields represents a record's name (i.e. the name that will be used in the navigation breadcrumb when opening a record's form view). In this case I left it as 'id' because our property offers don't have a name. We will need the `tools` import later (i.e. ``odoo/odoo/tools``, which is full of all sort of useful helper methods you will probably use in the future). Note that it is standard to include ``report`` in the model name." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:270 msgid "Remember your new model will need to be added to your security file like you learned in :ref:`howto/rdtraining/05_securityintro`!" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:273 msgid "Then we define the fields we need for our dashboard the same way as any other model (like you learned in :ref:`howto/rdtraining/04_basicmodel`), except that every field is ``readonly=True``. After all, our model is for readonly purposes only." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:277 msgid "Now we override the ``BaseModel.init()`` method mentioned earlier::" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:288 msgid "We use ``tools.drop_view_if_exists`` to ensure that we don't create a conflicting view and then execute the SQL query. It is standard to separate the different parts of the query to allow for easier model extension. Exactly how the query is split up across methods is not standardized, but you will often see at minimum ``_select`` and ``_from`` methods [or something similar] and of course all of these methods will return strings. The columns from the SELECT will populate our model's fields so ensure that your column names match your field names or use alias names that match." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:296 msgid "Create report model." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:298 msgid "Create a report model with the following fields:" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:301 #: ../../../odoo/addons/account/models/chart_template.py:docstring of odoo.addons.account.models.chart_template.AccountAccountTemplate.note:1 msgid "Note" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:303 msgid "Corresponds to ``id`` of ``estate.property.offer``" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:304 msgid "offer_state" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:304 msgid "Equals ``state`` choices of ``estate.property.offer``" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:306 msgid "property_state" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:306 msgid "Equals ``state`` choices of ``estate.property``" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:307 msgid "property_type_id" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:310 msgid "and write the SQL query necessary to populate the fields (hint, you will need 2 JOINs)." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:312 msgid "You won't be able to check if your model is correct until we create a view for it, but you are welcome to check your query directly in your database to see if the results are as you expect. If you struggle with this exercise, then `here is an example `__ to reference." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:320 msgid "Now that we have our model, we can make its dashboard view. There is no difference to how its made except that its file is located in the ``report`` folder. Since it is a new model not linked to any other model, we will also have to add a new menuitem to view our dashboard. Typically SQL views are added under a first level menu called *Reporting* (because it's a report, surprise!). Do you remember how to add a ``menuitem``? If not, revisit :ref:`howto/rdtraining/06_firstui`) again." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:326 msgid "Create report view." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:328 msgid "Recreate the dashboard in the **Goal** of this section. Hint: it uses the ``formula`` element, which we did not need for our previous dashboard." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:331 msgid "Bonus: Create ``list`` and ``form`` views for your new report model so we don't have to see the ugly defaults when you click on your pie charts." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:335 msgid "Extra Tips" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:336 msgid "**Tip 1** A common mistake in SQL views is to not take into account the duplication of certain data due to table JOINs. For example, in our **Goal** we have a pie chart of the offers' property types. We may be tempted to add a similar pie chart with a domain to only include canceled properties, so we think we are only counting the number of canceled properties by property type. In reality we are still looking at all the offers per property so any property with more than 1 offer will be counted per offer. This example is easily double checked by clicking on the pie chart to see its list view:" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:0 msgid "Pie chart list view" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:348 msgid "But for cases such as average aggregations or using a subview such as the pivot view, it is easy to miss this mistake. It is also easy to miss this mistake when you have insufficient test data. In order to add a number of properties canceled by property type pie chart to this report, we would either have to do a hack (too advanced for this tutorial) or simply exclude it from this report." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:354 msgid "**Tip 2** If you have a field that you do not want as a measure (i.e. in your pivot or graph views), then you can add ``store=False`` to it and it will not show." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:357 msgid "**Tip 3** If you have a SQL View that depends on context then instead of overriding ``BaseModel.init()`` set the ``_table_query`` property::" msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:364 msgid "The *select* and *from* methods remain the same." msgstr "" #: ../../content/developer/howtos/rdtraining/K_dashboard.rst:366 msgid "`Here is an example `__ of a report that depends on the currently selected companies (in a multi-company environment) context to determine the currency exchange rates to use for accurately displaying amounts when the selected companies have different currencies." msgstr "" #: ../../content/developer/howtos/rdtraining/L_cron.rst:7 msgid "Advanced L: Scheduled & Server Actions" msgstr "" #: ../../content/developer/howtos/rdtraining/M_migration.rst:7 msgid "Advanced M: Migrations" msgstr "" #: ../../content/developer/howtos/rdtraining/N_security.rst:5 msgid "Advanced N: Security" msgstr "" #: ../../content/developer/howtos/rdtraining/N_security.rst:7 msgid "Every day we hear about data leaks and attacks in the newspapers. We expect you to be aware and careful about how to avoid security breaches in your future developments." msgstr "" #: ../../content/developer/howtos/rdtraining/N_security.rst:11 msgid "You already defined new models in your training. Did you check the access rights and define record rules on it ? Are you sure your module is not an open door to SQL injections ? Did you use getattr or t-raw in your code?" msgstr "" #: ../../content/developer/howtos/rdtraining/N_security.rst:15 msgid "No or wrong access rules on models." msgstr "" #: ../../content/developer/howtos/rdtraining/N_security.rst:16 msgid "Introduction of public methods that should actually be private." msgstr "" #: ../../content/developer/howtos/rdtraining/N_security.rst:17 msgid "Wrong manipulation of access tokens." msgstr "" #: ../../content/developer/howtos/rdtraining/N_security.rst:18 msgid "No or wrong `ir.rules` (restriction rules) on models." msgstr "" #: ../../content/developer/howtos/rdtraining/N_security.rst:19 msgid "Introduction of SQL injections." msgstr "" #: ../../content/developer/howtos/rdtraining/N_security.rst:20 msgid "etc." msgstr "" #: ../../content/developer/howtos/rdtraining/N_security.rst:22 msgid "Please check this `presentation from Olivier Dony (odo) `_ about common mistakes that you should **absolutely** avoid in your future developments. Also, please always use this `security checklist `_ to double-check your development and avoid further embarrassing issues." msgstr "" #: ../../content/developer/howtos/rdtraining/O_perf.rst:7 msgid "Advanced O: Performances" 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 ```` tag." msgstr "" #: ../../content/developer/howtos/themes.rst:165 msgid "Almost every element and option that you create has to be placed inside a ``