Skip to content

Commit

Permalink
[IMP] studio: complete update of Studio
Browse files Browse the repository at this point in the history
The goal is to make the Studio users doc a sort of encyclopedia to accompany tutorials.
The doc isn't to explain the basics - or just briefly, as introductions - but instead to
give a full overview of all the available options.

Task: 2817981
  • Loading branch information
xpl-odoo committed Jul 27, 2022
1 parent 3c98434 commit 5091a71
Show file tree
Hide file tree
Showing 94 changed files with 1,375 additions and 596 deletions.
31 changes: 20 additions & 11 deletions content/applications/productivity/studio.rst
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
:nosearch:
:show-content:
:hide-page-toc:
:show-toc:

======
Studio
======

Learn all you need in order to build custom applications: customize views, create specific reports,
automate actions, define approval workflows, etc.

.. seealso::
- `Odoo Tutorials: Studio <https://www.odoo.com/slides/studio-31>`_

.. toctree::
:titlesonly:

studio/concepts
studio/use_cases
studio/how_to
studio/fields
studio/views
studio/models_modules_apps
studio/automated_actions

Studio is a toolbox that allows you to customize Odoo without coding knowledge. For example, you
can, on any app, add or modify:

- :doc:`Fields <studio/fields>`
- :doc:`Views <studio/views>`
- :doc:`Models <studio/models_modules_apps>`
- :doc:`Automated actions <studio/automated_actions>`
- PDF reports
- Approval rules
- Security rules

Or you can :doc:`build an app from scratch <studio/models_modules_apps>`.

.. seealso::
- `Odoo Tutorials: Studio <https://www.odoo.com/slides/studio-31>`_
249 changes: 249 additions & 0 deletions content/applications/productivity/studio/automated_actions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
===============================
Automated actions (automations)
===============================

Automated actions are used to trigger automatic changes based on user actions (e.g., apply a
modification when a field is set to a specific value) or on time conditions (e.g., archive a record
7 days after its last update).

To create an automated action with Studio, go to :guilabel:`Automations` from anywhere within
Studio.

For every automated action you create, the following elements should be defined: the
:ref:`studio/automated-actions/model`, the :ref:`studio/automated-actions/trigger`, the
:ref:`studio/automated-actions/apply-on`, and the :ref:`studio/automated-actions/action`.

.. example::

.. image:: automated_actions/automated-action-example.png
:align: center
:alt: Example of an automated action on the Subscription model

.. _studio/automated-actions/model:

Model
=====

Select the model where the automated action should be applied.

.. note::
The model you are on when you click on :guilabel:`Automations` is pre-selected by default.

.. _studio/automated-actions/trigger:

Trigger
=======

Define when the automated action should be applied. Six triggers are available.

.. _studio/automated-actions/trigger/on-creation:

On Creation
-----------

The action is triggered when a record is created and then saved.

.. _studio/automated-actions/trigger/on-update:

On Update
---------

The action is triggered when a previously saved record is edited and then saved.

- Use :guilabel:`Trigger Fields` to specify which fields - and only those - trigger the action on
their update.
- To detect when a record changes from one state to another, define a :guilabel:`Before Update
Domain` filter, which checks if the condition is satisfied before the record is updated. Then set
an :ref:`studio/automated-actions/apply-on` filter, which checks if the condition is met after the
record is updated.

.. example::
If you want the automated action to happen when an email address is set on a contact, define
the :guilabel:`Before Update Domain` to `Email is not set`, and the :guilabel:`Apply on`
domain to `Email is set`.

.. image:: automated_actions/on-update-trigger-example.png
:align: center
:alt: Example of an On Update trigger

.. _studio/automated-actions/trigger/on-creation-update:

On Creation & Update
--------------------

The action is triggered when a record is created and saved or edited afterward and saved.

.. _studio/automated-actions/trigger/on-deletion:

On Deletion
-----------

The action is triggered when a record is deleted.

.. note::
This trigger is rarely used, as archiving records is usually preferred to deletion.

.. _studio/automated-actions/trigger/form-modification:

Based on Form Modification
--------------------------

The action is triggered when any change is done to a trigger field's value on the :ref:`Form view
<studio/views/general/form>`, even before saving the record. This trigger only works on the user
interface when a modification is made by a user. If the field is changed through another action and
not by the user, the action will not run.

.. note::
This trigger can only be used with the :ref:`Execute Python Code action
<studio/automated-actions/action/python-code>`, so development is required.

.. _studio/automated-actions/trigger/timed-condition:

Based on Timed Condition
------------------------

The action is triggered when a trigger field's date or date & time value is reached.

- To trigger the action after the :guilabel:`Trigger Date`, add a number of minutes, hours, days, or
months under :guilabel:`Delay after trigger date`. To trigger the action before, add a negative
number instead.

.. example::
If you want to send a reminder email 30 minutes before the start of a calendar event, select
the :guilabel:`Start (Calendar Event)` under :guilabel:`Trigger Date` and set the
:guilabel:`Delay after trigger date` to **-30** :guilabel:`Minutes`.

.. image:: automated_actions/timed-condition-trigger-example.png
:align: center
:alt: Example of a Based on Timed Condition trigger

.. note::
By default, the scheduler checks for trigger dates every 4 hours.

.. _studio/automated-actions/apply-on:

Apply on
========

Define on which records of the model the automated action should be applied. It works the same way
as when you apply filters on a model.

.. _studio/automated-actions/action:

Action
======

Determine what the automated action should do (server action). There are eight types of action to
choose from.

.. _studio/automated-actions/action/python-code:

Execute Python Code
-------------------

The action is used to execute Python code. The available variables are described on the
:guilabel:`Python Code` tab, which is also used to write your code, or on the :guilabel:`Help` tab.

- To allow the action to be run through the website, tick :guilabel:`Available on the Website` and
add a :guilabel:`Website Path`.

.. _studio/automated-actions/action/new-record:

Create a new Record
-------------------

The action is used to create a new record on any model.

.. note::
Selecting a :guilabel:`Target Model` is only required if you want to target another model than
the one you are on.

- To link the record that triggered the creation of the new record, select a field under
:guilabel:`Link Field`. For example, you could create a contact automatically when a lead is
turned into an opportunity.
- :guilabel:`Data to Write` tab: the tab is used to specify the new record's values. After selecting
a :guilabel:`Field`, select its :guilabel:`Evaluation Type`:

- :guilabel:`Value`: used to directly give the field's raw value in the :guilabel:`Value` column.
- :guilabel:`Reference`: used to select the record under the :guilabel:`Record` column and let
Studio add the internal ID in the :guilabel:`Value` column.

.. example::
If an automated action creates a new task in a project, you can assign it to a specific user
by setting the :guilabel:`Field` to :guilabel:`Responsible User (Project)`, the
:guilabel:`Evaluation Type` to :guilabel:`Reference`, and the :guilabel:`Record` to a
specific user.

.. image:: automated_actions/new-record-example.png
:align: center
:alt: Example of a Create a new Record action

- :guilabel:`Python expression`: used to dynamically define the newly created record’s value for a
field using Python code in the :guilabel:`Value` column.

.. _studio/automated-actions/action/update-record:

Update the Record
-----------------

The action is used to set value(s) for field(s) of any record on the current model.

.. note::
The process to fill in the :guilabel:`Data to Write` tab is the same as described under
:ref:`studio/automated-actions/action/new-record`.

.. _studio/automated-actions/action/several-actions:

Execute several actions
-----------------------

The action is used to trigger multiple actions at the same time. To do so, click on :guilabel:`Add a
line` under the :guilabel:`Actions` tab. In the :guilabel:`Child Actions` pop-up, click on
:guilabel:`Create` and configure the action.

.. _studio/automated-actions/action/send-email:

Send Email
----------

The action is used to send an email to a contact linked to a specific record. To do so, select or
create an :guilabel:`Email Template`.

.. _studio/automated-actions/action/add-followers:

Add Followers
-------------

The action is used to subscribe existing contacts to the record.

.. _studio/automated-actions/action/next-activity:

Create Next Activity
--------------------

The action is used to schedule a new activity linked to the record. Use the :guilabel:`Activity` tab
to set it up as usual, but instead of the :guilabel:`Assigned to` field, select an
:guilabel:`Activity User Type`. Select :guilabel:`Specific User` and add the user under
:guilabel:`Responsible` if the activity should always be assigned to the same user. To dynamically
target a user linked to the record, select :guilabel:`Generic User From Record` instead and change
the :guilabel:`User field name` if necessary.

.. example::
After a lead is turned into an opportunity, you want your automated action to set up a call for
the user responsible for the lead. To do so, set the :guilabel:`Activity` to :guilabel:`Call`
and set the :guilabel:`Activity User Type` to :guilabel:`Generic User From Record`.

.. image:: automated_actions/next-activity-example.png
:align: center
:alt: Example of a Create Next Activity action

.. _studio/automated-actions/action/send-sms:

Send SMS Text Message
---------------------

The action is used to send an SMS to a contact linked to the record. To do so, select or create an
:guilabel:`SMS Template`.

.. tip::
If you want sent messages to be logged in the Chatter, tick :guilabel:`Log as Note`.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 0 additions & 11 deletions content/applications/productivity/studio/concepts.rst

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 5091a71

Please sign in to comment.