Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions content/developer/howtos.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Tutorials
.. toctree::
:titlesonly:

howtos/rdtraining
howtos/themes
howtos/website
howtos/backend
Expand Down
74 changes: 74 additions & 0 deletions content/developer/howtos/rdtraining.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
:show-content:

.. _howto/rdtraining:

===============
Getting Started
===============

Welcome to the Getting Started Odoo tutorial! If you reached this page that means you are
interested in the development of your own Odoo module. It might also mean that you recently
joined the Odoo company for a rather technical position. In any case, your journey to the
technical side of Odoo starts here.

This training is split in two parts. The first part is the 'Core Training': its objective is to
give you an insight of the most important parts of the Odoo development framework.
The chapters should be followed in their given order since they cover the development of a new
Odoo application from scratch in an incremental way. In other words, each chapter depends on the
previous one.

The second part covers a set of 'Advanced' topics. Each topic can be followed independently, but
requires the 'Core Training'. Note that some advanced topics cover basic features
of an Odoo module, so it's a good idea to give them a quick look.

All topics are built around a business case we will enhance along the way. The reader is expected
to actively take part in the training by writing the solution for each exercise.

Ready? Let's get started!

Core Training
=============

.. toctree::
:caption: Advanced Topics
:titlesonly:
:glob:

rdtraining/0*
rdtraining/1*

* :doc:`rdtraining/01_architecture`
* :doc:`rdtraining/02_setup`
* :doc:`rdtraining/03_newapp`
* :doc:`rdtraining/04_basicmodel`
* :doc:`rdtraining/05_securityintro`
* :doc:`rdtraining/06_firstui`
* :doc:`rdtraining/07_basicviews`
* :doc:`rdtraining/08_relations`
* :doc:`rdtraining/09_compute_onchange`
* :doc:`rdtraining/10_actions`
* :doc:`rdtraining/11_constraints`
* :doc:`rdtraining/12_sprinkles`
* :doc:`rdtraining/13_inheritance`
* :doc:`rdtraining/14_other_module`
* :doc:`rdtraining/15_qwebintro`
* :doc:`rdtraining/16_guidelines_pr`

Advanced topics
===============

.. toctree::
:caption: Advanced Topics
:titlesonly:

rdtraining/B_acl_irrules
rdtraining/C_data
rdtraining/E_unittest
rdtraining/J_reports
rdtraining/K_dashboard

* :doc:`rdtraining/B_acl_irrules`
* :doc:`rdtraining/C_data`
* :doc:`rdtraining/E_unittest`
* :doc:`rdtraining/J_reports`
* :doc:`rdtraining/K_dashboard`
131 changes: 131 additions & 0 deletions content/developer/howtos/rdtraining/01_architecture.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
.. _howto/rdtraining/01_architecture:

================================
Chapter 1: Architecture Overview
================================

Multitier application
=====================

Odoo follows a `multitier architecture`_, meaning that the presentation, the business
logic and the data storage are separated. More specifically, it uses a three-tier architecture
(image from Wikipedia):

.. image:: 01_architecture/media/three_tier.svg
:align: center
:alt: Three-tier architecture

The presentation tier is a combination of HTML5, JavaScript and CSS. The logic tier is exclusively
written in Python, while the data tier only supports PostgreSQL as an RDBMS.

Depending on the scope of your module, Odoo development can be done in any of these tiers.
Therefore, before going any further, it may be a good idea to refresh your memory if you don't have
an intermediate level in these topics.

In order to go through this tutorial, you will need a very basic knowledge of HTML and an intermediate
level of Python. Advanced topics will require more knowledge in the other subjects. There are
plenty of tutorials freely accessible, so we cannot recommend one over another since it depends
on your background.

For reference this is the official `Python tutorial`_.

Odoo modules
============

Both server and client extensions are packaged as *modules* which are
optionally loaded in a *database*. A module is a collection of functions and data that target a
single purpose.

Odoo modules can either add brand new business logic to an Odoo system or
alter and extend existing business logic. One module can be created to add your
country's accounting rules to Odoo's generic accounting support, while
a different module can add support for real-time visualisation of a bus fleet.

Everything in Odoo starts and ends with modules.

Terminology: developers group their business features in Odoo *modules*. The main user-facing
modules are flagged and exposed as *Apps*, but a majority of the modules aren't Apps. *Modules*
may also be referred to as *addons* and the directories where the Odoo server finds them
form the ``addons_path``.

Composition of a module
-----------------------

An Odoo module **can** contain a number of elements:

:ref:`Business objects <reference/orm>`
A business object (e.g. an invoice) is declared as a Python class. The fields defined in
these classes are automatically mapped to database columns thanks to the
:abbr:`ORM (Object-Relational Mapping)` layer.

:ref:`Object views <reference/views>`
Define UI display

:ref:`Data files <reference/data>`
XML or CSV files declaring the model data:

* :ref:`views <reference/views>` or :ref:`reports <reference/reports>`,
* configuration data (modules parametrization, :ref:`security rules <reference/security>`),
* demonstration data
* and more

:ref:`Web controllers <reference/controllers>`
Handle requests from web browsers

Static web data
Images, CSS or JavaScript files used by the web interface or website

None of these elements are mandatory. Some modules may only add data files (e.g. country-specific
accounting configuration), while others may only add business objects. During this training, we will
create business objects, object views and data files.
:ref:`Web controllers <howto/rdtraining/G_website>` and
:ref:`static web data <howto/rdtraining/I_jswidget>` are advanced topics.

Module structure
----------------

Each module is a directory within a *module directory*. Module directories
are specified by using the :option:`--addons-path <odoo-bin --addons-path>`
option.

An Odoo module is declared by its :ref:`manifest <reference/module/manifest>`.

When an Odoo module includes business objects (i.e. Python files), they are organized as a
`Python package <https://docs.python.org/3/tutorial/modules.html#packages>`_
with a ``__init__.py`` file. This file contains import instructions for various Python
files in the module.

Here is a simplified module directory:

.. code-block:: bash

module
├── models
│ ├── *.py
│ └── __init__.py
├── data
│ └── *.xml
├── __init__.py
└── __manifest__.py

Odoo Editions
=============

Odoo is available in `two versions`_: Odoo Enterprise (licensed & shared sources) and Odoo Community
(open-source). In addition to services such as support or upgrades, the Enterprise version provides extra
functionalities to Odoo. From a technical point-of-view, these functionalities are simply
new modules installed on top of the modules provided by the Community version.

Ready to start? Before writing actual code, let's go to the
:ref:`next chapter <howto/rdtraining/02_setup>` to review the Odoo installation process. Even if
Odoo is already running on your system, we strongly suggest you go through this chapter
to make sure we start on the same page during the development of our new application.

.. _multitier architecture:
https://en.wikipedia.org/wiki/Multitier_architecture

.. _Python tutorial:
https://docs.python.org/3.6/tutorial/

.. _two versions:
https://www.odoo.com/page/editions
Loading