Skip to content

Commit 4f7e363

Browse files
committed
[FIX] Upgrade documentation: Review changes by CHS
1 parent 2b68d58 commit 4f7e363

File tree

3 files changed

+34
-34
lines changed

3 files changed

+34
-34
lines changed

content/developer/howtos/upgrade/migration_scripts.rst renamed to content/developer/howtos/upgrade/upgrade_scripts.rst

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
=================
2-
Migration scripts
3-
=================
1+
===============
2+
Upgrade scripts
3+
===============
44

5-
A migration script is a Python file containing a function called :file:`migrate`, which the upgrade
5+
An upgrade script is a Python file containing a function called :file:`migrate`, which the upgrade
66
process invokes during the update of a module.
77

88
The :file:`migrate` function receives two parameters:
@@ -13,14 +13,14 @@ The :file:`migrate` function receives two parameters:
1313
Typically, this function executes one or multiple SQL queries and can also access Odoo's ORM, as
1414
well as the :doc:`../upgrade/upgrade_util`.
1515

16-
As described in :ref:`upgrade_custom/upgraded_database/migrate_data`, you might have to use
17-
migration scripts to reflect changes from the source code to their corresponding data.
16+
As described in :ref:`upgrade_custom/upgraded_database/migrate_data`, you might have to use upgrade
17+
scripts to reflect changes from the source code to their corresponding data.
1818

1919

20-
Writing migration scripts
20+
Writing upgrade scripts
2121
=========================
2222

23-
To write what we refer as a **custom migration script**, the path of the file should follow this
23+
To write what we refer as a **custom upgrade script**, the path of the file should follow this
2424
template: :file:`<module_name>/migrations/<major_version>.<minor_version>/{pre|post|end}-*.py`.
2525

2626
Follow this steps to create the directory's structure and the Python file:
@@ -34,13 +34,13 @@ Follow this steps to create the directory's structure and the Python file:
3434
- :file:`<minor_version>` corresponds to the updated version declared on the module's
3535
manifest.
3636

37-
Migration scripts are only executed when the module is being updated. Therefore, the
37+
Upgrade scripts are only executed when the module is being updated. Therefore, the
3838
:file:`minor_version` set in the directory needs to be higher than the module's installed
3939
version and equal or lower to the updated version of the module.
4040
For example, in an `Odoo 16` database, with a custom module installed in version `1.1`, and an
4141
updated module version equal to `1.2`; the version directory should be `16.0.1.2`.
4242
#. Create a :file:`Python file` inside the :file:`<version>` directory named according to the
43-
:ref:`Phase <upgrade/migration-scripts/phases>` on which it needs to be executed. It should
43+
:ref:`Phase <upgrade/upgrade-scripts/phases>` on which it needs to be executed. It should
4444
follow the template `{pre|post|end}-*.py`. The file name will determine the order in which it
4545
is executed for that module, version and phase.
4646
#. Create a :file:`migrate` function in the Python file that receives as parameters
@@ -49,7 +49,7 @@ Follow this steps to create the directory's structure and the Python file:
4949

5050
.. example::
5151

52-
Directory structure of a migration script for a custom module named `awesome_partner` upgraded
52+
Directory structure of an upgrade script for a custom module named `awesome_partner` upgraded
5353
to version `2.0.0` on Odoo 17
5454

5555
.. code-block:: text
@@ -59,7 +59,7 @@ Follow this steps to create the directory's structure and the Python file:
5959
| |-- 17.0.2.0.0/
6060
| | |-- pre-exclamation.py
6161
62-
Two migration scripts examples with the content of the :file:`pre-exclamation.py`, file adding
62+
Two upgrade scripts examples with the content of the :file:`pre-exclamation.py`, file adding
6363
"!" at the end of partners' names:
6464

6565
.. code-block:: python
@@ -94,15 +94,15 @@ Follow this steps to create the directory's structure and the Python file:
9494
to access the ORM. Check the documentation to find out more about this library.
9595

9696

97-
Running and testing migration scripts
97+
Running and testing upgrade scripts
9898
=====================================
9999

100100
.. tabs::
101101

102102
.. group-tab:: Odoo Online
103103

104104
As the instalation of custom modules containing Python files is not allowed on Odoo Online
105-
databases, it is not possible to run migration scripts on this platform.
105+
databases, it is not possible to run upgrade scripts on this platform.
106106

107107
.. group-tab:: Odoo.sh
108108

@@ -111,9 +111,9 @@ Running and testing migration scripts
111111

112112
Once the upgrade of a staging branch is on "Update on commit" mode, each time a commit is
113113
pushed on the branch, the upgraded backup is restored and all the custom modules are updated.
114-
This update includes the execution of the migration scripts.
114+
This update includes the execution of the upgrade scripts.
115115

116-
When upgrading the production database, the execution of the migration scripts is also part of
116+
When upgrading the production database, the execution of the upgrade scripts is also part of
117117
the update of the custom modules done by the platform when the upgraded database is restored.
118118

119119
.. group-tab:: On-premise
@@ -129,9 +129,9 @@ Running and testing migration scripts
129129
to call the CLI depends on how you installed Odoo.
130130

131131

132-
.. _upgrade/migration-scripts/phases:
132+
.. _upgrade/upgrade-scripts/phases:
133133

134-
Phases of migration scripts
134+
Phases of upgrade scripts
135135
===========================
136136

137137
The upgrade process consists of three phases for each version of each module:
@@ -140,7 +140,7 @@ The upgrade process consists of three phases for each version of each module:
140140
#. The post-phase, after the module and its dependencies are loaded and upgraded.
141141
#. The end-phase, after all modules have been loaded and upgraded for that version.
142142

143-
Migration scripts are grouped according to the first part of their filenames into the corresponding
143+
Upgrade scripts are grouped according to the first part of their filenames into the corresponding
144144
phase. Within each phase, the files are executed according to their lexical order.
145145

146146
.. note::

content/developer/howtos/upgrade/upgrade_util.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Upgrade Util package
44

55
The `Upgrade Util package <https://github.com/odoo/upgrade-util/>`_ is a library that contains
66
helper functions to facilitate the writing of upgrade scripts. This package, used by Odoo for the
7-
migration scripts of standard modules, provides reliability and helps speed up the upgrade process:
7+
upgrade scripts of standard modules, provides reliability and helps speed up the upgrade process:
88

99
- The helper functions make sure the data is consitent in the database.
1010
- It takes care of indirect references of the updated records.
@@ -36,12 +36,12 @@ the custom repository. For this, add the following line inside the file::
3636
Using the Util package
3737
======================
3838

39-
Once installed, the following packages are available for the migration scripts:
39+
Once installed, the following packages are available for the upgrade scripts:
4040

4141
- :file:`odoo.upgrade.util`: the helper themself.
4242
- :file:`odoo.upgrade.testing`: base TestCase classes.
4343

44-
To use it in migration scripts, simply import it:
44+
To use it in upgrade scripts, simply import it:
4545

4646
.. code-block:: python
4747
@@ -63,7 +63,7 @@ helper functions.
6363

6464
.. note::
6565
All util functions receive :file:`cr` as a parameter. This refers to the database cursor. Use the
66-
one received as a parameter in the :doc:`migration_scripts`.
66+
one received as a parameter in the :doc:`upgrade_scripts`.
6767

6868
Fields
6969
------
@@ -277,7 +277,7 @@ Records
277277
.. _upgrade/util/update_record_from_xml:
278278

279279
.. `[source] <https://github.com/odoo/upgrade-util/blob/master/src/util/records.py#L720>`_
280-
.. method:: update_record_from_xml(cr, xmlid[, reset_write_metadata=True][, force_create=False][, from_module=None][, reset_translations=()])
280+
.. method:: update_record_from_xml(cr, xmlid[, reset_write_metadata=True][, force_create=True][, from_module=None][, reset_translations=()])
281281

282282
Update a record based on its definition on the :doc:`../../reference/backend/data`. Useful to
283283
update ``noupdate`` records, in order to reset them for the upgraded version.
@@ -286,7 +286,7 @@ Records
286286
:param bool reset_write_metadata: if ``True``, the metadata before the record update is kept
287287
(default: ``True``)
288288
:param bool force_create: if ``True``, creates the record if it does not exist. (default:
289-
``False``)
289+
``True``)
290290
:param str from_module: name of the module from which to update the record. Useful when the
291291
record is rewritten in another module.
292292
:param set of str reset_translations: set of field names whose translations get reset.

content/developer/howtos/upgrade_custom_db.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,12 @@ To make sure the custom code is working flawlessly in the new version, follow th
200200
Migrate the data
201201
----------------
202202

203-
During the upgrade of the custom modules, you might have to use :doc:`upgrade/migration_scripts` to
204-
reflect changes from the source code to their corresponding data. Together with the Migration
203+
During the upgrade of the custom modules, you might have to use :doc:`upgrade/upgrade_scripts` to
204+
reflect changes from the source code to their corresponding data. Together with the Upgrade
205205
scripts, you can also make use of the :doc:`upgrade/upgrade_util` and its helper functions.
206206

207207
- Any technical data that was renamed during the upgrade of the custom code (models, fields,
208-
external identifiers) should be renamed using migration scripts to avoid data loss during the
208+
external identifiers) should be renamed using upgrade scripts to avoid data loss during the
209209
module upgrade. See also: :ref:`util.rename_field <upgrade/util/rename_field>`,
210210
:ref:`util.rename_model <upgrade/util/rename_model>`, :ref:`util.rename_xmlid
211211
<upgrade/util/rename_xmlid>`.
@@ -216,9 +216,9 @@ scripts, you can also make use of the :doc:`upgrade/upgrade_util` and its helper
216216
.. example::
217217
Custom fields for model ``sale.subscription`` are not automatically migrated from Odoo 15 to
218218
Odoo 16 (when the model was merged into ``sale.order``). In this case, a SQL query can be
219-
executed on a migration script to move the data from one table to the other. Take into account
219+
executed on an upgrade script to move the data from one table to the other. Take into account
220220
that all columns/fields must already exist, so consider doing this in a ``post-`` script (See
221-
:ref:`upgrade/migration-scripts/phases`).
221+
:ref:`upgrade/upgrade-scripts/phases`).
222222

223223
.. spoiler::
224224

@@ -234,9 +234,9 @@ scripts, you can also make use of the :doc:`upgrade/upgrade_util` and its helper
234234
"""
235235
)
236236
237-
Check the documentation for more information on :doc:`upgrade/migration_scripts`.
237+
Check the documentation for more information on :doc:`upgrade/upgrade_scripts`.
238238

239-
Migration scripts can also be used to:
239+
Upgrade scripts can also be used to:
240240

241241
- Ease the processing time of an upgrade. For example, to store the value of computed stored fields
242242
on models with an excessive number of records by using SQL queries.
@@ -261,10 +261,10 @@ Things to pay attention to:
261261
- Views not working: During the upgrade, if a view causes issues because of its content, it gets
262262
disabled. You can find the information on disabled views on the :ref:`Upgrade report
263263
<upgrade/upgrade_report>`. This view needs to be activated again. To achieve this, we recommend
264-
the use of migration scripts.
264+
the use of upgrade scripts.
265265
- :doc:`Module data <../tutorials/define_module_data>` not updated: Custom records that have the
266266
``noupdate`` flag are not updated when upgrading the module in the new database. For the custom
267-
data that needs to be updated due to changes in the new version, we recommend to use migration
267+
data that needs to be updated due to changes in the new version, we recommend to use upgrade
268268
scripts to do so. See also: :ref:`util.update_record_from_xml
269269
<upgrade/util/update_record_from_xml>`.
270270

0 commit comments

Comments
 (0)