[MOV] tutorials/getting_started/*: promote advanced chapters to independent tutorials
task-2991663
X-original-commit: a8c78a80ba
Part-of: odoo/documentation#3660
@ -9,6 +9,12 @@ Tutorials
|
|||||||
:titlesonly:
|
:titlesonly:
|
||||||
|
|
||||||
tutorials/getting_started
|
tutorials/getting_started
|
||||||
|
tutorials/define_module_data
|
||||||
|
tutorials/restrict_data_access
|
||||||
|
tutorials/unit_tests
|
||||||
|
tutorials/mixins
|
||||||
|
tutorials/pdf_reports
|
||||||
|
tutorials/dashboards
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
|
|
||||||
@ -20,9 +26,9 @@ Tutorials
|
|||||||
<div class="card-body pb-0">
|
<div class="card-body pb-0">
|
||||||
<h4 class="card-title text-primary mb-1">Getting started</h4>
|
<h4 class="card-title text-primary mb-1">Getting started</h4>
|
||||||
<p class="card-text text-dark fw-normal">
|
<p class="card-text text-dark fw-normal">
|
||||||
Learn how to develop your own module with the Odoo framework. This
|
Develop your own module with the Odoo framework. This step-by-step tutorial
|
||||||
step-by-step tutorial is crafted for newcomers and any other individual
|
is crafted for newcomers and any other individual curious about Odoo
|
||||||
curious about Odoo development.
|
development.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer border-0">
|
<div class="card-footer border-0">
|
||||||
@ -31,4 +37,87 @@ Tutorials
|
|||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
<a class="o_toctree_card col" href="tutorials/define_module_data.html">
|
||||||
|
<div class="card h-100">
|
||||||
|
<div class="card-body pb-0">
|
||||||
|
<h4 class="card-title text-primary mb-1">Define module data</h4>
|
||||||
|
<p class="card-text text-dark fw-normal">
|
||||||
|
Define master and demo data for an Odoo module, leveraging the strengths of
|
||||||
|
the CSV and XML file formats to accommodate specific data requirements.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer border-0">
|
||||||
|
<span class="badge rounded-pill bg-dark mt-auto mb-2">Beginner</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a class="o_toctree_card col" href="tutorials/restrict_data_access.html">
|
||||||
|
<div class="card h-100">
|
||||||
|
<div class="card-body pb-0">
|
||||||
|
<h4 class="card-title text-primary mb-1">Restrict access to data</h4>
|
||||||
|
<p class="card-text text-dark fw-normal">
|
||||||
|
Implement security measures to restrict access to sensitive data with the
|
||||||
|
help of groups, access rights, and record rules.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer border-0">
|
||||||
|
<span class="badge rounded-pill bg-dark mt-auto mb-2">Beginner</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a class="o_toctree_card col" href="tutorials/unit_tests.html">
|
||||||
|
<div class="card h-100">
|
||||||
|
<div class="card-body pb-0">
|
||||||
|
<h4 class="card-title text-primary mb-1">Safeguard your code with unit tests</h4>
|
||||||
|
<p class="card-text text-dark fw-normal">
|
||||||
|
Write effective unit tests in Python to ensure the resilience of your code
|
||||||
|
and safeguard it against unexpected behaviors and regressions.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer border-0">
|
||||||
|
<span class="badge rounded-pill bg-dark mt-auto mb-2">Beginner</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a class="o_toctree_card col" href="tutorials/mixins.html">
|
||||||
|
<div class="card h-100">
|
||||||
|
<div class="card-body pb-0">
|
||||||
|
<h4 class="card-title text-primary mb-1">Reuse code with mixins</h4>
|
||||||
|
<p class="card-text text-dark fw-normal">
|
||||||
|
Create mixins to code features once and reuse them in multiple models.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer border-0"></div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a class="o_toctree_card col" href="tutorials/pdf_reports.html">
|
||||||
|
<div class="card h-100">
|
||||||
|
<div class="card-body pb-0">
|
||||||
|
<h4 class="card-title text-primary mb-1">Build PDF reports</h4>
|
||||||
|
<p class="card-text text-dark fw-normal">
|
||||||
|
Use QWeb, Odoo's powerful templating engine, to create custom PDF reports for
|
||||||
|
your documents.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer border-0"></div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a class="o_toctree_card col" href="tutorials/dashboards.html">
|
||||||
|
<div class="card h-100">
|
||||||
|
<div class="card-body pb-0">
|
||||||
|
<h4 class="card-title text-primary mb-1">Visualize data in dashboards</h4>
|
||||||
|
<p class="card-text text-dark fw-normal">
|
||||||
|
Create data visualization dashboards using the enterprise edition "Dashboard"
|
||||||
|
view and so-called "SQL views".
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer border-0"></div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,19 +1,13 @@
|
|||||||
.. _tutorials/getting_started/K_dashboard:
|
============================
|
||||||
|
Visualize data in dashboards
|
||||||
|
============================
|
||||||
|
|
||||||
======================
|
.. important::
|
||||||
Advanced K: Dashboards
|
This tutorial is an extension of the :doc:`getting_started` tutorial. Make sure you have
|
||||||
======================
|
completed it and use the `estate` module you have built as a base for the exercises in this
|
||||||
|
tutorial. Fetch the branch `{BRANCH}-core` from the `technical-training-solutions
|
||||||
.. warning::
|
<https://github.com/odoo/technical-training-solutions/tree/{BRANCH}-core>`_ repository if you
|
||||||
|
want to start from a clean base.
|
||||||
This tutorial assumes you have completed the :ref:`Core Training <tutorials/getting_started>`
|
|
||||||
and have access to Odoo Enterprise features.
|
|
||||||
|
|
||||||
To follow the exercise, it is recommended that you fetch the branch
|
|
||||||
{BRANCH}-core from the `technical training solutions
|
|
||||||
<https://github.com/odoo/technical-training-solutions/tree/{BRANCH}-core>`_ repository. It
|
|
||||||
contains a version of the module created during the core training we can use as a starting
|
|
||||||
point.
|
|
||||||
|
|
||||||
The term "Dashboard" is used in Odoo for objects that display data, but involves different
|
The term "Dashboard" is used in Odoo for objects that display data, but involves different
|
||||||
implementations. This tutorial will only focus on the Enterprise view that is used to provide
|
implementations. This tutorial will only focus on the Enterprise view that is used to provide
|
||||||
@ -56,8 +50,8 @@ is also common to include "report" in the name of the SQL view's files. You may
|
|||||||
wondering why do we put the files in a report directory? We saw earlier that the dashboard is
|
wondering why do we put the files in a report directory? We saw earlier that the dashboard is
|
||||||
for data visualization, therefore it is not editable. You can think of dashboards as interactive
|
for data visualization, therefore it is not editable. You can think of dashboards as interactive
|
||||||
reports where you can click on statistics, graphs, and charts to see the specific data contributing
|
reports where you can click on statistics, graphs, and charts to see the specific data contributing
|
||||||
to them. Note it is also standard to store the xml code for
|
to them. Note it is also standard to store the xml code for :doc:`PDF report templates
|
||||||
:ref:`PDF report templates <tutorials/getting_started/J_reports>` in the report directory.
|
<pdf_reports>` in the report directory.
|
||||||
|
|
||||||
It is expected that your work tree will look something like:
|
It is expected that your work tree will look something like:
|
||||||
|
|
||||||
@ -87,7 +81,7 @@ Dashboard View
|
|||||||
**Goal**: at the end of this section, we will have a new dashboard view that displays
|
**Goal**: at the end of this section, we will have a new dashboard view that displays
|
||||||
different property statistics.
|
different property statistics.
|
||||||
|
|
||||||
.. image:: K_dashboard/simple_dashboard.png
|
.. image:: dashboards/simple_dashboard.png
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Basic Dashboard view
|
:alt: Basic Dashboard view
|
||||||
|
|
||||||
@ -117,8 +111,8 @@ minimum, and maximum statistics, therefore a good representation set for our das
|
|||||||
|
|
||||||
If you don't have a set of data like this already, you can either:
|
If you don't have a set of data like this already, you can either:
|
||||||
|
|
||||||
* Complete :ref:`tutorials/getting_started/C_data` (if you haven't done so already) and add the
|
* Complete :doc:`define_module_data` (if you haven't done so already) and add the extra cases to
|
||||||
extra cases to your demo data (you may need to create a new database to load in the demo data).
|
your demo data (you may need to create a new database to load in the demo data).
|
||||||
* Manually create the data in your database.
|
* Manually create the data in your database.
|
||||||
* Copy this `data file
|
* Copy this `data file
|
||||||
<https://github.com/odoo/technical-training-solutions/blob/{BRANCH}-K_dashboard/estate/data/estate_demo.xml>`_
|
<https://github.com/odoo/technical-training-solutions/blob/{BRANCH}-K_dashboard/estate/data/estate_demo.xml>`_
|
||||||
@ -199,9 +193,7 @@ Subviews
|
|||||||
Similar to how we can use the list view within the form view (we saw this automatically happen for
|
Similar to how we can use the list view within the form view (we saw this automatically happen for
|
||||||
One2many relationships in :ref:`tutorials/getting_started/08_relations`), we can add other views
|
One2many relationships in :ref:`tutorials/getting_started/08_relations`), we can add other views
|
||||||
within our dashboard view. The most commonly added are the pivot and graph views, but the cohort
|
within our dashboard view. The most commonly added are the pivot and graph views, but the cohort
|
||||||
view is also an option. These views are covered in more depth in
|
view is also an option. A dashboard with only subviews is:
|
||||||
:ref:`tutorials/getting_started/H_adv_views`. For this topic, you are only required to know their
|
|
||||||
names. A dashboard with only subviews is:
|
|
||||||
|
|
||||||
.. code-block:: xml
|
.. code-block:: xml
|
||||||
|
|
||||||
@ -240,7 +232,7 @@ SQL Views
|
|||||||
**Goal**: at the end of this section, we will have a new SQL view that displays different
|
**Goal**: at the end of this section, we will have a new SQL view that displays different
|
||||||
property statistics.
|
property statistics.
|
||||||
|
|
||||||
.. image:: K_dashboard/report_dashboard.png
|
.. image:: dashboards/report_dashboard.png
|
||||||
:align: center
|
:align: center
|
||||||
:alt: SQL view
|
:alt: SQL view
|
||||||
|
|
||||||
@ -350,7 +342,7 @@ are still looking at all the offers per property, so any property with more than
|
|||||||
counted per offer. This example is easily double-checked by clicking on the pie chart to see its
|
counted per offer. This example is easily double-checked by clicking on the pie chart to see its
|
||||||
list view:
|
list view:
|
||||||
|
|
||||||
.. image:: K_dashboard/report_list_detail.png
|
.. image:: dashboards/report_list_detail.png
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Pie chart list view
|
:alt: Pie chart list view
|
||||||
|
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
@ -1,14 +1,13 @@
|
|||||||
.. _tutorials/getting_started/C_data:
|
==================
|
||||||
|
Define module data
|
||||||
|
==================
|
||||||
|
|
||||||
================================
|
.. important::
|
||||||
Advanced C: Master and Demo Data
|
This tutorial is an extension of the :doc:`getting_started` tutorial. Make sure you have
|
||||||
================================
|
completed it and use the `estate` module you have built as a base for the exercises in this
|
||||||
|
tutorial. Fetch the branch `{BRANCH}-core` from the `technical-training-solutions
|
||||||
.. tip:: This tutorial assumes you followed the Core Training.
|
<https://github.com/odoo/technical-training-solutions/tree/{BRANCH}-core>`_ repository if you
|
||||||
|
want to start from a clean base.
|
||||||
To do the exercise, fetch the branch {BRANCH}-core from the `technical training solutions
|
|
||||||
<https://github.com/odoo/technical-training-solutions/tree/{BRANCH}-core>`_ repository. It
|
|
||||||
contains a basic module we will use as a starting point
|
|
||||||
|
|
||||||
Data Types
|
Data Types
|
||||||
==========
|
==========
|
||||||
@ -20,8 +19,7 @@ Master data is usually part of the technical or business requirements for the mo
|
|||||||
words, such data is often necessary for the module to work properly. This data will always be
|
words, such data is often necessary for the module to work properly. This data will always be
|
||||||
installed when installing the module.
|
installed when installing the module.
|
||||||
|
|
||||||
We already met technical data previously since we have defined
|
We already met technical data previously since we have defined :ref:`views <reference/views>` and
|
||||||
:ref:`security rules <tutorials/getting_started/N_security>`, :ref:`views<reference/views>` and
|
|
||||||
:ref:`actions <reference/actions>`. Those are one kind of master data.
|
:ref:`actions <reference/actions>`. Those are one kind of master data.
|
||||||
|
|
||||||
On top of technical data, business data can be defined, e.g. countries, currencies, units of measure,
|
On top of technical data, business data can be defined, e.g. countries, currencies, units of measure,
|
@ -6,45 +6,29 @@
|
|||||||
Getting started
|
Getting started
|
||||||
===============
|
===============
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:titlesonly:
|
||||||
|
:glob:
|
||||||
|
|
||||||
|
getting_started/*
|
||||||
|
|
||||||
Welcome to the Getting Started Odoo tutorial! If you reached this page that means you are
|
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
|
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
|
joined the Odoo company for a rather technical position. In any case, your journey to the
|
||||||
technical side of Odoo starts here.
|
technical side of Odoo starts here.
|
||||||
|
|
||||||
This training is split in two parts:
|
The goal of this tutorial is for you to get an insight of the most important parts of the Odoo
|
||||||
|
development framework while developing your own Odoo module to manage real estate assets. The
|
||||||
- The first part is the :ref:`core training <tutorials/getting_started/core_training>`. Its
|
chapters should be followed in their given order since they cover the development of a new Odoo
|
||||||
objective is to give you an insight of the most important parts of the Odoo development framework.
|
application from scratch in an incremental way. In other words, each chapter depends on the previous
|
||||||
The chapters should be followed in their given order since they cover the development of a new
|
one.
|
||||||
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 :ref:`advanced topics
|
|
||||||
<tutorials/getting_started/advanced_topics>`. Each topic can be followed independently, but
|
|
||||||
requires the :ref:`core training <tutorials/getting_started/core_training>`.
|
|
||||||
|
|
||||||
.. attention::
|
.. attention::
|
||||||
Are you following this training as part of your technical onboarding as an Odoo employee? Then,
|
Are you following this tutorial as part of your technical onboarding as an Odoo employee? Then,
|
||||||
we ask you to complete the first part of the training before joining your new team and the second
|
we ask you to complete all the chapters before joining your new team.
|
||||||
part the month after.
|
|
||||||
|
|
||||||
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!
|
Ready? Let's get started!
|
||||||
|
|
||||||
.. _tutorials/getting_started/core_training:
|
|
||||||
|
|
||||||
Core training
|
|
||||||
=============
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
:caption: Advanced Topics
|
|
||||||
:titlesonly:
|
|
||||||
:glob:
|
|
||||||
|
|
||||||
getting_started/0*
|
|
||||||
getting_started/1*
|
|
||||||
|
|
||||||
* :doc:`getting_started/01_architecture`
|
* :doc:`getting_started/01_architecture`
|
||||||
* :doc:`getting_started/02_setup`
|
* :doc:`getting_started/02_setup`
|
||||||
* :doc:`getting_started/03_newapp`
|
* :doc:`getting_started/03_newapp`
|
||||||
@ -61,28 +45,3 @@ Core training
|
|||||||
* :doc:`getting_started/14_other_module`
|
* :doc:`getting_started/14_other_module`
|
||||||
* :doc:`getting_started/15_qwebintro`
|
* :doc:`getting_started/15_qwebintro`
|
||||||
* :doc:`getting_started/16_guidelines_pr`
|
* :doc:`getting_started/16_guidelines_pr`
|
||||||
|
|
||||||
.. _tutorials/getting_started/advanced_topics:
|
|
||||||
|
|
||||||
Advanced topics
|
|
||||||
===============
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
:caption: Advanced Topics
|
|
||||||
:titlesonly:
|
|
||||||
|
|
||||||
getting_started/B_acl_irrules
|
|
||||||
getting_started/C_data
|
|
||||||
getting_started/D_mixins
|
|
||||||
getting_started/E_unittest
|
|
||||||
getting_started/J_reports
|
|
||||||
getting_started/K_dashboard
|
|
||||||
getting_started/N_security
|
|
||||||
|
|
||||||
* :doc:`getting_started/B_acl_irrules`
|
|
||||||
* :doc:`getting_started/C_data`
|
|
||||||
* :doc:`getting_started/D_mixins`
|
|
||||||
* :doc:`getting_started/E_unittest`
|
|
||||||
* :doc:`getting_started/J_reports`
|
|
||||||
* :doc:`getting_started/K_dashboard`
|
|
||||||
* :doc:`getting_started/N_security`
|
|
||||||
|
@ -84,8 +84,6 @@ Static web data
|
|||||||
None of these elements are mandatory. Some modules may only add data files (e.g. country-specific
|
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
|
accounting configuration), while others may only add business objects. During this training, we will
|
||||||
create business objects, object views and data files.
|
create business objects, object views and data files.
|
||||||
:ref:`Web controllers <tutorials/getting_started/G_website>` and
|
|
||||||
:ref:`static web data <tutorials/getting_started/I_jswidget>` are advanced topics.
|
|
||||||
|
|
||||||
Module structure
|
Module structure
|
||||||
----------------
|
----------------
|
||||||
|
@ -9,8 +9,8 @@ intended to store business data. In a business application such as Odoo, one of
|
|||||||
to consider is who\ [#who]_ can access the data. Odoo provides a security mechanism to allow access
|
to consider is who\ [#who]_ can access the data. Odoo provides a security mechanism to allow access
|
||||||
to the data for specific groups of users.
|
to the data for specific groups of users.
|
||||||
|
|
||||||
The topic of security is covered in more detail in :ref:`tutorials/getting_started/B_acl_irrules`.
|
The topic of security is covered in more detail in :doc:`../restrict_data_access`. This chapter aims
|
||||||
This chapter aims to cover the minimum required for our new module.
|
to cover the minimum required for our new module.
|
||||||
|
|
||||||
Data Files (CSV)
|
Data Files (CSV)
|
||||||
================
|
================
|
||||||
@ -105,9 +105,7 @@ Here is an example for our previous ``test.model``:
|
|||||||
- ``model_id/id`` refers to the model which the access right applies to. The standard way to refer
|
- ``model_id/id`` refers to the model which the access right applies to. The standard way to refer
|
||||||
to the model is ``model_<model_name>``, where ``<model_name>`` is the ``_name`` of the model
|
to the model is ``model_<model_name>``, where ``<model_name>`` is the ``_name`` of the model
|
||||||
with the ``.`` replaced by ``_``. Seems cumbersome? Indeed it is...
|
with the ``.`` replaced by ``_``. Seems cumbersome? Indeed it is...
|
||||||
- ``group_id/id`` refers to the group which the access right applies to. We will cover the concept
|
- ``group_id/id`` refers to the group which the access right applies to.
|
||||||
of groups in the :ref:`advanced topic <tutorials/getting_started/N_security>` dedicated to the
|
|
||||||
security.
|
|
||||||
- ``perm_read,perm_write,perm_create,perm_unlink``: read, write, create and unlink permissions
|
- ``perm_read,perm_write,perm_create,perm_unlink``: read, write, create and unlink permissions
|
||||||
|
|
||||||
.. exercise:: Add access rights.
|
.. exercise:: Add access rights.
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
:orphan:
|
|
||||||
|
|
||||||
.. _tutorials/getting_started/A_i18n:
|
|
||||||
|
|
||||||
================================
|
|
||||||
Advanced A: Internationalization
|
|
||||||
================================
|
|
||||||
|
|
||||||
Hopefully, this topic will be written soon :-)
|
|
@ -1,9 +0,0 @@
|
|||||||
:orphan:
|
|
||||||
|
|
||||||
.. _tutorials/getting_started/F_jstour:
|
|
||||||
|
|
||||||
====================
|
|
||||||
Advanced F: JS Tours
|
|
||||||
====================
|
|
||||||
|
|
||||||
Hopefully, this topic will be written soon :-)
|
|
@ -1,9 +0,0 @@
|
|||||||
:orphan:
|
|
||||||
|
|
||||||
.. _tutorials/getting_started/G_website:
|
|
||||||
|
|
||||||
=================================
|
|
||||||
Advanced G: Controllers & Website
|
|
||||||
=================================
|
|
||||||
|
|
||||||
Hopefully, this topic will be written soon :-)
|
|
@ -1,9 +0,0 @@
|
|||||||
:orphan:
|
|
||||||
|
|
||||||
.. _tutorials/getting_started/H_adv_views:
|
|
||||||
|
|
||||||
==========================
|
|
||||||
Advanced H: Advanced Views
|
|
||||||
==========================
|
|
||||||
|
|
||||||
Hopefully, this topic will be written soon :-)
|
|
@ -1,9 +0,0 @@
|
|||||||
:orphan:
|
|
||||||
|
|
||||||
.. _tutorials/getting_started/I_jswidget:
|
|
||||||
|
|
||||||
============================
|
|
||||||
Advanced I: Custom JS Widget
|
|
||||||
============================
|
|
||||||
|
|
||||||
Hopefully, this topic will be written soon :-)
|
|
@ -1,9 +0,0 @@
|
|||||||
:orphan:
|
|
||||||
|
|
||||||
.. _tutorials/getting_started/L_cron:
|
|
||||||
|
|
||||||
======================================
|
|
||||||
Advanced L: Scheduled & Server Actions
|
|
||||||
======================================
|
|
||||||
|
|
||||||
Hopefully, this topic will be written soon :-)
|
|
@ -1,9 +0,0 @@
|
|||||||
:orphan:
|
|
||||||
|
|
||||||
.. _tutorials/getting_started/M_migration:
|
|
||||||
|
|
||||||
======================
|
|
||||||
Advanced M: Migrations
|
|
||||||
======================
|
|
||||||
|
|
||||||
Hopefully, this topic will be written soon :-)
|
|
@ -1,27 +0,0 @@
|
|||||||
.. _tutorials/getting_started/N_security:
|
|
||||||
|
|
||||||
====================
|
|
||||||
Advanced N: Security
|
|
||||||
====================
|
|
||||||
|
|
||||||
Every day we hear about data leaks and attacks in the newspapers.
|
|
||||||
We expect you to be aware and careful about how to avoid security breaches in your future
|
|
||||||
developments.
|
|
||||||
|
|
||||||
You already defined new models in your training. Did you check the access rights and define record
|
|
||||||
rules on it ? Are you sure your module is not an open door to SQL injections ? Did you use getattr
|
|
||||||
or t-raw in your code?
|
|
||||||
|
|
||||||
- No or wrong access rules on models.
|
|
||||||
- Introduction of public methods that should actually be private.
|
|
||||||
- Wrong manipulation of access tokens.
|
|
||||||
- No or wrong `ir.rules` (restriction rules) on models.
|
|
||||||
- Introduction of SQL injections.
|
|
||||||
- etc.
|
|
||||||
|
|
||||||
Please check this `presentation from Olivier Dony (odo)
|
|
||||||
<https://docs.google.com/presentation/d/1oDINxPtHWz31V8-2W0h2u2ubaKgz9lmbyfx9DJI4lTw/edit>`_ about
|
|
||||||
common mistakes that you should **absolutely** avoid in your future developments.
|
|
||||||
Also, please always use this `security checklist
|
|
||||||
<https://docs.google.com/presentation/d/1oDINxPtHWz31V8-2W0h2u2ubaKgz9lmbyfx9DJI4lTw/edit#slide=id.g2faad955b1_0_6>`_
|
|
||||||
to double-check your development and avoid further embarrassing issues.
|
|
@ -1,9 +0,0 @@
|
|||||||
:orphan:
|
|
||||||
|
|
||||||
.. _tutorials/getting_started/O_perf:
|
|
||||||
|
|
||||||
========================
|
|
||||||
Advanced O: Performances
|
|
||||||
========================
|
|
||||||
|
|
||||||
Hopefully, this topic will be written soon :-)
|
|
@ -1,11 +1,9 @@
|
|||||||
.. _tutorials/getting_started/D_mixins:
|
======================
|
||||||
|
Reuse code with mixins
|
||||||
==================
|
======================
|
||||||
Advanced D: Mixins
|
|
||||||
==================
|
|
||||||
|
|
||||||
If you need to interface with common Odoo features such as the chatter, you can rely on
|
If you need to interface with common Odoo features such as the chatter, you can rely on
|
||||||
:doc:`mixins <../../reference/backend/mixins>`.
|
:doc:`mixins <../reference/backend/mixins>`.
|
||||||
They are Odoo models exposing useful methods through inheritance.
|
They are Odoo models exposing useful methods through inheritance.
|
||||||
|
|
||||||
To learn and play with mixins, visit `this repository <https://github.com/tivisse/odoodays-2018/>`_.
|
To learn and play with mixins, visit `this repository <https://github.com/tivisse/odoodays-2018/>`_.
|
@ -1,22 +1,16 @@
|
|||||||
.. _tutorials/getting_started/J_reports:
|
=================
|
||||||
|
Build PDF Reports
|
||||||
|
=================
|
||||||
|
|
||||||
=======================
|
.. important::
|
||||||
Advanced J: PDF Reports
|
This tutorial is an extension of the :doc:`getting_started` tutorial. Make sure you have
|
||||||
=======================
|
completed it and use the `estate` module you have built as a base for the exercises in this
|
||||||
|
tutorial. Fetch the branch `{BRANCH}-core` from the `technical-training-solutions
|
||||||
.. warning::
|
<https://github.com/odoo/technical-training-solutions/tree/{BRANCH}-core>`_ repository if you
|
||||||
|
want to start from a clean base.
|
||||||
This tutorial assumes you have completed the :ref:`Core Training <tutorials/getting_started>`
|
|
||||||
and have installed :ref:`wkhtmltopdf <setup/install/source/prepare>`.
|
|
||||||
|
|
||||||
To follow the exercise, it is recommended that you fetch the branch {BRANCH}-core from the
|
|
||||||
`technical training solutions
|
|
||||||
<https://github.com/odoo/technical-training-solutions/tree/{BRANCH}-core>`_ repository. It
|
|
||||||
contains a version of the module created during the core training we can use as a starting
|
|
||||||
point.
|
|
||||||
|
|
||||||
We were previously :ref:`introduced to QWeb <tutorials/getting_started/15_qwebintro>`
|
We were previously :ref:`introduced to QWeb <tutorials/getting_started/15_qwebintro>`
|
||||||
in the Core Training where it was used to build a kanban view. Now we will expand on one of QWeb's
|
where it was used to build a kanban view. Now we will expand on one of QWeb's
|
||||||
other main uses: creating PDF reports. A common business requirement is the ability to create documents
|
other main uses: creating PDF reports. A common business requirement is the ability to create documents
|
||||||
to send to customers and to use internally. These reports can be used to summarize and display
|
to send to customers and to use internally. These reports can be used to summarize and display
|
||||||
information in an organized template to support the business in different ways. Odoo
|
information in an organized template to support the business in different ways. Odoo
|
||||||
@ -58,8 +52,8 @@ Therefore, it is expected that your work tree will look something like this:
|
|||||||
|
|
||||||
Note that you will often see other non-QWeb and non-XML files containing "report" in their name also within
|
Note that you will often see other non-QWeb and non-XML files containing "report" in their name also within
|
||||||
the report folder. These are unrelated to the reports covered in this tutorial and are covered in
|
the report folder. These are unrelated to the reports covered in this tutorial and are covered in
|
||||||
:ref:`another advanced topic <tutorials/getting_started/K_dashboard>`. For now you can think of them
|
the :doc:`dashboards` tutorial. For now you can think of them as customized views that use direct
|
||||||
as customized views that use direct SQL queries (sometimes referred to as SQL Views).
|
SQL queries (sometimes referred to as SQL Views).
|
||||||
|
|
||||||
Don't forget to add whatever files your template and action view will be into to your ``__manifest__.py``.
|
Don't forget to add whatever files your template and action view will be into to your ``__manifest__.py``.
|
||||||
In this case, you will want to add the files to the ``data`` list and remember that the files listed in a manifest
|
In this case, you will want to add the files to the ``data`` list and remember that the files listed in a manifest
|
||||||
@ -73,7 +67,7 @@ Basic Report
|
|||||||
**Goal**: at the end of this section, we will can print a report that displays all offers for a
|
**Goal**: at the end of this section, we will can print a report that displays all offers for a
|
||||||
property.
|
property.
|
||||||
|
|
||||||
.. image:: J_reports/simple_report.png
|
.. image:: pdf_reports/simple_report.png
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Simple PDF report
|
:alt: Simple PDF report
|
||||||
|
|
||||||
@ -93,8 +87,8 @@ or all of your expected use cases. A good representation set for our simple repo
|
|||||||
|
|
||||||
If you don't have a set of data like this already, you can either:
|
If you don't have a set of data like this already, you can either:
|
||||||
|
|
||||||
* Complete :ref:`tutorials/getting_started/C_data` (if you haven't done so already) and add the
|
* Complete the :doc:`define_module_data` tutorial (if you haven't done so already) and add the extra
|
||||||
extra cases to your demo data (you may need to create a new database to load in the demo data).
|
cases to your demo data (you may need to create a new database to load in the demo data).
|
||||||
* Manually create the data in your database.
|
* Manually create the data in your database.
|
||||||
* Copy this `data file
|
* Copy this `data file
|
||||||
<https://github.com/odoo/technical-training-solutions/blob/{BRANCH}-J_reports/estate/data/estate_demo.xml>`_
|
<https://github.com/odoo/technical-training-solutions/blob/{BRANCH}-J_reports/estate/data/estate_demo.xml>`_
|
||||||
@ -196,7 +190,7 @@ that only make sense under specific conditions. For example, if we wanted to mak
|
|||||||
report, then we can link it to a "Print Sale Info" button that appears in the form view only when
|
report, then we can link it to a "Print Sale Info" button that appears in the form view only when
|
||||||
the property is "Sold".
|
the property is "Sold".
|
||||||
|
|
||||||
.. image:: J_reports/print_menu.png
|
.. image:: pdf_reports/print_menu.png
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Print Menu Button
|
:alt: Print Menu Button
|
||||||
|
|
||||||
@ -230,7 +224,7 @@ Sub-templates
|
|||||||
|
|
||||||
**Goal**: at the end of this section, we will have a sub-template that we use in 2 reports.
|
**Goal**: at the end of this section, we will have a sub-template that we use in 2 reports.
|
||||||
|
|
||||||
.. image:: J_reports/report_subtemplate.png
|
.. image:: pdf_reports/report_subtemplate.png
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Report using a subtemplate
|
:alt: Report using a subtemplate
|
||||||
|
|
||||||
@ -266,7 +260,7 @@ Report Inheritance
|
|||||||
**Goal**: at the end of this section, we will inherit the property report in the ``estate_account``
|
**Goal**: at the end of this section, we will inherit the property report in the ``estate_account``
|
||||||
module.
|
module.
|
||||||
|
|
||||||
.. image:: J_reports/inherited_report.png
|
.. image:: pdf_reports/inherited_report.png
|
||||||
:align: center
|
:align: center
|
||||||
:alt: An inherited report
|
:alt: An inherited report
|
||||||
|
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
@ -1,20 +1,13 @@
|
|||||||
.. _tutorials/getting_started/B_acl_irrules:
|
=======================
|
||||||
|
Restrict access to data
|
||||||
|
=======================
|
||||||
|
|
||||||
================================
|
.. important::
|
||||||
Advanced B: ACL and Record Rules
|
This tutorial is an extension of the :doc:`getting_started` tutorial. Make sure you have
|
||||||
================================
|
completed it and use the `estate` module you have built as a base for the exercises in this
|
||||||
|
tutorial. Fetch the branch `{BRANCH}-core` from the `technical-training-solutions
|
||||||
ACL stands for "Access Control List"
|
<https://github.com/odoo/technical-training-solutions/tree/{BRANCH}-core>`_ repository if you
|
||||||
|
want to start from a clean base.
|
||||||
.. warning::
|
|
||||||
|
|
||||||
This tutorial assumes you have completed the :ref:`Core Training <tutorials/getting_started>`.
|
|
||||||
|
|
||||||
To follow the exercise, it is recommended that you fetch the branch
|
|
||||||
{BRANCH}-core from the `technical training solutions
|
|
||||||
<https://github.com/odoo/technical-training-solutions/tree/{BRANCH}-core>`_ repository. It
|
|
||||||
contains a version of the module created during the core training we can use as a starting
|
|
||||||
point.
|
|
||||||
|
|
||||||
So far we have mostly concerned ourselves with implementing useful features.
|
So far we have mostly concerned ourselves with implementing useful features.
|
||||||
However in most business scenarios *security* quickly becomes a concern:
|
However in most business scenarios *security* quickly becomes a concern:
|
||||||
@ -85,8 +78,8 @@ This baseline seems sufficient for us:
|
|||||||
which are not specifically under the care of any agent.
|
which are not specifically under the care of any agent.
|
||||||
|
|
||||||
In keeping with Odoo's data-driven nature, a group is no more than a record of
|
In keeping with Odoo's data-driven nature, a group is no more than a record of
|
||||||
the ``res.groups`` model. They are normally part of a module's :ref:`master data
|
the ``res.groups`` model. They are normally part of a module's :doc:`master data
|
||||||
<tutorials/getting_started/C_data>`, defined in one of the module's data files.
|
<define_module_data>`, defined in one of the module's data files.
|
||||||
|
|
||||||
As simple example `can be found here <https://github.com/odoo/odoo/blob/532c083cbbe0ee6e7a940e2bdc9c677bd56b62fa/addons/hr/security/hr_security.xml#L9-L14>`_.
|
As simple example `can be found here <https://github.com/odoo/odoo/blob/532c083cbbe0ee6e7a940e2bdc9c677bd56b62fa/addons/hr/security/hr_security.xml#L9-L14>`_.
|
||||||
|
|
||||||
@ -120,7 +113,7 @@ As simple example `can be found here <https://github.com/odoo/odoo/blob/532c083c
|
|||||||
If you go to :menuselection:`Settings --> Manage Users` and open the
|
If you go to :menuselection:`Settings --> Manage Users` and open the
|
||||||
``admin`` user ("Mitchell Admin"), you should see a new section:
|
``admin`` user ("Mitchell Admin"), you should see a new section:
|
||||||
|
|
||||||
.. figure:: B_acl_irrules/groups.png
|
.. figure:: restrict_data_access/groups.png
|
||||||
|
|
||||||
Set the admin user to be a *Real Estate manager*.
|
Set the admin user to be a *Real Estate manager*.
|
||||||
|
|
||||||
@ -133,7 +126,7 @@ As simple example `can be found here <https://github.com/odoo/odoo/blob/532c083c
|
|||||||
a password), as the real-estate agent you should only see the real estate
|
a password), as the real-estate agent you should only see the real estate
|
||||||
application, and possibly the Discuss (chat) application:
|
application, and possibly the Discuss (chat) application:
|
||||||
|
|
||||||
.. figure:: B_acl_irrules/agent.png
|
.. figure:: restrict_data_access/agent.png
|
||||||
|
|
||||||
Access Rights
|
Access Rights
|
||||||
=============
|
=============
|
||||||
@ -283,7 +276,7 @@ Bypassing Security
|
|||||||
If you try to mark a property as "sold" as the real estate agent, you should get
|
If you try to mark a property as "sold" as the real estate agent, you should get
|
||||||
an access error:
|
an access error:
|
||||||
|
|
||||||
.. figure:: B_acl_irrules/error.png
|
.. figure:: restrict_data_access/error.png
|
||||||
|
|
||||||
This happens because ``estate_account`` tries to create an invoice during the
|
This happens because ``estate_account`` tries to create an invoice during the
|
||||||
process, but creating an invoice requires the right to all invoice management.
|
process, but creating an invoice requires the right to all invoice management.
|
||||||
@ -382,7 +375,7 @@ Explicit security checks can be performed by:
|
|||||||
|
|
||||||
Re-run the bypass script, check that the error occurs before the print.
|
Re-run the bypass script, check that the error occurs before the print.
|
||||||
|
|
||||||
.. _tutorials/getting_started/B_acl_irrules/multicompany:
|
.. _tutorials/restrict_data_access/multicompany:
|
||||||
|
|
||||||
Multi-company security
|
Multi-company security
|
||||||
======================
|
======================
|
||||||
@ -479,7 +472,7 @@ or a *visibility* feature before using it:
|
|||||||
|
|
||||||
* *Visibility* features mean a user can still access the model or record
|
* *Visibility* features mean a user can still access the model or record
|
||||||
otherwise, either through another part of the interface or by :doc:`performing
|
otherwise, either through another part of the interface or by :doc:`performing
|
||||||
operations remotely using RPC <../../api/external_api>`, things might just not be
|
operations remotely using RPC <../api/external_api>`, things might just not be
|
||||||
visible in the web interface in some contexts.
|
visible in the web interface in some contexts.
|
||||||
* *Security* features mean a user can not access records, fields or operations.
|
* *Security* features mean a user can not access records, fields or operations.
|
||||||
|
|
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 9.7 KiB |
@ -1,14 +1,13 @@
|
|||||||
.. _tutorials/getting_started/E_unittest:
|
===================================
|
||||||
|
Safeguard your code with unit tests
|
||||||
|
===================================
|
||||||
|
|
||||||
=============================
|
.. important::
|
||||||
Advanced E: Python Unit Tests
|
This tutorial is an extension of the :doc:`getting_started` tutorial. Make sure you have
|
||||||
=============================
|
completed it and use the `estate` module you have built as a base for the exercises in this
|
||||||
|
tutorial. Fetch the branch `{BRANCH}-core` from the `technical-training-solutions
|
||||||
.. tip:: This tutorial assumes you followed the Core Training.
|
<https://github.com/odoo/technical-training-solutions/tree/{BRANCH}-core>`_ repository if you
|
||||||
|
want to start from a clean base.
|
||||||
To do the exercise, fetch the branch {BRANCH}-core from the `technical training solutions
|
|
||||||
<https://github.com/odoo/technical-training-solutions/tree/{BRANCH}-core>`_ repository. It
|
|
||||||
contains a basic module we will use as a starting point
|
|
||||||
|
|
||||||
**Reference**:
|
**Reference**:
|
||||||
`Odoo's Test Framework: Learn Best Practices <https://www.youtube.com/watch?v=JEIscps0OOQ>`__
|
`Odoo's Test Framework: Learn Best Practices <https://www.youtube.com/watch?v=JEIscps0OOQ>`__
|
@ -55,11 +55,11 @@ developer/howtos/rdtraining/13_inheritance.rst developer/tutorials/getting_start
|
|||||||
developer/howtos/rdtraining/14_other_module.rst developer/tutorials/getting_started/14_other_module.rst # reorganize the developer doc
|
developer/howtos/rdtraining/14_other_module.rst developer/tutorials/getting_started/14_other_module.rst # reorganize the developer doc
|
||||||
developer/howtos/rdtraining/15_qwebintro.rst developer/tutorials/getting_started/15_qwebintro.rst # reorganize the developer doc
|
developer/howtos/rdtraining/15_qwebintro.rst developer/tutorials/getting_started/15_qwebintro.rst # reorganize the developer doc
|
||||||
developer/howtos/rdtraining/16_guidelines_pr.rst developer/tutorials/getting_started/16_guidelines_pr.rst # reorganize the developer doc
|
developer/howtos/rdtraining/16_guidelines_pr.rst developer/tutorials/getting_started/16_guidelines_pr.rst # reorganize the developer doc
|
||||||
developer/howtos/rdtraining/B_acl_irrules.rst developer/tutorials/getting_started/B_acl_irrules.rst # reorganize the developer doc
|
developer/howtos/rdtraining/B_acl_irrules.rst developer/tutorials/restrict_data_access.rst # reorganize the developer doc
|
||||||
developer/howtos/rdtraining/C_data.rst developer/tutorials/getting_started/C_data.rst # reorganize the developer doc
|
developer/howtos/rdtraining/C_data.rst developer/tutorials/define_module_data.rst # reorganize the developer doc
|
||||||
developer/howtos/rdtraining/E_unittest.rst developer/tutorials/getting_started/E_unittest.rst # reorganize the developer doc
|
developer/howtos/rdtraining/E_unittest.rst developer/tutorials/unit_tests.rst # reorganize the developer doc
|
||||||
developer/howtos/rdtraining/J_reports.rst developer/tutorials/getting_started/J_reports.rst # reorganize the developer doc
|
developer/howtos/rdtraining/J_reports.rst developer/tutorials/pdf_reports.rst # reorganize the developer doc
|
||||||
developer/howtos/rdtraining/K_dashboard.rst developer/tutorials/getting_started/K_dashboard.rst # reorganize the developer doc
|
developer/howtos/rdtraining/K_dashboard.rst developer/tutorials/dashboards.rst # reorganize the developer doc
|
||||||
|
|
||||||
# developer/misc
|
# developer/misc
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ applications/sales/crm/optimize/outlook_extension.rst applications/productivity/
|
|||||||
|
|
||||||
# developer/howtos
|
# developer/howtos
|
||||||
|
|
||||||
developer/howtos/rdtraining/D_mixins.rst developer/tutorials/getting_started/D_mixins.rst # reorganize the developer doc
|
developer/howtos/rdtraining/D_mixins.rst developer/tutorials/mixins.rst # reorganize the developer doc
|
||||||
developer/howtos/rdtraining/N_security.rst developer/tutorials/getting_started/N_security.rst # reorganize the developer doc
|
developer/howtos/rdtraining/N_security.rst developer/tutorials/security.rst # reorganize the developer doc
|
||||||
|
|
||||||
# developer/misc
|
# developer/misc
|
||||||
|
|
||||||
|