[ADD] studio: documentation (#657)

This commit is contained in:
KBR
2020-06-11 17:33:48 +02:00
committed by GitHub
parent c41ea1724f
commit 1adc335a7c
37 changed files with 462 additions and 1 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

@@ -0,0 +1,80 @@
===============================
Understanding Automated Actions
===============================
| Automated actions are used to trigger actions. They are based on conditions and happen on top of
Odoos default business logic.
| Examples of automated actions include: creating a next activity upon a quote's confirmation;
adding a user as a follower of a confirmed invoice if its total is higher than a
certain amount; or preventing a lead from changing stage if a field is not filled in.
.. image:: media/automated_action_flow.png
:align: center
:height: 270
:alt: Flowchart to exemplify an automated action rule for Odoo Studio
| Let's understand how to properly define *when* an automated action runs and *how* to create one:
| The first step is to choose the :doc:`Model <understanding_general>` on which the action is
applied.
| The **Trigger** field defines the event that causes the automated action to happen:
- *On Creation*: when a new record is created. Note that the record is created once saved for the
first time.
- *On Update*: when the record is updated. Note that the update happens once the record is saved.
- *On Creation & Update*: on the creation and/or on the update of a record once the form is saved.
- *On Deletion*: on the removal of a record under the condition set.
- *Based on Form Modification*: when the value of the specified *Trigger* field is changed in the
interface (user sees the changes before saving the record). Note that this action can only be used
with the *Execute Python Code* action type.
- *Based on Timed Condition*: a delay happens after a specific date/time. Set a *Delay after trigger
date* if you need a delay to happen before the *Trigger Date*. Example: to send a reminder 15min
before a meeting. If the date/time is not set on the form of the model chosen, the date/time
considered is the one of the creation/update of the record.
For every Trigger option, **conditions** can be applied, such as:
- *Before Update Domain*: if designated, this condition must be satisfied before the record is
updated.
- *Apply on*: if designated, this condition must be satisfied before executing the action rule
(*Action To Do*), and after the update.
| The **Active** option is to be turned off when the rule should be hidden and not executed.
| Under **Action To Do** choose the type of server action that must be executed once records meet
the *Trigger* conditions:
- *Execute Python Code*: a block of code is executed. A *Help* tab with the variables that can be
used is available.
- *Create New Record*: a new record with new values is created.
- *Update a Record*: updates the record that triggered the action.
- *Execute several actions*: defines an action that triggers other server actions.
- *Send Email*: an automatic :doc:`email <../../discuss/advanced/emailtemplate>` is sent.
- *Add Followers*: :doc:`followers <../../project/tasks/collaborate>` are notified of changes in
the task.
- *Create Next Activity*: creates an activity such as: *Call*, *Email*, *Reminder*.
- *Send SMS Text Message*: sends an :doc:`SMS <../../sms_marketing/pricing/pricing_and_faq>`.
Example
~~~~~~~
This is the process of which the update of the *Email* field on the Lead/Opportunity *Model*, with a
*Trigger Condition* set to *On Update*, goes through:
.. image:: media/action_update_lead_example.png
:align: center
:alt: View of an automated action being created in Odoo Studio
#. The user creates the record without an email address set.
#. The user updates the record defining an email address.
#. Once the change is saved, the automation checks if any of the *Watched Fields* are being updated
(for the example: field name *email_from* (Email).
#. If true, it checks if the record matches the *Before Update Domain* (for the example: *email
is not set*).
#. If true, it checks (*after the update*) whether the record matches the *Apply on* domain (for the
example: *email is set*).
#. If true, the chosen *Action To Do* is performed on the record.
.. seealso::
- :doc:`understanding_general`
- :doc:`../use_cases/automated_actions`
+95
View File
@@ -0,0 +1,95 @@
==============================
Understanding General Concepts
==============================
| Odoo Studio is a toolbox that allows you to add models or adapt functionalities on top of Odoos
standard behavior without coding knowledge. You can also create custom views and modify existing
ones without having to get into the XML code.
| Even for experienced developers, typing out code requires time. By using Odoo Studio, you can
quickly get your models up and going and focus on the crucial parts of your application. The
result is a user-friendly solution that makes customizations and designing new applications easy
with or without programming skills.
Getting started
===============
One you start using Odoo Studio, you automatically create a new *module* that contains all your
modifications. These modifications can be done on existing screens (*views*), by adding new
*fields* in existing applications, or by creating an entirely new *model*.
What is a Module?
-----------------
| An Odoo **Module** can contain a number of elements, such as: business objects (models), object
views, data files, web controllers, and static web data. An application is a collection of modules.
| In object-oriented programming, models usually represent a concept from the real world.
Example: Odoo has models for Sales Orders, Users, Countries, etc. If you were to build an
application to manage Real Estate sales, a model that represents the Properties for sale would
probably be your first step.
.. image:: media/new_app.png
:align: center
:alt: Overview of the main dashboard emphasizing the option to create a new app in Odoo Studio
.. _studio/concepts/understanding_general/models:
What is a Model (also called Object)?
-------------------------------------
A **Model** determines the logical structure of a database and fundamentally determines in which
manner data can be stored, organized, and manipulated. In other words, a model is a table of
information that can be bridged with other tables.
What are Fields?
----------------
| **Fields** compose models. It is where a record (a piece of data) is registered.
| Example: on the Real Estate application, fields on the Properties model would include
the price, address, a picture, a link to the current owner, etc.
| There are 2 main types of fields in Odoo: *basic (or scalar) fields* and *relational fields*.
| Basic fields represent simple values, like numbers or text. Relational fields represent relations
between models. So, if you have a model for *Customers* and another one for *Properties*, you
would use a relational field to link each Property to its Customer.
Relational Fields in detail
~~~~~~~~~~~~~~~~~~~~~~~~~~~
| **Relational Fields** provide the option to link the data of one model with the data of another
model.
| In Odoo, relational field types are: *One2many*, *Many2one*, *Many2many*.
.. image:: media/relational_fields.png
:align: center
:alt: Tables with a visual explanation of related fields for Odoo Studio
| An **One2many** field is a *one-way* direction of selecting *multiple* records from a table.
| Example: a Sales Order can contain multiple Sales Order Lines, which also contain multiple fields
of information.
| A **Many2one** field is a *one-way* direction of selecting *one* record from a table.
| Example: you can have many product categories, but each product can only belong to one category.
| A **Many2many** field is a *two-way* direction of selecting records from a table.
| Example: multiple tags can be added to a leads form.
.. note::
An *One2many* field must have a *Many2one* related to it.
What are Views?
---------------
**Views** define how records are displayed. They are specified in XML which means that they can be
edited independently from the models that they represent. There are various types of views in Odoo,
and each of them represents a mode of visualization. Some examples are: *form*, *list*, *kanban*.
What is a Menu?
---------------
A **Menu** is a button that executes and action. In Odoo Studio, to create menus (models) and
rearrange their hierarchy, click on *Edit Menu*.
.. image:: media/edit_menu.png
:align: center
:alt: Overview of a menu being edit in Odoo Studio
.. seealso::
- `Studio Basics <https://www.odoo.com/fr_FR/slides/studio-31>`_