# 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 14.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-05-18 07:12+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \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:3 msgid "Developer" msgstr "" #: ../../content/developer/glossary.rst:5 msgid "Glossary" msgstr "" #: ../../content/developer/glossary.rst:8 msgid "external id" msgstr "" #: ../../content/developer/glossary.rst:9 msgid "external identifier" msgstr "" #: ../../content/developer/glossary.rst:10 msgid "external identifiers" msgstr "" #: ../../content/developer/glossary.rst:12 msgid "string identifier stored in ``ir.model.data``, can be used to refer to a record regardless of its database identifier during data imports or export/import roundtrips." msgstr "" #: ../../content/developer/glossary.rst:16 msgid "External identifiers are in the form :samp:`{module}.{id}` (e.g. ``account.invoice_graph``). From within a module, the :samp:`{module}.` prefix can be left out." msgstr "" #: ../../content/developer/glossary.rst:20 msgid "Sometimes referred to as \"xml id\" or ``xml_id`` as XML-based :ref:`reference/data` make extensive use of them." msgstr "" #: ../../content/developer/glossary.rst:22 msgid "format string" msgstr "" #: ../../content/developer/glossary.rst:24 msgid "inspired by `jinja variables`_, format strings allow more easily mixing literal content and computed content (expressions): content between ``{{`` and ``}}`` is interpreted as an expression and evaluated, other content is interpreted as literal strings and displayed as-is" msgstr "" #: ../../content/developer/glossary.rst:29 msgid "GIS" msgstr "" #: ../../content/developer/glossary.rst:30 msgid "Geographic Information System" msgstr "" #: ../../content/developer/glossary.rst:32 msgid "any computer system or subsystem to capture, store, manipulate, analyze, manage or present spatial and geographical data." msgstr "" #: ../../content/developer/glossary.rst:34 msgid "minified" msgstr "" #: ../../content/developer/glossary.rst:35 msgid "minification" msgstr "" #: ../../content/developer/glossary.rst:37 msgid "process of removing extraneous/non-necessary sections of files (comments, whitespace) and possibly recompiling them using equivalent but shorter structures (`ternary operator`_ instead of ``if/else``) in order to reduce network traffic" msgstr "" #: ../../content/developer/howtos.rst:3 msgid "Tutorials" msgstr "" #: ../../content/developer/howtos/backend.rst:7 msgid "Building a Module" msgstr "" #: ../../content/developer/howtos/backend.rst:11 msgid "This tutorial requires :ref:`having installed Odoo `" 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 msgid "Composition of a module" msgstr "" #: ../../content/developer/howtos/backend.rst:50 msgid "An Odoo module can contain a number of elements:" msgstr "" #: ../../content/developer/howtos/backend.rst:54 msgid "Business objects" msgstr "" #: ../../content/developer/howtos/backend.rst:53 msgid "Declared as Python classes, these resources are automatically persisted by Odoo based on their configuration" msgstr "" #: ../../content/developer/howtos/backend.rst:57 msgid ":ref:`Object views `" msgstr "" #: ../../content/developer/howtos/backend.rst:57 msgid "Definition of business objects UI display" msgstr "" #: ../../content/developer/howtos/backend.rst:65 msgid ":ref:`Data files `" msgstr "" #: ../../content/developer/howtos/backend.rst:60 msgid "XML or CSV files declaring the model metadata :" msgstr "" #: ../../content/developer/howtos/backend.rst:62 msgid ":ref:`views ` or :ref:`reports `," msgstr "" #: ../../content/developer/howtos/backend.rst:63 msgid "configuration data (modules parametrization, :ref:`security rules `)," msgstr "" #: ../../content/developer/howtos/backend.rst:64 msgid "demonstration data" msgstr "" #: ../../content/developer/howtos/backend.rst:65 msgid "and more" msgstr "" #: ../../content/developer/howtos/backend.rst:68 msgid ":ref:`Web controllers `" msgstr "" #: ../../content/developer/howtos/backend.rst:68 msgid "Handle requests from web browsers" msgstr "" #: ../../content/developer/howtos/backend.rst:71 msgid "Static web data" msgstr "" #: ../../content/developer/howtos/backend.rst:71 msgid "Images, CSS or javascript files used by the web interface or website" msgstr "" #: ../../content/developer/howtos/backend.rst:74 #: ../../content/developer/reference/guidelines.rst:32 msgid "Module structure" msgstr "" #: ../../content/developer/howtos/backend.rst:76 msgid "Each module is a directory within a *module directory*. Module directories are specified by using the :option:`--addons-path ` 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 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 msgid "Object-Relational Mapping" msgstr "" #: ../../content/developer/howtos/backend.rst:118 msgid "A key component of Odoo is the :abbr:`ORM (Object-Relational Mapping)` layer. This layer avoids having to write most :abbr:`SQL (Structured Query Language)` by hand and provides extensibility and security services\\ [#rawsql]_." msgstr "" #: ../../content/developer/howtos/backend.rst:122 msgid "Business objects are declared as Python classes extending :class:`~odoo.models.Model` which integrates them into the automated persistence system." msgstr "" #: ../../content/developer/howtos/backend.rst:126 msgid "Models can be configured by setting a number of attributes at their definition. The most important attribute is :attr:`~odoo.models.Model._name` which is required and defines the name for the model in the Odoo system. Here is a minimally complete definition of a model::" msgstr "" #: ../../content/developer/howtos/backend.rst:137 msgid "Model fields" msgstr "" #: ../../content/developer/howtos/backend.rst:139 msgid "Fields are used to define what the model can store and where. Fields are defined as attributes on the model class::" msgstr "" #: ../../content/developer/howtos/backend.rst:150 msgid "Common Attributes" msgstr "" #: ../../content/developer/howtos/backend.rst:152 msgid "Much like the model itself, its fields can be configured, by passing configuration attributes as parameters::" msgstr "" #: ../../content/developer/howtos/backend.rst:157 msgid "Some attributes are available on all fields, here are the most common ones:" msgstr "" #: ../../content/developer/howtos/backend.rst:159 msgid ":attr:`~odoo.fields.Field.string` (``unicode``, default: field's name)" msgstr "" #: ../../content/developer/howtos/backend.rst:160 msgid "The label of the field in UI (visible by users)." msgstr "" #: ../../content/developer/howtos/backend.rst:162 msgid ":attr:`~odoo.fields.Field.required` (``bool``, default: ``False``)" msgstr "" #: ../../content/developer/howtos/backend.rst:162 msgid "If ``True``, the field can not be empty, it must either have a default value or always be given a value when creating a record." msgstr "" #: ../../content/developer/howtos/backend.rst:164 msgid ":attr:`~odoo.fields.Field.help` (``unicode``, default: ``''``)" msgstr "" #: ../../content/developer/howtos/backend.rst:165 msgid "Long-form, provides a help tooltip to users in the UI." msgstr "" #: ../../content/developer/howtos/backend.rst:167 msgid ":attr:`~odoo.fields.Field.index` (``bool``, default: ``False``)" msgstr "" #: ../../content/developer/howtos/backend.rst:167 msgid "Requests that Odoo create a `database index`_ on the column." msgstr "" #: ../../content/developer/howtos/backend.rst:170 msgid "Simple fields" msgstr "" #: ../../content/developer/howtos/backend.rst:172 msgid "There are two broad categories of fields: \"simple\" fields which are atomic values stored directly in the model's table and \"relational\" fields linking records (of the same model or of different models)." msgstr "" #: ../../content/developer/howtos/backend.rst:176 msgid "Example of simple fields are :class:`~odoo.fields.Boolean`, :class:`~odoo.fields.Date`, :class:`~odoo.fields.Char`." msgstr "" #: ../../content/developer/howtos/backend.rst:180 msgid "Reserved fields" msgstr "" #: ../../content/developer/howtos/backend.rst:182 msgid "Odoo creates a few fields in all models\\ [#autofields]_. These fields are managed by the system and shouldn't be written to. They can be read if useful or necessary:" msgstr "" #: ../../content/developer/howtos/backend.rst:186 msgid ":attr:`~odoo.fields.Model.id` (:class:`~odoo.fields.Id`)" msgstr "" #: ../../content/developer/howtos/backend.rst:187 msgid "The unique identifier for a record in its model." msgstr "" #: ../../content/developer/howtos/backend.rst:188 msgid ":attr:`~odoo.fields.Model.create_date` (:class:`~odoo.fields.Datetime`)" msgstr "" #: ../../content/developer/howtos/backend.rst:189 msgid "Creation date of the record." msgstr "" #: ../../content/developer/howtos/backend.rst:190 msgid ":attr:`~odoo.fields.Model.create_uid` (:class:`~odoo.fields.Many2one`)" msgstr "" #: ../../content/developer/howtos/backend.rst:191 msgid "User who created the record." msgstr "" #: ../../content/developer/howtos/backend.rst:192 msgid ":attr:`~odoo.fields.Model.write_date` (:class:`~odoo.fields.Datetime`)" msgstr "" #: ../../content/developer/howtos/backend.rst:193 msgid "Last modification date of the record." msgstr "" #: ../../content/developer/howtos/backend.rst:195 msgid ":attr:`~odoo.fields.Model.write_uid` (:class:`~odoo.fields.Many2one`)" msgstr "" #: ../../content/developer/howtos/backend.rst:195 msgid "user who last modified the record." msgstr "" #: ../../content/developer/howtos/backend.rst:198 msgid "Special fields" msgstr "" #: ../../content/developer/howtos/backend.rst:200 msgid "By default, Odoo also requires a ``name`` field on all models for various display and search behaviors. The field used for these purposes can be overridden by setting :attr:`~odoo.models.Model._rec_name`." msgstr "" #: ../../content/developer/howtos/backend.rst:204 msgid "Define a model" msgstr "" #: ../../content/developer/howtos/backend.rst:206 msgid "Define a new data model *Course* in the *openacademy* module. A course has a title and a description. Courses must have a title." msgstr "" #: ../../content/developer/howtos/backend.rst:210 msgid "Data files" msgstr "" #: ../../content/developer/howtos/backend.rst:212 msgid "Odoo is a highly data driven system. Although behavior is customized using Python_ code part of a module's value is in the data it sets up when loaded." msgstr "" #: ../../content/developer/howtos/backend.rst:215 msgid "some modules exist solely to add data into Odoo" msgstr "" #: ../../content/developer/howtos/backend.rst:218 msgid "Module data is declared via :ref:`data files `, 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 msgid "by clicking on menu items (linked to specific actions)" msgstr "" #: ../../content/developer/howtos/backend.rst:263 msgid "by clicking on buttons in views (if these are connected to actions)" msgstr "" #: ../../content/developer/howtos/backend.rst:264 msgid "as contextual actions on object" msgstr "" #: ../../content/developer/howtos/backend.rst:266 msgid "Because menus are somewhat complex to declare there is a ```` 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 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/javascript_reference.rst:2053 msgid "Relational fields" msgstr "" #: ../../content/developer/howtos/backend.rst:462 msgid "Relational fields link records, either of the same model (hierarchies) or between different models." msgstr "" #: ../../content/developer/howtos/backend.rst:465 msgid "Relational field types are:" msgstr "" #: ../../content/developer/howtos/backend.rst:472 msgid ":class:`Many2one(other_model, ondelete='set null') `" 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/javascript_reference.rst:411 #: ../../content/developer/reference/views.rst:184 msgid "Inheritance" msgstr "" #: ../../content/developer/howtos/backend.rst:525 msgid "Model inheritance" msgstr "" #: ../../content/developer/howtos/backend.rst:527 msgid "Odoo provides two *inheritance* mechanisms to extend an existing model in a modular way." msgstr "" #: ../../content/developer/howtos/backend.rst:530 msgid "The first inheritance mechanism allows a module to modify the behavior of a model defined in another module:" msgstr "" #: ../../content/developer/howtos/backend.rst:533 msgid "add fields to a model," msgstr "" #: ../../content/developer/howtos/backend.rst:534 msgid "override the definition of fields on a model," msgstr "" #: ../../content/developer/howtos/backend.rst:535 msgid "add constraints to a model," msgstr "" #: ../../content/developer/howtos/backend.rst:536 msgid "add methods to a model," msgstr "" #: ../../content/developer/howtos/backend.rst:537 msgid "override existing methods on a model." msgstr "" #: ../../content/developer/howtos/backend.rst:539 msgid "The second inheritance mechanism (delegation) allows to link every record of a model to a record in a parent model, and provides transparent access to the fields of the parent record." msgstr "" #: ../../content/developer/howtos/backend.rst:548 msgid ":attr:`~odoo.models.Model._inherit`" msgstr "" #: ../../content/developer/howtos/backend.rst:549 msgid ":attr:`~odoo.models.Model._inherits`" msgstr "" #: ../../content/developer/howtos/backend.rst:552 msgid "View inheritance" msgstr "" #: ../../content/developer/howtos/backend.rst:554 msgid "Instead of modifying existing views in place (by overwriting them), Odoo provides view inheritance where children \"extension\" views are applied on top of root views, and can add or remove content from their parent." msgstr "" #: ../../content/developer/howtos/backend.rst:558 msgid "An extension view references its parent using the ``inherit_id`` field, and instead of a single view its ``arch`` field is composed of any number of ``xpath`` elements selecting and altering the content of their parent view:" msgstr "" #: ../../content/developer/howtos/backend.rst:579 msgid "``expr``" msgstr "" #: ../../content/developer/howtos/backend.rst:579 msgid "An XPath_ expression selecting a single element in the parent view. Raises an error if it matches no element or more than one" msgstr "" #: ../../content/developer/howtos/backend.rst:595 msgid "``position``" msgstr "" #: ../../content/developer/howtos/backend.rst:582 msgid "Operation to apply to the matched element:" msgstr "" #: ../../content/developer/howtos/backend.rst:584 msgid "``inside``" msgstr "" #: ../../content/developer/howtos/backend.rst:585 msgid "appends ``xpath``'s body at the end of the matched element" msgstr "" #: ../../content/developer/howtos/backend.rst:587 #: ../../content/developer/reference/qweb.rst:528 #: ../../content/developer/reference/views.rst:282 msgid "``replace``" msgstr "" #: ../../content/developer/howtos/backend.rst:587 msgid "replaces the matched element with the ``xpath``'s body, replacing any ``$0`` node occurrence in the new body with the original element" msgstr "" #: ../../content/developer/howtos/backend.rst:589 #: ../../content/developer/reference/qweb.rst:522 #: ../../content/developer/reference/views.rst:288 msgid "``before``" msgstr "" #: ../../content/developer/howtos/backend.rst:590 msgid "inserts the ``xpath``'s body as a sibling before the matched element" msgstr "" #: ../../content/developer/howtos/backend.rst:591 #: ../../content/developer/reference/qweb.rst:524 #: ../../content/developer/reference/views.rst:285 msgid "``after``" msgstr "" #: ../../content/developer/howtos/backend.rst:592 msgid "inserts the ``xpaths``'s body as a sibling after the matched element" msgstr "" #: ../../content/developer/howtos/backend.rst:595 #: ../../content/developer/reference/qweb.rst:533 #: ../../content/developer/reference/views.rst:308 msgid "``attributes``" msgstr "" #: ../../content/developer/howtos/backend.rst:594 msgid "alters the attributes of the matched element using special ``attribute`` elements in the ``xpath``'s body" msgstr "" #: ../../content/developer/howtos/backend.rst:599 msgid "When matching a single element, the ``position`` attribute can be set directly on the element to be found. Both inheritances below will give the same result." msgstr "" #: ../../content/developer/howtos/backend.rst:613 msgid "Alter existing content" msgstr "" #: ../../content/developer/howtos/backend.rst:615 msgid "Using model inheritance, modify the existing *Partner* model to add an ``instructor`` boolean field, and a many2many field that corresponds to the session-partner relation" msgstr "" #: ../../content/developer/howtos/backend.rst:618 msgid "Using view inheritance, display this fields in the partner form view" msgstr "" #: ../../content/developer/howtos/backend.rst:621 msgid "Domains" msgstr "" #: ../../content/developer/howtos/backend.rst:623 msgid "In Odoo, :ref:`reference/orm/domains` are values that encode conditions on records. A domain is a list of criteria used to select a subset of a model's records. Each criteria is a triple with a field name, an operator and a value." msgstr "" #: ../../content/developer/howtos/backend.rst:627 msgid "For instance, when used on the *Product* model the following domain selects all *services* with a unit price over *1000*::" msgstr "" #: ../../content/developer/howtos/backend.rst:632 msgid "By default criteria are combined with an implicit AND. The logical operators ``&`` (AND), ``|`` (OR) and ``!`` (NOT) can be used to explicitly combine criteria. They are used in prefix position (the operator is inserted before its arguments rather than between). For instance to select products \"which are services *OR* have a unit price which is *NOT* between 1000 and 2000\"::" msgstr "" #: ../../content/developer/howtos/backend.rst:644 msgid "A ``domain`` parameter can be added to relational fields to limit valid records for the relation when trying to select records in the client interface." msgstr "" #: ../../content/developer/howtos/backend.rst:647 msgid "Domains on relational fields" msgstr "" #: ../../content/developer/howtos/backend.rst:649 msgid "When selecting the instructor for a *Session*, only instructors (partners with ``instructor`` set to ``True``) should be visible." msgstr "" #: ../../content/developer/howtos/backend.rst:652 msgid "More complex domains" msgstr "" #: ../../content/developer/howtos/backend.rst:654 msgid "Create new partner categories *Teacher / Level 1* and *Teacher / Level 2*. The instructor for a session can be either an instructor or a teacher (of any level)." msgstr "" #: ../../content/developer/howtos/backend.rst:659 msgid "Computed fields and default values" msgstr "" #: ../../content/developer/howtos/backend.rst:661 msgid "So far fields have been stored directly in and retrieved directly from the database. Fields can also be *computed*. In that case, the field's value is not retrieved from the database but computed on-the-fly by calling a method of the model." msgstr "" #: ../../content/developer/howtos/backend.rst:666 msgid "To create a computed field, create a field and set its attribute :attr:`~odoo.fields.Field.compute` to the name of a method. The computation method should simply set the value of the field to compute on every record in ``self``." msgstr "" #: ../../content/developer/howtos/backend.rst:671 msgid "``self`` is a collection" msgstr "" #: ../../content/developer/howtos/backend.rst:674 msgid "The object ``self`` is a *recordset*, i.e., an ordered collection of records. It supports the standard Python operations on collections, like ``len(self)`` and ``iter(self)``, plus extra set operations like ``recs1 + recs2``." msgstr "" #: ../../content/developer/howtos/backend.rst:679 msgid "Iterating over ``self`` gives the records one by one, where each record is itself a collection of size 1. You can access/assign fields on single records by using the dot notation, like ``record.name``." msgstr "" #: ../../content/developer/howtos/backend.rst:699 msgid "Dependencies" msgstr "" #: ../../content/developer/howtos/backend.rst:701 msgid "The value of a computed field usually depends on the values of other fields on the computed record. The ORM expects the developer to specify those dependencies on the compute method with the decorator :func:`~odoo.api.depends`. The given dependencies are used by the ORM to trigger the recomputation of the field whenever some of its dependencies have been modified::" msgstr "" #: ../../content/developer/howtos/backend.rst:720 msgid "Computed fields" msgstr "" #: ../../content/developer/howtos/backend.rst:722 msgid "Add the percentage of taken seats to the *Session* model" msgstr "" #: ../../content/developer/howtos/backend.rst:723 msgid "Display that field in the tree and form views" msgstr "" #: ../../content/developer/howtos/backend.rst:724 msgid "Display the field as a progress bar" msgstr "" #: ../../content/developer/howtos/backend.rst:727 msgid "Default values" msgstr "" #: ../../content/developer/howtos/backend.rst:729 msgid "Any field can be given a default value. In the field definition, add the option ``default=X`` where ``X`` is either a Python literal value (boolean, integer, float, string), or a function taking a recordset and returning a value::" msgstr "" #: ../../content/developer/howtos/backend.rst:738 msgid "The object ``self.env`` gives access to request parameters and other useful things:" msgstr "" #: ../../content/developer/howtos/backend.rst:741 msgid "``self.env.cr`` or ``self._cr`` is the database *cursor* object; it is used for querying the database" msgstr "" #: ../../content/developer/howtos/backend.rst:743 msgid "``self.env.uid`` or ``self._uid`` is the current user's database id" msgstr "" #: ../../content/developer/howtos/backend.rst:744 msgid "``self.env.user`` is the current user's record" msgstr "" #: ../../content/developer/howtos/backend.rst:745 msgid "``self.env.context`` or ``self._context`` is the context dictionary" msgstr "" #: ../../content/developer/howtos/backend.rst:746 msgid "``self.env.ref(xml_id)`` returns the record corresponding to an XML id" msgstr "" #: ../../content/developer/howtos/backend.rst:747 msgid "``self.env[model_name]`` returns an instance of the given model" msgstr "" #: ../../content/developer/howtos/backend.rst:749 msgid "Active objects – Default values" msgstr "" #: ../../content/developer/howtos/backend.rst:751 msgid "Define the start_date default value as today (see :class:`~odoo.fields.Date`)." msgstr "" #: ../../content/developer/howtos/backend.rst:753 msgid "Add a field ``active`` in the class Session, and set sessions as active by default." msgstr "" #: ../../content/developer/howtos/backend.rst:757 msgid "Onchange" msgstr "" #: ../../content/developer/howtos/backend.rst:759 msgid "The \"onchange\" mechanism provides a way for the client interface to update a form whenever the user has filled in a value in a field, without saving anything to the database." msgstr "" #: ../../content/developer/howtos/backend.rst:763 msgid "For instance, suppose a model has three fields ``amount``, ``unit_price`` and ``price``, and you want to update the price on the form when any of the other fields is modified. To achieve this, define a method where ``self`` represents the record in the form view, and decorate it with :func:`~odoo.api.onchange` to specify on which field it has to be triggered. Any change you make on ``self`` will be reflected on the form." msgstr "" #: ../../content/developer/howtos/backend.rst:792 msgid "For computed fields, valued ``onchange`` behavior is built-in as can be seen by playing with the *Session* form: change the number of seats or participants, and the ``taken_seats`` progressbar is automatically updated." msgstr "" #: ../../content/developer/howtos/backend.rst:796 msgid "Warning" msgstr "" #: ../../content/developer/howtos/backend.rst:798 msgid "Add an explicit onchange to warn about invalid values, like a negative number of seats, or more participants than seats." msgstr "" #: ../../content/developer/howtos/backend.rst:802 msgid "Model constraints" msgstr "" #: ../../content/developer/howtos/backend.rst:804 msgid "Odoo provides two ways to set up automatically verified invariants: :func:`Python constraints ` 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/views.rst:978 #: ../../content/developer/reference/views.rst:1411 #: ../../content/developer/reference/views.rst:1532 msgid "``decoration-{$name}``" msgstr "" #: ../../content/developer/howtos/backend.rst:861 #: ../../content/developer/reference/views.rst:965 #: ../../content/developer/reference/views.rst:1407 msgid "allow changing the style of a row's text based on the corresponding record's attributes." msgstr "" #: ../../content/developer/howtos/backend.rst:864 #: ../../content/developer/reference/views.rst:104 #: ../../content/developer/reference/views.rst:968 msgid "Values are Python expressions. For each record, the expression is evaluated with the record's attributes as context values and if ``true``, the corresponding style is applied to the row. Here are some of the other values available in the context:" msgstr "" #: ../../content/developer/howtos/backend.rst:869 #: ../../content/developer/reference/views.rst:109 #: ../../content/developer/reference/views.rst:973 msgid "``uid``: the id of the current user," msgstr "" #: ../../content/developer/howtos/backend.rst:870 #: ../../content/developer/reference/views.rst:110 #: ../../content/developer/reference/views.rst:974 msgid "``today``: the current local date as a string of the form ``YYYY-MM-DD``," msgstr "" #: ../../content/developer/howtos/backend.rst:871 #: ../../content/developer/reference/views.rst:111 #: ../../content/developer/reference/views.rst:975 msgid "``now``: same as ``today`` with the addition of the current time. This value is formatted as ``YYYY-MM-DD hh:mm:ss``." msgstr "" #: ../../content/developer/howtos/backend.rst:874 msgid "``{$name}`` can be ``bf`` (``font-weight: bold``), ``it`` (``font-style: italic``), or any `bootstrap contextual color `_ (``danger``, ``info``, ``muted``, ``primary``, ``success`` or ``warning``)." msgstr "" #: ../../content/developer/howtos/backend.rst:890 #: ../../content/developer/reference/views.rst:1391 msgid "``editable``" msgstr "" #: ../../content/developer/howtos/backend.rst:888 msgid "Either ``\"top\"`` or ``\"bottom\"``. Makes the tree view editable in-place (rather than having to go through the form view), the value is the position where new rows appear." msgstr "" #: ../../content/developer/howtos/backend.rst:892 msgid "List coloring" msgstr "" #: ../../content/developer/howtos/backend.rst:894 msgid "Modify the Session tree view in such a way that sessions lasting less than 5 days are colored blue, and the ones lasting more than 15 days are colored red." msgstr "" #: ../../content/developer/howtos/backend.rst:899 msgid "Calendars" msgstr "" #: ../../content/developer/howtos/backend.rst:901 msgid "Displays records as calendar events. Their root element is ```` and their most common attributes are:" msgstr "" #: ../../content/developer/howtos/backend.rst:907 #: ../../content/developer/reference/views.rst:410 #: ../../content/developer/reference/views.rst:962 #: ../../content/developer/reference/views.rst:1342 msgid "``color``" msgstr "" #: ../../content/developer/howtos/backend.rst:905 msgid "The name of the field used for *color segmentation*. Colors are automatically distributed to events, but events in the same color segment (records which have the same value for their ``@color`` field) will be given the same color." msgstr "" #: ../../content/developer/howtos/backend.rst:909 msgid "``date_start``" msgstr "" #: ../../content/developer/howtos/backend.rst:910 msgid "record's field holding the start date/time for the event" msgstr "" #: ../../content/developer/howtos/backend.rst:911 msgid "``date_stop`` (optional)" msgstr "" #: ../../content/developer/howtos/backend.rst:912 msgid "record's field holding the end date/time for the event" msgstr "" #: ../../content/developer/howtos/backend.rst:914 #: ../../content/developer/reference/views.rst:897 #: ../../content/developer/reference/views.rst:1017 #: ../../content/developer/reference/views.rst:1435 #: ../../content/developer/reference/views.rst:1493 #: ../../content/developer/reference/views.rst:1682 #: ../../content/developer/reference/views.rst:1727 #: ../../content/developer/reference/views.rst:1843 msgid "``string``" msgstr "" #: ../../content/developer/howtos/backend.rst:914 msgid "record's field to define the label for each calendar event" msgstr "" #: ../../content/developer/howtos/backend.rst:922 msgid "Calendar view" msgstr "" #: ../../content/developer/howtos/backend.rst:924 msgid "Add a Calendar view to the *Session* model enabling the user to view the events associated to the Open Academy." msgstr "" #: ../../content/developer/howtos/backend.rst:930 msgid "Search view ```` elements can have a ``@filter_domain`` that overrides the domain generated for searching on the given field. In the given domain, ``self`` represents the value entered by the user. In the example below, it is used to search on both fields ``name`` and ``description``." msgstr "" #: ../../content/developer/howtos/backend.rst:935 msgid "Search views can also contain ```` elements, which act as toggles for predefined searches. Filters must have one of the following attributes:" msgstr "" #: ../../content/developer/howtos/backend.rst:938 #: ../../content/developer/reference/views.rst:850 #: ../../content/developer/reference/views.rst:1801 #: ../../content/developer/reference/views.rst:1878 msgid "``domain``" msgstr "" #: ../../content/developer/howtos/backend.rst:939 msgid "add the given domain to the current search" msgstr "" #: ../../content/developer/howtos/backend.rst:942 #: ../../content/developer/howtos/web.rst:1707 #: ../../content/developer/reference/data.rst:72 #: ../../content/developer/reference/views.rst:852 #: ../../content/developer/reference/views.rst:1273 #: ../../content/developer/reference/views.rst:1481 #: ../../content/developer/reference/views.rst:1606 #: ../../content/developer/reference/views.rst:1803 #: ../../content/developer/reference/views.rst:1871 #: ../../content/developer/reference/views.rst:1973 msgid "``context``" msgstr "" #: ../../content/developer/howtos/backend.rst:941 msgid "add some context to the current search; use the key ``group_by`` to group results on the given field name" msgstr "" #: ../../content/developer/howtos/backend.rst:961 msgid "To use a non-default search view in an action, it should be linked using the ``search_view_id`` field of the action record." msgstr "" #: ../../content/developer/howtos/backend.rst:964 msgid "The action can also set default values for search fields through its ``context`` field: context keys of the form :samp:`search_default_{field_name}` will initialize *field_name* with the provided value. Search filters must have an optional ``@name`` to have a default and behave as booleans (they can only be enabled by default)." msgstr "" #: ../../content/developer/howtos/backend.rst:972 msgid "Add a button to filter the courses for which the current user is the responsible in the course search view. Make it selected by default." msgstr "" #: ../../content/developer/howtos/backend.rst:974 msgid "Add a button to group courses by responsible user." msgstr "" #: ../../content/developer/howtos/backend.rst:977 #: ../../content/developer/reference/views.rst:945 msgid "Gantt" msgstr "" #: ../../content/developer/howtos/backend.rst:981 msgid "The gantt view requires the web_gantt module which is present in :ref:`the enterprise edition ` 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/views.rst:1151 #: ../../content/developer/reference/views.rst:1733 msgid "``row`` (default)" msgstr "" #: ../../content/developer/howtos/backend.rst:1030 msgid "the field should be aggregated by default" msgstr "" #: ../../content/developer/howtos/backend.rst:1032 #: ../../content/developer/reference/views.rst:1156 #: ../../content/developer/reference/views.rst:1737 msgid "``measure``" msgstr "" #: ../../content/developer/howtos/backend.rst:1032 msgid "the field should be aggregated rather than grouped on" msgstr "" #: ../../content/developer/howtos/backend.rst:1043 msgid "Graph views perform aggregations on database values, they do not work with non-stored computed fields." msgstr "" #: ../../content/developer/howtos/backend.rst:1046 msgid "Graph view" msgstr "" #: ../../content/developer/howtos/backend.rst:1048 msgid "Add a Graph view in the Session object that displays, for each course, the number of attendees under the form of a bar chart." msgstr "" #: ../../content/developer/howtos/backend.rst:1052 #: ../../content/developer/reference/views.rst:1175 msgid "Kanban" msgstr "" #: ../../content/developer/howtos/backend.rst:1054 msgid "Used to organize tasks, production processes, etc… their root element is ````." msgstr "" #: ../../content/developer/howtos/backend.rst:1057 msgid "A kanban view shows a set of cards possibly grouped in columns. Each card represents a record, and each column the values of an aggregation field." msgstr "" #: ../../content/developer/howtos/backend.rst:1060 msgid "For instance, project tasks may be organized by stage (each column is a stage), or by responsible (each column is a user), and so on." msgstr "" #: ../../content/developer/howtos/backend.rst:1063 msgid "Kanban views define the structure of each card as a mix of form elements (including basic HTML) and :ref:`reference/qweb`." msgstr "" #: ../../content/developer/howtos/backend.rst:1066 msgid "Kanban view" msgstr "" #: ../../content/developer/howtos/backend.rst:1068 msgid "Add a Kanban view that displays sessions grouped by course (columns are thus courses)." msgstr "" #: ../../content/developer/howtos/backend.rst:1072 msgid "Security" msgstr "" #: ../../content/developer/howtos/backend.rst:1074 msgid "Access control mechanisms must be configured to achieve a coherent security policy." msgstr "" #: ../../content/developer/howtos/backend.rst:1078 msgid "Group-based access control mechanisms" msgstr "" #: ../../content/developer/howtos/backend.rst:1080 msgid "Groups are created as normal records on the model ``res.groups``, and granted menu access via menu definitions. However even without a menu, objects may still be accessible indirectly, so actual object-level permissions (read, write, create, unlink) must be defined for groups. They are usually inserted via CSV files inside modules. It is also possible to restrict access to specific fields on a view or object using the field's groups attribute." msgstr "" #: ../../content/developer/howtos/backend.rst:1088 msgid "Access rights" msgstr "" #: ../../content/developer/howtos/backend.rst:1090 msgid "Access rights are defined as records of the model ``ir.model.access``. Each access right is associated to a model, a group (or no group for global access), and a set of permissions: read, write, create, unlink. Such access rights are usually created by a CSV file named after its model: ``ir.model.access.csv``." msgstr "" #: ../../content/developer/howtos/backend.rst:1102 msgid "Add access control through the Odoo interface" msgstr "" #: ../../content/developer/howtos/backend.rst:1104 msgid "Create a new user \"John Smith\". Then create a group \"OpenAcademy / Session Read\" with read access to the *Session* model." msgstr "" #: ../../content/developer/howtos/backend.rst:1107 msgid "Add access control through data files in your module" msgstr "" #: ../../content/developer/howtos/backend.rst:1109 msgid "Using data files," msgstr "" #: ../../content/developer/howtos/backend.rst:1111 msgid "Create a group *OpenAcademy / Manager* with full access to all OpenAcademy models" msgstr "" #: ../../content/developer/howtos/backend.rst:1113 msgid "Make *Session* and *Course* readable by all users" msgstr "" #: ../../content/developer/howtos/backend.rst:1116 msgid "Record rules" msgstr "" #: ../../content/developer/howtos/backend.rst:1118 msgid "A record rule restricts the access rights to a subset of records of the given model. A rule is a record of the model ``ir.rule``, and is associated to a model, a number of groups (many2many field), permissions to which the restriction applies, and a domain. The domain specifies to which records the access rights are limited." msgstr "" #: ../../content/developer/howtos/backend.rst:1124 msgid "Here is an example of a rule that prevents the deletion of leads that are not in state ``cancel``. Notice that the value of the field ``groups`` must follow the same convention as the method :meth:`~odoo.models.Model.write` of the ORM." msgstr "" #: ../../content/developer/howtos/backend.rst:1141 msgid "Record rule" msgstr "" #: ../../content/developer/howtos/backend.rst:1143 msgid "Add a record rule for the model Course and the group \"OpenAcademy / Manager\", that restricts ``write`` and ``unlink`` accesses to the responsible of a course. If a course has no responsible, all users of the group must be able to modify it." msgstr "" #: ../../content/developer/howtos/backend.rst:1151 msgid "Wizards" msgstr "" #: ../../content/developer/howtos/backend.rst:1153 msgid "Wizards describe interactive sessions with the user (or dialog boxes) through dynamic forms. A wizard is simply a model that extends the class :class:`~odoo.models.TransientModel` instead of :class:`~odoo.models.Model`. The class :class:`~odoo.models.TransientModel` extends :class:`~odoo.models.Model` and reuse all its existing mechanisms, with the following particularities:" msgstr "" #: ../../content/developer/howtos/backend.rst:1160 msgid "Wizard records are not meant to be persistent; they are automatically deleted from the database after a certain time. This is why they are called *transient*." msgstr "" #: ../../content/developer/howtos/backend.rst:1163 msgid "Wizard records may refer to regular records or wizard records through relational fields(many2one or many2many), but regular records *cannot* refer to wizard records through a many2one field." msgstr "" #: ../../content/developer/howtos/backend.rst:1167 msgid "We want to create a wizard that allow users to create attendees for a particular session, or for a list of sessions at once." msgstr "" #: ../../content/developer/howtos/backend.rst:1170 msgid "Define the wizard" msgstr "" #: ../../content/developer/howtos/backend.rst:1172 msgid "Create a wizard model with a many2one relationship with the *Session* model and a many2many relationship with the *Partner* model." msgstr "" #: ../../content/developer/howtos/backend.rst:1176 msgid "Launching wizards" msgstr "" #: ../../content/developer/howtos/backend.rst:1178 msgid "Wizards are simply :ref:`window actions ` 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/reports.rst:70 msgid "``docs``" msgstr "" #: ../../content/developer/howtos/backend.rst:1321 msgid "the records for which the report is printed" msgstr "" #: ../../content/developer/howtos/backend.rst:1323 #: ../../content/developer/reference/reports.rst:31 msgid "``user``" msgstr "" #: ../../content/developer/howtos/backend.rst:1323 msgid "the user printing the report" msgstr "" #: ../../content/developer/howtos/backend.rst:1325 msgid "Because reports are standard web pages, they are available through a URL and output parameters can be manipulated through this URL, for instance the HTML version of the *Invoice* report is available through http://localhost:8069/report/html/account.report_invoice/1 (if ``account`` is installed) and the PDF version through http://localhost:8069/report/pdf/account.report_invoice/1." msgstr "" #: ../../content/developer/howtos/backend.rst:1336 msgid "If it appears that your PDF report is missing the styles (i.e. the text appears but the style/layout is different from the html version), probably your wkhtmltopdf_ process cannot reach your web server to download them." msgstr "" #: ../../content/developer/howtos/backend.rst:1340 msgid "If you check your server logs and see that the CSS styles are not being downloaded when generating a PDF report, most surely this is the problem." msgstr "" #: ../../content/developer/howtos/backend.rst:1343 msgid "The wkhtmltopdf_ process will use the ``web.base.url`` system parameter as the *root path* to all linked files, but this parameter is automatically updated each time the Administrator is logged in. If your server resides behind some kind of proxy, that could not be reachable. You can fix this by adding one of these system parameters:" msgstr "" #: ../../content/developer/howtos/backend.rst:1349 msgid "``report.url``, pointing to an URL reachable from your server (probably ``http://localhost:8069`` or something similar). It will be used for this particular purpose only." msgstr "" #: ../../content/developer/howtos/backend.rst:1353 msgid "``web.base.url.freeze``, when set to ``True``, will stop the automatic updates to ``web.base.url``." msgstr "" #: ../../content/developer/howtos/backend.rst:1356 msgid "Create a report for the Session model" msgstr "" #: ../../content/developer/howtos/backend.rst:1358 msgid "For each session, it should display session's name, its start and end, and list the session's attendees." msgstr "" #: ../../content/developer/howtos/backend.rst:1362 msgid "Dashboards" msgstr "" #: ../../content/developer/howtos/backend.rst:1364 msgid "Define a Dashboard" msgstr "" #: ../../content/developer/howtos/backend.rst:1366 msgid "Define a dashboard containing the graph view you created, the sessions calendar view and a list view of the courses (switchable to a form view). This dashboard should be available through a menuitem in the menu, and automatically displayed in the web client when the OpenAcademy main menu is selected." msgstr "" #: ../../content/developer/howtos/backend.rst:1373 msgid "WebServices" msgstr "" #: ../../content/developer/howtos/backend.rst:1375 msgid "The web-service module offer a common interface for all web-services :" msgstr "" #: ../../content/developer/howtos/backend.rst:1377 msgid "XML-RPC" msgstr "" #: ../../content/developer/howtos/backend.rst:1378 msgid "JSON-RPC" msgstr "" #: ../../content/developer/howtos/backend.rst:1380 msgid "Business objects can also be accessed via the distributed object mechanism. They can all be modified via the client interface with contextual views." msgstr "" #: ../../content/developer/howtos/backend.rst:1384 msgid "Odoo is accessible through XML-RPC/JSON-RPC interfaces, for which libraries exist in many languages." msgstr "" #: ../../content/developer/howtos/backend.rst:1388 msgid "XML-RPC Library" msgstr "" #: ../../content/developer/howtos/backend.rst:1390 msgid "The following example is a Python 3 program that interacts with an Odoo server with the library ``xmlrpc.client``::" msgstr "" #: ../../content/developer/howtos/backend.rst:1409 msgid "Add a new service to the client" msgstr "" #: ../../content/developer/howtos/backend.rst:1411 msgid "Write a Python program able to send XML-RPC requests to a PC running Odoo (yours, or your instructor's). This program should display all the sessions, and their corresponding number of seats. It should also create a new session for one of the courses." msgstr "" #: ../../content/developer/howtos/backend.rst:1447 msgid "Instead of using a hard-coded course id, the code can look up a course by name::" msgstr "" #: ../../content/developer/howtos/backend.rst:1458 msgid "JSON-RPC Library" msgstr "" #: ../../content/developer/howtos/backend.rst:1460 msgid "The following example is a Python 3 program that interacts with an Odoo server with the standard Python libraries ``urllib.request`` and ``json``. This example assumes the **Productivity** app (``note``) is installed::" msgstr "" #: ../../content/developer/howtos/backend.rst:1504 msgid "Examples can be easily adapted from XML-RPC to JSON-RPC." msgstr "" #: ../../content/developer/howtos/backend.rst:1508 msgid "There are a number of high-level APIs in various languages to access Odoo systems without *explicitly* going through XML-RPC or JSON-RPC, such as:" msgstr "" #: ../../content/developer/howtos/backend.rst:1511 msgid "https://github.com/akretion/ooor" msgstr "" #: ../../content/developer/howtos/backend.rst:1512 msgid "https://github.com/OCA/odoorpc" msgstr "" #: ../../content/developer/howtos/backend.rst:1513 msgid "https://github.com/nicolas-van/openerp-client-lib" msgstr "" #: ../../content/developer/howtos/backend.rst:1514 msgid "http://pythonhosted.org/OdooRPC" msgstr "" #: ../../content/developer/howtos/backend.rst:1515 msgid "https://github.com/abhishek-jaiswal/php-openerp-lib" msgstr "" #: ../../content/developer/howtos/backend.rst:1517 msgid "it is possible to :ref:`disable the automatic creation of some fields `" msgstr "" #: ../../content/developer/howtos/backend.rst:1519 msgid "writing raw SQL queries is possible, but requires care as it bypasses all Odoo authentication and security mechanisms." msgstr "" #: ../../content/developer/howtos/company.rst:6 msgid "Multi-company Guidelines" msgstr "" #: ../../content/developer/howtos/company.rst:10 msgid "This tutorial requires good knowledge of Odoo. Please refer to the :ref:`basic tutorial ` 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 "" #: ../../content/developer/howtos/company.rst:132 msgid "The `check_company` feature performs a strict check ! It means that if a record has no `company_id` (i.e. the field is not required), it cannot be linked to a record whose `company_id` is set." msgstr "" #: ../../content/developer/howtos/company.rst:138 msgid "When no domain is defined on the field and `check_company` is set to `True`, a default domain is added: `['|', '('company_id', '=', False), ('company_id', '=', company_id)]`" msgstr "" #: ../../content/developer/howtos/company.rst:144 msgid "Default company" msgstr "" #: ../../content/developer/howtos/company.rst:146 msgid "When the field `company_id` is made required on a model, a good practice is to set a default company. It eases the setup flow for the user or even guarantees its validity when the company is hidden from the view. Indeed, the company is usually hidden if the user does not have access to multiple companies (i.e. when the user does not have the group `base.group_multi_company`)." msgstr "" #: ../../content/developer/howtos/company.rst:168 #: ../../content/developer/reference/javascript_reference.rst:1421 #: ../../content/developer/reference/views.rst:6 msgid "Views" msgstr "" #: ../../content/developer/howtos/company.rst:170 msgid "As stated in :ref:`above `, the company is usually hidden from the view if the user does not have access to multiple companies. This is tested with the group `base.group_multi_company`." msgstr "" #: ../../content/developer/howtos/company.rst:197 msgid "Security rules" msgstr "" #: ../../content/developer/howtos/company.rst:199 msgid "When working with records shared across companies or restricted to a single company, we must take care that a user does not have access to records belonging to other companies." msgstr "" #: ../../content/developer/howtos/company.rst:202 msgid "This is achieved with security rules based on `company_ids`, which contains the current companies of the user (the companies the user checked in the multi-company widget)." msgstr "" #: ../../content/developer/howtos/company.rst:229 #: ../../content/developer/howtos/web.rst:134 #: ../../content/developer/howtos/web.rst:1875 #: ../../content/developer/howtos/website.rst:490 #: ../../content/developer/reference/actions.rst:176 #: ../../content/developer/reference/orm.rst:605 #: ../../content/developer/reference/orm.rst:607 #: ../../content/developer/reference/orm.rst:722 #: ../../content/developer/reference/orm.rst:879 #: ../../content/developer/reference/qweb.rst:340 #: ../../content/developer/reference/qweb.rst:421 #: ../../content/developer/reference/security.rst:91 #: ../../content/developer/reference/translations.rst:21 #: ../../content/developer/reference/views.rst:13 #: ../../content/developer/reference/views.rst:70 #: ../../content/developer/reference/views.rst:81 #: ../../content/developer/reference/views.rst:179 #: ../../content/developer/reference/views.rst:241 #: ../../content/developer/reference/views.rst:818 #: ../../content/developer/reference/views.rst:938 #: ../../content/developer/reference/views.rst:940 #: ../../content/developer/reference/views.rst:1221 #: ../../content/developer/reference/views.rst:1300 #: ../../content/developer/reference/views.rst:1316 #: ../../content/developer/reference/views.rst:1483 #: ../../content/developer/reference/views.rst:2125 #: ../../content/developer/webservices/iap.rst:121 #: ../../content/developer/webservices/iap.rst:225 #: ../../content/developer/webservices/iap.rst:407 #: ../../content/developer/webservices/iap.rst:409 #: ../../content/developer/webservices/iap.rst:510 #: ../../content/developer/webservices/odoo.rst:400 #: ../../content/developer/webservices/odoo.rst:996 #: ../../content/developer/webservices/odoo.rst:1187 msgid "Todo" msgstr "" #: ../../content/developer/howtos/company.rst:229 msgid "check_company on company_dependent fields." msgstr "" #: ../../content/developer/howtos/profilecode.rst:3 msgid "Profiling Odoo code" msgstr "" #: ../../content/developer/howtos/profilecode.rst:7 msgid "This tutorial requires :ref:`having installed Odoo ` 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 stucked, sending this signal to the process permit to know what the process is doing, and letting the process continue his job." msgstr "" #: ../../content/developer/howtos/profilecode.rst:91 msgid "Tracing code execution" msgstr "" #: ../../content/developer/howtos/profilecode.rst:93 msgid "Instead of sending the SIGQUIT signal to an Odoo process often enough, to check where the processes are performing worse than expected, we can use the `py-spy`_ tool to do it for us." msgstr "" #: ../../content/developer/howtos/profilecode.rst:98 msgid "Install py-spy" msgstr "" #: ../../content/developer/howtos/profilecode.rst:105 msgid "Record executed code" msgstr "" #: ../../content/developer/howtos/profilecode.rst:107 msgid "As py-spy is installed, we now record the executed code lines. This tool will record, multiple times a second, the stacktrace of the process." msgstr "" #: ../../content/developer/howtos/profilecode.rst:118 msgid "where is the process ID of the odoo process you want to graph." msgstr "" #: ../../content/developer/howtos/profilecode.rst:120 msgid "To open profile.json you can use online tool `speedscope.app`_." msgstr "" #: ../../content/developer/howtos/profilecode.rst:122 msgid "To open profile.svg you should use browser, because other viewer may not support interactive part." msgstr "" #: ../../content/developer/howtos/themes.rst:4 msgid "Theme Tutorial" msgstr "" #: ../../content/developer/howtos/themes.rst:8 msgid "This tutorial provides a great overview of what you can do creating an Odoo theme. It is however incomplete. We are currently working on a new detailed theme tutorial, come back here soon to unleash the true power of Odoo themes!" msgstr "" #: ../../content/developer/howtos/themes.rst:15 msgid "Odoo celebrates freedom. Freedom for the designer to go further and freedom for the user to customize everything according to their needs." msgstr "" #: ../../content/developer/howtos/themes.rst:18 msgid "Ready to create your own theme? Great. Here are some things you should know before you begin. This tutorial is a guide to creating an Odoo theme." msgstr "" #: ../../content/developer/howtos/themes.rst:24 msgid "An introduction for web designers" msgstr "" #: ../../content/developer/howtos/themes.rst:26 msgid "If you are a web designer using Odoo for the first time, you are in the right place. This introduction will outline the basics of Odoo theme creation. Odoo’s team has created a framework that’s powerful and easy to use." msgstr "" #: ../../content/developer/howtos/themes.rst:30 msgid "From common CMS to Odoo" msgstr "" #: ../../content/developer/howtos/themes.rst:34 msgid "If you always think and work in the same way, you’ll probably get the same results. If you want something completely new, then try something different." msgstr "" #: ../../content/developer/howtos/themes.rst:38 msgid "Where is my header.php file?" msgstr "" #: ../../content/developer/howtos/themes.rst:40 msgid "This is usually the first question from a web designer used to working with Wordpress or Joomla and coming to Odoo for the first time." msgstr "" #: ../../content/developer/howtos/themes.rst:50 msgid "Indeed, when using common CMSs, you have to code several files (like header.php, page.php, post.php, etc.) in order to create a basic structure for your website. With those systems, this base structure acts as a design foundation that you have to update over time to ensure compatibility within your CMS. So, even after you have spent hours coding the files, you have not even started on the design yet." msgstr "" #: ../../content/developer/howtos/themes.rst:52 msgid "This **does not** apply to creating Odoo themes." msgstr "" #: ../../content/developer/howtos/themes.rst:56 msgid "We think that theme design should be simple (and powerful). When we created our Website Builder, we decided to start from scratch instead of relying on what already existed. This approach gave us the freedom to focus on the things that are really important for designers: styles, content and the logic behind them. No more struggling with technical stuff." msgstr "" #: ../../content/developer/howtos/themes.rst:59 msgid "Odoo default theme structure" msgstr "" #: ../../content/developer/howtos/themes.rst:65 msgid "Odoo comes with a default website structure. It is a very basic “theme” that provides minimal structure and layout. When you create a new theme, you are actually **extending** this. Indeed it’s always enabled in your setup and it acts exactly like the CMS’s base structure we mentioned above, except that you don’t have to create or maintain it. It will upgrade automatically within your Odoo installation and, since it is included in the Website Builder module, everything is smoothly integrated by default." msgstr "" #: ../../content/developer/howtos/themes.rst:70 msgid "As a result, you are totally free to focus on design while this structure does the job of providing integrations and functionality." msgstr "" #: ../../content/developer/howtos/themes.rst:80 msgid "**Main features:**" msgstr "" #: ../../content/developer/howtos/themes.rst:82 msgid "Basic layouts for pages, blog, eCommerce and much more" msgstr "" #: ../../content/developer/howtos/themes.rst:83 msgid "Website Builder integration" msgstr "" #: ../../content/developer/howtos/themes.rst:84 msgid "Basic Snippets" msgstr "" #: ../../content/developer/howtos/themes.rst:85 msgid "Automatic Sass compiling" msgstr "" #: ../../content/developer/howtos/themes.rst:86 msgid "Automatic Js and CSS minification and combination" msgstr "" #: ../../content/developer/howtos/themes.rst:90 msgid "**Main technologies:**" msgstr "" #: ../../content/developer/howtos/themes.rst:92 msgid "Twitter Bootstrap" msgstr "" #: ../../content/developer/howtos/themes.rst:93 msgid "jQuery" msgstr "" #: ../../content/developer/howtos/themes.rst:94 msgid "jQuery UI" msgstr "" #: ../../content/developer/howtos/themes.rst:95 msgid "underscore.js" msgstr "" #: ../../content/developer/howtos/themes.rst:98 msgid "Thinking \"modular\"" msgstr "" #: ../../content/developer/howtos/themes.rst:100 msgid "An Odoo theme is not a folder containing HTML or PHP files, it’s a modular framework written in XML. Never worked with XML files before? Don’t worry, after following the tutorial, you’ll be able to create your first theme with only basic knowledge of HTML." msgstr "" #: ../../content/developer/howtos/themes.rst:102 msgid "Using classical web design workflows, you usually code the layout of the entire page. The result of this is a “static” web page. You can update the content, of course, but your client will need you to work on making even basic changes." msgstr "" #: ../../content/developer/howtos/themes.rst:104 msgid "Creating themes for Odoo is a total change of perspective. Instead of defining the complete layout for a page, you can create blocks (snippets) and let the user choose where to “drag&drop” them, creating the page layout on their own. We call this modular design." msgstr "" #: ../../content/developer/howtos/themes.rst:107 msgid "Imagine an Odoo theme as a “list” of elements and options that you have to create or extend. As a designer, your goal is to style these elements in order to achieve a wonderful result, regardless of where the end user chooses to place them." msgstr "" #: ../../content/developer/howtos/themes.rst:110 msgid "Let’s take a tour of our “list” elements:" msgstr "" #: ../../content/developer/howtos/themes.rst:117 msgid "Snippets (or building-blocks)" msgstr "" #: ../../content/developer/howtos/themes.rst:119 msgid "A piece of HTML code. The user will drag&drop, modify and combine them using our built-in Website Builder interface. You can define sets of options and styles for each snippet. The user will choose from them according to their needs." msgstr "" #: ../../content/developer/howtos/themes.rst:124 msgid "Pages" msgstr "" #: ../../content/developer/howtos/themes.rst:126 msgid "These are normal web pages, except that they will be editable by the final user and that you can define an empty area that the user can “fill” by dragging snippets into it." msgstr "" #: ../../content/developer/howtos/themes.rst:137 msgid "Styles" msgstr "" #: ../../content/developer/howtos/themes.rst:139 msgid "Styles are defined using SCSS files (or you can use standard CSS files). You can define a style as **default** or **optional**. The default styles are always active in your theme, the optional styles can be enabled or disabled by the user." msgstr "" #: ../../content/developer/howtos/themes.rst:144 msgid "Functionalities" msgstr "" #: ../../content/developer/howtos/themes.rst:146 msgid "Thanks to Odoo’s modularity, everything can be personalized even more. This means there are endless possibilities for your creativity. Adding functionalities is easy and it’s simple to provide the end user with customizable options." msgstr "" #: ../../content/developer/howtos/themes.rst:150 msgid "Odoo's XML files, an overview" msgstr "" #: ../../content/developer/howtos/themes.rst:152 msgid "Any Odoo XML file starts with encoding specifications. After that, you have to write your code inside a ```` tag." msgstr "" #: ../../content/developer/howtos/themes.rst:165 msgid "Almost every element and option that you create has to be placed inside a ``