Skip to content

Commit

Permalink
[REF] Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
BT-cjimeno committed Sep 27, 2024
1 parent 20d98f8 commit e38fd9a
Showing 1 changed file with 76 additions and 85 deletions.
161 changes: 76 additions & 85 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,65 +11,63 @@ odoo-module-migrator
====================

``odoo-module-migrator`` is a python3 library that allows you to automatically migrate
module code to make it compatible with newer Odoo version.
for exemple:
module code to make it compatible with newer Odoo versions.
For example:

* renaming ``__openerp__.py`` file into ``__manifest__.py``
* renaming ``__openerp__.py`` file to ``__manifest__.py``
* removing ``# -*- encoding: utf-8 -*-`` since V11.0
* replacing ``openerp`` import by ``odoo`` import
* replacing ``openerp`` import with ``odoo`` import
* removing ``migrations`` folders
* changing <act_window> to <record model="ir.actions.window">
* ...

This library will so:
This library will:

* (optionnaly) get commits from the old branch (if format-patch is enabled)
* apply automatically changes. (renaming, replacing, etc.)
* commit your changes.
* Display warnings or errors in log if your code belong obsolete code patterns.
* (optionally) get commits from the old branch (if format-patch is enabled)
* automatically apply changes (renaming, replacing, etc.)
* commit your changes
* display warnings or errors in the log if your code contains obsolete code patterns

This project is about migrating code. If you're looking for database data migration
between Odoo versions, take a look
at the https://github.com/OCA/OpenUpgrade project.
between Odoo versions, check out the https://github.com/OCA/OpenUpgrade project.

**INFO log**

It mentions that the lib automatically changed something.
Indicates that the library automatically changed something.
*A priori* you have nothing to do. For example, for a migration from 8.0 to
a more recent version:

.. code-block:: shell
12:38:54 INFO Renaming file: '/my_module/__openerp__.py' by '/my_module/__manifest__.py'
12:38:54 INFO Renaming file: '/my_module/__openerp__.py' to '/my_module/__manifest__.py'
**WARNING log**

It mentions that you should check something. There is *maybe* something to do
to make the module working. For exemple:
Indicates that you should check something. There may be something to do
to make the module work. For example:

.. code-block:: shell
19:37:55 WARNING Replaced dependency of 'account_analytic_analysis' by 'contract' (Moved to OCA/contract)
19:37:55 WARNING Replaced dependency of 'account_analytic_analysis' with 'contract' (Moved to OCA/contract)
**ERROR log**

It mentions that you should change something in your code. It not, the module
will not work *for sure*. (not installable, or generating error during the
execution)
Indicates that you must change something in your code. If not, the module
will not work *for sure* (not installable or generating errors during
execution).

For example, if you have a 8.0 module that depends on 'account_anglo_saxon',
that disappeared in more recent version, the following log will be displayed
For example, if you have an 8.0 module that depends on 'account_anglo_saxon',
which disappeared in more recent versions, the following log will be displayed:

.. code-block:: shell
12:38:54 ERROR Depends on removed module 'account_anglo_saxon'
Development and improvment
==========================
Development and Improvement
============================

If you want to improve or complete this library, please read the
``DEVELOP.rst`` file and the 'Roadmap / Know issues' sections.
If you want to improve or contribute to this library, please read the
``DEVELOP.rst`` file and the 'Roadmap / Known Issues' sections.

Installation
============
Expand All @@ -78,17 +76,16 @@ Installation
pip3 install odoo-module-migrator
Usage
=====

Using Format Patch command
--------------------------

(Recommanded by the OCA)
(Recommended by the OCA)

If you want to migrate an Odoo module from a version 8.0 to 12.0, for exemple
the module ``pos_order_pricelist_change`` in the OCA "pos" repository.
If you want to migrate an Odoo module from version 8.0 to 12.0, for example,
the module ``pos_order_pricelist_change`` in the OCA "pos" repository:

.. code-block:: shell
Expand All @@ -98,16 +95,16 @@ the module ``pos_order_pricelist_change`` in the OCA "pos" repository.
--directory ./
--modules pos_order_pricelist_change
--init-version-name 8.0
--target-version-name 12.0
--target-version-name 12.0
--format-patch
Without format Patch command
----------------------------

(Mainly for your custom modules)

if you have created a new branch (for exemple 12.0) based on your 10.0 branch
you can run the following command
If you have created a new branch (for example 12.0) based on your 10.0 branch,
you can run the following command:

.. code-block:: shell
Expand All @@ -117,52 +114,50 @@ you can run the following command
--init-version-name 10.0
--target-version-name 12.0
This tools will operate the changes for each module.
This tool will operate the changes for each module.

Available arguments
Available Arguments
-------------------

+--------------------------+----------+-----------------+-------------------------------------------------------+
|name | shortcut | Options | description |
| Name | Shortcut | Options | Description |
+==========================+==========+=================+=======================================================+
|``--directory`` |``-d`` | Default: | Local folder that belongs the module(s) to migrate. |
| ``--directory`` | ``-d`` | Default: | Local folder that contains the module(s) to migrate. |
| | | ``./`` | |
+--------------------------+----------+-----------------+-------------------------------------------------------+
|``--init-version-name`` | ``-i`` | Required | Initial version of your module(s) you want to migrate.|
| | | | |
| ``--init-version-name`` | ``-i`` | Required | Initial version of your module(s) you want to migrate.|
+--------------------------+----------+-----------------+-------------------------------------------------------+
|``--target-version-name`` | ``-t`` | Default: | Final Version you want to migrate. |
| | | the laster odoo | |
| ``--target-version-name`` | ``-t`` | Default: | Final version you want to migrate to. |
| | | the latest Odoo | |
| | | version | |
+--------------------------+----------+-----------------+-------------------------------------------------------+
|``--modules`` | ``-m`` | Default: | Module(s) to migrate. Note if format-patch option is |
| | | All modules | enabled, you have to provide only one module. |
| | | present in the | |
| ``--modules`` | ``-m`` | Default: | Module(s) to migrate. Note: if the format-patch option|
| | | All modules | is enabled, you have to provide only one module. |
| | | in the | |
| | | directory | |
+--------------------------+----------+-----------------+-------------------------------------------------------+
|``--format-patch`` | ``-fp`` | disabled | Recover code, using git format-patch command. |
| ``--format-patch`` | ``-fp`` | Disabled | Recover code using the git format-patch command. |
| | | by default | |
+--------------------------+----------+-----------------+-------------------------------------------------------+
|``--remote-name`` | ``-rn`` | Default: | Name of the main remote, used by format-patch command.|
| | | ``origin`` | |
| ``--remote-name`` | ``-rn`` | Default: | Name of the main remote used by the format-patch |
| | | ``origin`` | command. |
+--------------------------+----------+-----------------+-------------------------------------------------------+
|``--log-level`` | ``-ll`` | Default: | Possible value: ``DEBUG``, ``INFO``, ``WARNING``, etc.|
| ``--log-level`` | ``-ll`` | Default: | Possible values: ``DEBUG``, ``INFO``, ``WARNING``, etc.|
| | | ``INFO`` | |
+--------------------------+----------+-----------------+-------------------------------------------------------+
|``--log-path`` | ``-lp`` | Default: | If set, the logs will not be displayed at screen, |
| | | False | but stored in a file |
| ``--log-path`` | ``-lp`` | Default: | If set, logs will not be displayed on screen, |
| | | False | but stored in a file. |
+--------------------------+----------+-----------------+-------------------------------------------------------+
|``--no-commit`` | ``-nc`` | Default: | If set the library will not git add and git commit |
| ``--no-commit`` | ``-nc`` | Default: | If set, the library will not git add and git commit |
| | | commit | changes. |
+--------------------------+----------+-----------------+-------------------------------------------------------+

Roadmap / Known Issues
======================

Roadmap / Know issues
=====================

* replacement of tag <openerp><data> by <odoo> will fail in the case
where there are many <data> occurency.
We could fix that, using ``lxml`` lib instead of regular expression.
* The replacement of the tag <openerp><data> with <odoo> will fail in cases
where there are many <data> occurrences.
We could fix that by using the ``lxml`` library instead of regular expressions.

* Add a call to ``pre-commit run -a``, if pre-commit is present in the
repository.
Expand All @@ -172,62 +167,58 @@ Changes

0.3.2 (December 04, 2019)
-------------------------
* [REM] Remove black call. (Add call to more generic tool pre-commit
in the roadmap)
* [IMP] Add --no-verify option in ``git commit`` to avoid to fail if pre-commit
is present
* [REF] Refactor ``_execute_shell`` function

* [REM] Remove black call (add call to a more generic tool pre-commit
in the roadmap).
* [IMP] Add --no-verify option in ``git commit`` to avoid failure if pre-commit
is present.
* [REF] Refactor ``_execute_shell`` function.

0.2.0 (October 13, 2019)
------------------------
* Second release

* Second release.

0.1.4 (October 12, 2019)
------------------------
* Test

[ADD] test
[ADD] test.

* framework
* Framework

[ADD] ``--file-path`` option.
[ADD] ``_DEPRECATED_MODULES`` syntax.

* migration script

[FIX] Incorrect syntax of regular expression, to remove python 2 header
[IMP] first release of all the steps from 8.0 to 13.0
* Migration script

[FIX] Incorrect syntax of regular expression to remove python 2 header.
[IMP] First release of all the steps from 8.0 to 13.0.

0.1.3 (October 11, 2019)
------------------------

* framework
* Framework

[ADD] ``--no-commit`` option that disable git add and git commit calls
[FIX] do not commit many times if migration has many steps.
[REF] remove useless commented code
[REF] create _commit_changes() and _replace_in_file() functions
[ADD] ``--no-commit`` option that disables git add and git commit calls.
[FIX] Do not commit many times if migration has many steps.
[REF] Remove useless commented code.
[REF] Create ``_commit_changes()`` and ``_replace_in_file()`` functions.

* Meta

[FIX] github url of the project in setup.py
[ADD] Travis file + links to coveralls
[ADD] test_requirements.txt

* migration script
[FIX] GitHub URL of the project in setup.py.
[ADD] Travis file + links to coveralls.
[ADD] test_requirements.txt.

[ADD] 12.0 to 13.0 and add a warning if reference to web_settings_dashboard are found. cortesy @yelizariev
[ADD] bump version in manifest file
[ADD] set installable to True
* Migration script

[ADD] Migration from 12.0 to 13.0 and add a warning if references to web_settings_dashboard are found, courtesy of @yelizariev.
[ADD] Bump version in manifest file.
[ADD] Set installable to True.

0.1.2 (October 10, 2019)
------------------------

* First release
* First release.

Credits
=======
Expand Down

0 comments on commit e38fd9a

Please sign in to comment.