.. image:: https://odoo-community.org/readme-banner-image
   :target: https://odoo-community.org/get-involved?utm_source=readme
   :alt: Odoo Community Association

==============
Automation Oca
==============

.. 
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! This file is generated by oca-gen-addon-readme !!
   !! changes will be overwritten.                   !!
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! source digest: sha256:bf7f94a060a16c6d36248bb970d9cbc5925480da1127a49bfb77208b1a1821e5
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
    :target: https://odoo-community.org/page/development-status
    :alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
    :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
    :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fautomation-lightgray.png?logo=github
    :target: https://github.com/OCA/automation/tree/16.0/automation_oca
    :alt: OCA/automation
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
    :target: https://translation.odoo-community.org/projects/automation-16-0/automation-16-0-automation_oca
    :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
    :target: https://runboat.odoo-community.org/builds?repo=OCA/automation&target_branch=16.0
    :alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows to automate several process according to some rules.

This is useful for creating automated actions on your database like:

- Send a welcome email to all new partners (or filtered according to
  some rules)
- Remember to online customers that they forgot their basket with some
  items
- Send documents to sign to all new employees

**Table of contents**

.. contents::
   :local:

Usage
=====

Configure your processes
------------------------

1.  Access the ``Automation`` menu.
2.  Create a new Automation Configuration.
3.  Set the model and domains.
4.  Go to Configuration -> Filters to create filters as a preconfigured
    domains. Filters can be established in the proper field in the
    Automation Configuration record.
5.  Create the different steps by clicking the "ADD" button inside the
    automation configuration form.
6.  Create child steps by clicking the "Add child activity" at the
    bottom of a created step.
7.  
8.  Select the kind of configuration you create. You can choose between:

    - *Periodic configurations*: every 6 hours, a process will check if
      new records need to be created.
    - *On demand configurations*: user need to execute manually the job.

9.  Press ``Start``.
10. Inside the process, you can check all the created items.

|Configuration Screenshot|

Configuration of steps
----------------------

Steps can trigger one of the following options:

- ``Mail``: Sends an email using a template.
- ``Server Action``: Executes a server action.
- ``Activity``: Creates an activity to the related record.

All the steps need to specify the moment of execution. We will set the
number of hours/days and a trigger type:

- ``Start of workflow``: It will be executed at the
  previously-configured time after we create the record.
- ``Execution of another step``: It will be executed at the
  previously-configured time after the previous step is finished
  properly.
- ``Mail opened``: It will be executed at the previously-configured time
  after the mail from the previous step is opened.
- ``Mail not opened``: It will be executed at the previously-configured
  time after the mail from the previous step is sent if it is not opened
  before this time.
- ``Mail replied``: It will be executed at the previously-configured
  time after the mail from the previous step is replied.
- ``Mail not replied``: It will be executed at the previously-configured
  time after the mail from the previous step is opened if it has not
  been replied.
- ``Mail clicked``: It will be executed at the previously-configured
  time after the links of the mail from the previous step are clicked.
- ``Mail not clicked``: It will be executed at the previously-configured
  time after the mail from the previous step is opened and no links are
  clicked.
- ``Mail bounced``: It will be executed at the previously-configured
  time after the mail from the previous step is bounced back for any
  reason.
- ``Activity has been finished``: It will be executed at the
  previously-configured time after the activity from the previous action
  is done.
- ``Activity has not been finished``: It will be executed at the
  previously-configured time after the previous action is executed if
  the related activity is not done.

Important to remember to define a proper template when sending the
email. It will the template without using a notification template. Also,
it is important to define correctly the text partner or email to field
on the template

Records creation
----------------

Records are created using a cron action. This action is executed every 6
hours by default.

Step execution
--------------

Steps are executed using a cron action. This action is executed every
hour by default. On the record view, you can execute manually an action.

There is a way to enforce step execution when finalize the previous one.
If we set a negative value on the period, the execution will be
immediate without a cron.

.. |Configuration Screenshot| image:: https://raw.githubusercontent.com/OCA/automation/16.0/automation_oca/static/description/configuration.png

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/automation/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/automation/issues/new?body=module:%20automation_oca%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Dixmit

Contributors
------------

- Enric Tobella (`Dixmit <https://www.dixmit.com/>`__)

Other credits
-------------

The development of this module has been financially supported by:

- Associacion Española de Odoo (`AEODOO <https://www.aeodoo.org/>`__)

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
   :alt: Odoo Community Association
   :target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/automation <https://github.com/OCA/automation/tree/16.0/automation_oca>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
