8000 [IMP] tutorials/server_framework_101: rewrite the tutorial · odoo/documentation@fd29272 · GitHub
[go: up one dir, main page]

Skip to content

Commit fd29272

Browse files
committed
[IMP] tutorials/server_framework_101: rewrite the tutorial
The Server Framework 101 (formerly Getting Started) is generally seen as an interesting and rewarding tutorial but also somewhat outdated and too limited for beginners in Odoo development as it fails to introduce key concepts of the server framework (e.g., controllers, tests, etc.). The instructions are also too directive for the reader to try and search by themselves and learn from it. With this commit, all of the content of the tutorial is rewritten while keeping the objective of building a real estate module. The setup guide for tutorials is also improved to ensure smoother onboarding for Odoo employees and community members alike. task-3802536
1 parent ee8aed0 commit fd29272

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1600
-1334
lines changed

content/contributing/development.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ navigate to the directory where you installed Odoo from sources and follow the g
151151
#. Select **<your_github_account>/odoo** or **<your_github_account>/enterprise** for the head
152152
repository. Replace `<your_github_account>` with the name of the GitHub account on which you
153153
created the fork or by **odoo-dev** if you work at Odoo.
154-
#. Review your changes and click on the :guilabel:`Create pull request` button.
154+
#. Click on :guilabel:`Create pull request` to create the :abbr:`PR (Pull Request)` and
155+
automatically request a review from the code maintainers. If you wish to double-check your
156+
changes first, or if you work at Odoo and follow an internal process for reviews, click on
157+
:guilabel:`Create draft pull request`.
155158
#. Tick the :guilabel:`Allow edits from maintainer` checkbox. Skip this step if you work at Odoo.
156159
#. Complete the description and click on the :guilabel:`Create pull request` button again.
157160

content/developer/reference/backend/data.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ following attributes:
7676

7777
Requires an :term:`external id`, defaults to ``True``.
7878

79+
.. _reference/data/field:
80+
7981
``field``
8082
---------
8183

@@ -203,6 +205,8 @@ Because some important structural models of Odoo are complex and involved,
203205
data files provide shorter alternatives to defining them using
204206
:ref:`record tags <reference/data/record>`:
205207

208+
.. _reference/data/shortcuts/menuitem:
209+
206210
``menuitem``
207211
------------
208212

content/developer/reference/user_interface/view_architectures.rst

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,8 @@ Structural components
520520
Structural components provide structure or "visual" features with little logic. They are used as
521521
elements or sets of elements in form views.
522522

523-
Form views accept the following children 10000 structural components: :ref:`group
524-
<reference/view_architectures/form/group>`, :ref:`sheet <reference/view_architectures/form/sheet>`,
523+
Form views accept the following children structural components: :ref:`sheet
524+
<reference/view_architectures/form/sheet>`, :ref:`group <reference/view_architectures/form/group>`,
525525
:ref:`notebook <reference/view_architectures/form/notebook>`,
526526
:ref:`notebook <reference/view_architectures/form/notebook>`,
527527
:ref:`newline <reference/view_architectures/form/newline>`,
@@ -533,6 +533,24 @@ Form views accept the following children structural components: :ref:`group
533533

534534
Placeholders are denoted in all caps.
535535

536+
.. _reference/view_architectures/form/sheet:
537+
538+
`sheet`: make the layout responsive
539+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
540+
541+
The `sheet` element can be used as a direct child of the :ref:`form
542+
<reference/view_architectures/form>` root element for a narrower and more responsive form layout
543+
(centered page, margin...). It usually contains :ref:`group
544+
<reference/view_architectures/form/group>` elements.
545+
546+
.. code-block:: xml
547+
548+
<form>
549+
<sheet>
550+
...
551+
</sheet>
552+
</form>
553+
536554
.. _reference/view_architectures/form/group:
537555

538556
`group`: define columns layouts
@@ -619,24 +637,6 @@ The `group` element can have the following attributes:
619637
</group>
620638
</group>
621639

622-
.. _reference/view_architectures/form/sheet:
623-
624-
`sheet`: make the layout responsive
625-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
626-
627-
The `sheet` element can be used as a direct child of the :ref:`form
628-
<reference/view_architectures/form>` root element for a narrower and more responsive form layout
629-
(centered page, margin...). It usually contains :ref:`group
630-
<reference/view_architectures/form/group>` elements.
631-
632-
.. code-block:: xml
633-
634-
<form>
635-
<sheet>
636-
...
637-
</sheet>
638-
</form>
639-
640640
.. _reference/view_architectures/form/notebook:
641641

642642
`notebook` & `page`: add tabbed sections

content/developer/tutorials/restrict_data_access.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@ Access Rights
140140
real-estate application.
141141
- Real-estate agents will not be able to update the property types or tags.
142142

143-
Access rights were first introduced in :doc:`server_framework_101/04_securityintro`.
144-
145143
Access rights are a way to give users access to models *via* groups: associate
146144
an access right to a group, then all users with that group will have the access.
147145

content/developer/tutorials/server_framework_101.rst

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,38 @@ Server framework 101
1010

1111
server_framework_101/*
1212

13-
Welcome to the Server framework 101 tutorial! If you reached this page that means you are
14-
interested in the development of your own Odoo module. It might also mean that you recently
15-
joined the Odoo company for a rather technical position. In any case, your journey to the
16-
technical side of Odoo starts here.
13+
**Welcome to the Server framework 101 tutorial!**
1714

18-
The goal of this tutorial is for you to get an insight of the most important parts of the Odoo
19-
development framework while developing your own Odoo module to manage real estate assets. The
20-
chapters should be followed in their given order since they cover the development of a new Odoo
21-
application from scratch in an incremental way. In other words, each chapter depends on the previous
22-
one.
15+
Are you eager to learn about the server framework of Odoo? Perhaps you have recently joined Odoo in
16+
a technical role. Either way, this tutorial will level you up as an Odoo developer and show you the
17+
ropes of working with the server framework.
18+
19+
You will embark on a step-by-step journey, building a real estate asset management application as
20+
you explore the core concepts of the server framework. Each chapter of the tutorial builds upon the
21+
previous one, so make sure to follow them in order.
22+
23+
.. todo: insert picture of the final view
24+
25+
.. note::
26+
Throughout this tutorial, you will encounter exercises designed to reinforce your learning. There
27+
will often be multiple ways to approach these exercises, so feel free to explore your own ideas
28+
and solutions. This is the secret to secure your understanding and develop your problem-solving
29+
skills.
2330

2431
.. important::
2532
Before going further, make sure you have prepared your development environment with the
2633
:doc:`setup guide <setup_guide>`.
2734

2835
Ready? Let's get started!
2936

30-
* :doc 10000 :`server_framework_101/01_architecture`
31-
* :doc:`server_framework_101/02_newapp`
32-
* :doc:`server_framework_101/03_basicmodel`
33-
* :doc:`server_framework_101/04_securityintro`
34-
* :doc:`server_framework_101/05_firstui`
35-
* :doc:`server_framework_101/06_basicviews`
36-
* :doc:`server_framework_101/07_relations`
37-
* :doc:`server_framework_101/08_compute_onchange`
38-
* :doc:`server_framework_101/09_actions`
39-
* :doc:`server_framework_101/10_constraints`
40-
* :doc:`server_framework_101/11_sprinkles`
41-
* :doc:`server_framework_101/12_inheritance`
42-
* :doc:`server_framework_101/13_other_module`
43-
* :doc:`server_framework_101/14_qwebintro`
44-
* :doc:`server_framework_101/15_final_word`
37+
- :doc:`server_framework_101/01_architecture_overview`
38+
- :doc:`server_framework_101/02_lay_the_foundations`
39+
- :doc:`server_framework_101/03_build_user_interface`
40+
- :doc:`server_framework_101/04_relational_fields`
41+
- :doc:`server_framework_101/05_advanced_views`
42+
- :doc:`server_framework_101/0x_business_logic`
43+
- :doc:`server_framework_101/0x_security`
44+
- :doc:`server_framework_101/0x_advanced_views`
45+
- :doc:`server_framework_101/0x_unit_testing`
46+
- :doc:`server_framework_101/0x_inheritance`
47+
- :doc:`server_framework_101/0x_portal`

content/developer/tutorials/server_framework_101/01_architecture.rst

Lines changed: 0 additions & 133 deletions
This file was deleted.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
================================
2+
Chapter 1: Architecture overview
3+
================================
4+
5+
Before we start building our app, let's take a high level glance at the architecture of Odoo.
6+
7+
.. _tutorials/server_framework_101/multitier_app:
8+
9+
Multitier application
10+
=====================
11+
12+
Odoo leverages a `multitier architecture <https://en.wikipedia.org/wiki/Multitier_architecture>`_,
13+
meaning that the presentation, the business logic, and the data storage are separated. More
14+
specifically, it uses a three-tier architecture (image from Wikipedia):
15+
16+
.. image:: 01_architecture_overview/three-tier-architecture.svg
17+
:align: center
18+
:alt: Overview of a three-tier application
19+
20+
The presentation tier of Odoo is a combination of HTML5, JavaScript, and CSS. The logic tier is
21+
exclusively written in Python, while the data tier only supports PostgreSQL as an :abbr:`RDBMS
22+
(Relational Database Management System Software)`.
23+
24+
Depending on the scope of your Odoo development, it can be done in any of these tiers. Therefore,
25+
before going any further, it may be a good idea to refresh your memory if you don't have an
26+
intermediate level in these topics. In order to go through this tutorial, you will need a very basic
27+
knowledge of HTML and an intermediate level of Python. There are plenty of tutorials that are freely
28+
accessible, so we cannot recommend one over another since it depends on your background. For
29+
reference, this is the official `Python tutorial <https://docs.python.org/3/tutorial/>`_.
30+
31+
.. _tutorials/server_framework_101/modules:
32+
33+
Odoo modules
34+
============
35+
36+
Odoo relies on modular components called **modules** to extend its functionality. These modules are
37+
essentially self-contained packages of code and data that serve a specific purpose within the
38+
system. You can think of them as building blocks.
39+
40+
Modules offer two main ways to customize Odoo:
41+
42+
- Adding new functionality: You can create entirely new features with modules, such as a real-time
43+
bus fleet visualization module.
44+
- Extending existing functionality: Modules can also be used to modify or enhance existing Odoo
45+
features, like adding your country's accounting rules to the generic accounting support.
46+
47+
Terminology:
48+
49+
- Developers group their business features in Odoo *modules*.
50+
- The main user-facing modules are flagged and exposed as *Apps*, but a majority of the modules are
51+
not Apps.
52+
- *Modules* may also be referred to as *addons*.
53+
54+
In practice, modules are represented by directories. They are placed in a designated location called
55+
the **addons path**, which the server scans to discover available modules.
56+
57+
In the :doc:`setup guide <../setup_guide>`, we cloned the `odoo/tutorials` repository and included
58+
it in the `addons-path` argument when starting the server. The directories present in the repository
59+
are all modules that can be installed on your Odoo server.
60+
61+
.. exercise::
62+
In your file explorer, navigate to the `odoo/tutorials` repository and inspect the available
63+
modules. You should find the `real_estate` module in which we will build our real estate
64+
application throughout this tutorial.
65+
66+
You must have noticed that the module directories are not empty; they all contain at least two
67+
essential files: :file:`__init__.py` and :file:`__manifest__.py`. These files are what makes a
68+
simple directory an Odoo module. We'll get back to it in the next chapter.
69+
70+
----
71+
72+
Ready to start? Let's now :doc:`lay the foundations of our first Odoo app <02_lay_the_foundations>`!

0 commit comments

Comments
 (0)
0