odoo-module-migrator


Nameodoo-module-migrator JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://github.com/OCA/odoo-module-migrator
SummarySmall tools to migrate Odoo modules from a version to another
upload_time2023-05-15 10:46:25
maintainer
docs_urlNone
authorGRAP, Groupement Régional Alimentaire de Proximité
requires_python
license
keywords odoo community association (oca) odoo migration upgrade module
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
    :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
    :alt: License: AGPL-3
.. image:: https://img.shields.io/badge/python-3.6-blue.svg
    :alt: Python support: 3.6
.. image:: https://app.travis-ci.com/OCA/odoo-module-migrator.svg?branch=master
    :target: https://app.travis-ci.com/OCA/odoo-module-migrator

====================
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:

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

This library will so:

* (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.

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.

**INFO log**

It mentions that the lib 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'

**WARNING log**

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

.. code-block:: shell

    19:37:55 WARNING Replaced dependency of 'account_analytic_analysis' by '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)

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

.. code-block:: shell

    12:38:54 ERROR Depends on removed module 'account_anglo_saxon'

Development and improvment
==========================

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

Installation
============

.. code-block:: shell

    pip3 install odoo-module-migrator


Usage
=====

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

(Recommanded 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.

.. code-block:: shell

    git clone https://github.com/OCA/pos -b 12.0
    cd pos
    odoo-module-migrate
        --directory             ./
        --modules               pos_order_pricelist_change
        --init-version-name     8.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

.. code-block:: shell

    odoo-module-migrate
        --directory             /path/to/repository
        --modules               module_1,module_2,module_3
        --init-version-name     10.0
        --target-version-name   12.0

This tools will operate the changes for each module.

Available arguments
-------------------

+--------------------------+----------+-----------------+-------------------------------------------------------+
|name                      | shortcut | Options         | description                                           |
+==========================+==========+=================+=======================================================+
|``--directory``           |``-d``    | Default:        | Local folder that belongs the module(s) 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 |                                                       |
|                          |          | 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  |                                                       |
|                          |          | directory       |                                                       |
+--------------------------+----------+-----------------+-------------------------------------------------------+
|``--format-patch``        | ``-fp``  | disabled        | Recover code, using git format-patch command.         |
|                          |          | by default      |                                                       |
+--------------------------+----------+-----------------+-------------------------------------------------------+
|``--remote-name``         | ``-rn``  | Default:        | Name of the main remote, used by format-patch command.|
|                          |          | ``origin``      |                                                       |
+--------------------------+----------+-----------------+-------------------------------------------------------+
|``--log-level``           | ``-ll``  | Default:        | Possible value: ``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                                  |
+--------------------------+----------+-----------------+-------------------------------------------------------+
|``--no-commit``           | ``-nc``  | Default:        | If set the library will not git add and git commit    |
|                          |          | commit          | changes.                                              |
+--------------------------+----------+-----------------+-------------------------------------------------------+


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.

* Add a call to ``pre-commit run -a``, if pre-commit is present in the
  repository.

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


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


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

[ADD] test

* 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


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

* 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

* Meta

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

* migration script

[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


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

* First release

Credits
=======

Authors
-------

* GRAP, Groupement Régional Alimentaire de Proximité (http://www.grap.coop)

Contributors
------------

* Sylvain LE GAL (https://www.twitter.com/legalsylvain)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/OCA/odoo-module-migrator",
    "name": "odoo-module-migrator",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Odoo Community Association (OCA),Odoo,Migration,Upgrade,Module",
    "author": "GRAP, Groupement R\u00e9gional Alimentaire de Proximit\u00e9",
    "author_email": "informatique@grap.coop",
    "download_url": "https://files.pythonhosted.org/packages/92/b4/4bcf9caebd6eb41ecb80a5fb035de3396bd8ab97027e7715c7898100be41/odoo-module-migrator-0.4.0.tar.gz",
    "platform": null,
    "description": ".. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg\n    :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html\n    :alt: License: AGPL-3\n.. image:: https://img.shields.io/badge/python-3.6-blue.svg\n    :alt: Python support: 3.6\n.. image:: https://app.travis-ci.com/OCA/odoo-module-migrator.svg?branch=master\n    :target: https://app.travis-ci.com/OCA/odoo-module-migrator\n\n====================\nodoo-module-migrator\n====================\n\n``odoo-module-migrator`` is a python3 library that allows you to automatically migrate\nmodule code to make it compatible with newer Odoo version.\nfor exemple:\n\n* renaming ``__openerp__.py`` file into ``__manifest__.py``\n* removing ``# -*- encoding: utf-8 -*-`` since V11.0\n* replacing ``openerp`` import by ``odoo`` import\n* removing ``migrations`` folders\n* changing <act_window> to <record model=\"ir.actions.window\">\n* ...\n\nThis library will so:\n\n* (optionnaly) get commits from the old branch (if format-patch is enabled)\n* apply automatically changes. (renaming, replacing, etc.)\n* commit your changes.\n* Display warnings or errors in log if your code belong obsolete code patterns.\n\nThis project is about migrating code. If you're looking for database data migration\nbetween Odoo versions, take a look\nat the https://github.com/OCA/OpenUpgrade project.\n\n**INFO log**\n\nIt mentions that the lib automatically changed something.\n*A priori* you have nothing to do. For example, for a migration from 8.0 to\na more recent version:\n\n.. code-block:: shell\n\n    12:38:54 INFO Renaming file: '/my_module/__openerp__.py' by '/my_module/__manifest__.py'\n\n**WARNING log**\n\nIt mentions that you should check something. There is *maybe* something to do\nto make the module working. For exemple:\n\n.. code-block:: shell\n\n    19:37:55 WARNING Replaced dependency of 'account_analytic_analysis' by 'contract' (Moved to OCA/contract)\n\n\n**ERROR log**\n\nIt mentions that you should change something in your code. It not, the module\nwill not work *for sure*. (not installable, or generating error during the\nexecution)\n\nFor example, if you have a 8.0 module that depends on 'account_anglo_saxon',\nthat disappeared in more recent version, the following log will be displayed\n\n.. code-block:: shell\n\n    12:38:54 ERROR Depends on removed module 'account_anglo_saxon'\n\nDevelopment and improvment\n==========================\n\nIf you want to improve or complete this library, please read the\n``DEVELOP.rst`` file and the 'Roadmap / Know issues' sections.\n\nInstallation\n============\n\n.. code-block:: shell\n\n    pip3 install odoo-module-migrator\n\n\nUsage\n=====\n\nUsing Format Patch command\n--------------------------\n\n(Recommanded by the OCA)\n\nIf you want to migrate an Odoo module from a version 8.0 to 12.0, for exemple\nthe module ``pos_order_pricelist_change`` in the OCA \"pos\" repository.\n\n.. code-block:: shell\n\n    git clone https://github.com/OCA/pos -b 12.0\n    cd pos\n    odoo-module-migrate\n        --directory             ./\n        --modules               pos_order_pricelist_change\n        --init-version-name     8.0\n        --target-version-name  12.0\n        --format-patch\n\nWithout format Patch command\n----------------------------\n\n(Mainly for your custom modules)\n\nif you have created a new branch (for exemple 12.0) based on your 10.0 branch\nyou can run the following command\n\n.. code-block:: shell\n\n    odoo-module-migrate\n        --directory             /path/to/repository\n        --modules               module_1,module_2,module_3\n        --init-version-name     10.0\n        --target-version-name   12.0\n\nThis tools will operate the changes for each module.\n\nAvailable arguments\n-------------------\n\n+--------------------------+----------+-----------------+-------------------------------------------------------+\n|name                      | shortcut | Options         | description                                           |\n+==========================+==========+=================+=======================================================+\n|``--directory``           |``-d``    | Default:        | Local folder that belongs the module(s) to migrate.   |\n|                          |          | ``./``          |                                                       |\n+--------------------------+----------+-----------------+-------------------------------------------------------+\n|``--init-version-name``   | ``-i``   | Required        | Initial version of your module(s) you want to migrate.|\n|                          |          |                 |                                                       |\n+--------------------------+----------+-----------------+-------------------------------------------------------+\n|``--target-version-name`` | ``-t``   | Default:        | Final Version you want to migrate.                    |\n|                          |          | the laster odoo |                                                       |\n|                          |          | version         |                                                       |\n+--------------------------+----------+-----------------+-------------------------------------------------------+\n|``--modules``             | ``-m``   | Default:        | Module(s) to migrate. Note if format-patch option is  |\n|                          |          | All modules     | enabled, you have to provide only one module.         |\n|                          |          | present in the  |                                                       |\n|                          |          | directory       |                                                       |\n+--------------------------+----------+-----------------+-------------------------------------------------------+\n|``--format-patch``        | ``-fp``  | disabled        | Recover code, using git format-patch command.         |\n|                          |          | by default      |                                                       |\n+--------------------------+----------+-----------------+-------------------------------------------------------+\n|``--remote-name``         | ``-rn``  | Default:        | Name of the main remote, used by format-patch command.|\n|                          |          | ``origin``      |                                                       |\n+--------------------------+----------+-----------------+-------------------------------------------------------+\n|``--log-level``           | ``-ll``  | Default:        | Possible value: ``DEBUG``, ``INFO``, ``WARNING``, etc.|\n|                          |          | ``INFO``        |                                                       |\n+--------------------------+----------+-----------------+-------------------------------------------------------+\n|``--log-path``            | ``-lp``  | Default:        | If set, the logs will not be displayed at screen,     |\n|                          |          | False           | but stored in a file                                  |\n+--------------------------+----------+-----------------+-------------------------------------------------------+\n|``--no-commit``           | ``-nc``  | Default:        | If set the library will not git add and git commit    |\n|                          |          | commit          | changes.                                              |\n+--------------------------+----------+-----------------+-------------------------------------------------------+\n\n\nRoadmap / Know issues\n=====================\n\n* replacement of tag <openerp><data> by <odoo> will fail in the case\n  where there are many <data> occurency.\n  We could fix that, using ``lxml`` lib instead of regular expression.\n\n* Add a call to ``pre-commit run -a``, if pre-commit is present in the\n  repository.\n\nChanges\n=======\n\n0.3.2 (December 04, 2019)\n-------------------------\n* [REM] Remove black call. (Add call to more generic tool pre-commit\n  in the roadmap)\n* [IMP] Add --no-verify option in ``git commit`` to avoid to fail if pre-commit\n  is present\n* [REF] Refactor ``_execute_shell`` function\n\n\n0.2.0 (October 13, 2019)\n------------------------\n* Second release\n\n\n0.1.4 (October 12, 2019)\n------------------------\n* Test\n\n[ADD] test\n\n* framework\n\n[ADD] ``--file-path`` option.\n[ADD] ``_DEPRECATED_MODULES`` syntax.\n\n* migration script\n\n[FIX] Incorrect syntax of regular expression, to remove python 2 header\n[IMP] first release of all the steps from 8.0 to 13.0\n\n\n0.1.3 (October 11, 2019)\n------------------------\n\n* framework\n\n[ADD] ``--no-commit`` option that disable git add and git commit calls\n[FIX] do not commit many times if migration has many steps.\n[REF] remove useless commented code\n[REF] create _commit_changes() and _replace_in_file() functions\n\n* Meta\n\n[FIX] github url of the project in setup.py\n[ADD] Travis file + links to coveralls\n[ADD] test_requirements.txt\n\n* migration script\n\n[ADD] 12.0 to 13.0 and add a warning if reference to web_settings_dashboard are found. cortesy @yelizariev\n[ADD] bump version in manifest file\n[ADD] set installable to True\n\n\n0.1.2 (October 10, 2019)\n------------------------\n\n* First release\n\nCredits\n=======\n\nAuthors\n-------\n\n* GRAP, Groupement R\u00e9gional Alimentaire de Proximit\u00e9 (http://www.grap.coop)\n\nContributors\n------------\n\n* Sylvain LE GAL (https://www.twitter.com/legalsylvain)\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Small tools to migrate Odoo modules from a version to another",
    "version": "0.4.0",
    "project_urls": {
        "Homepage": "https://github.com/OCA/odoo-module-migrator"
    },
    "split_keywords": [
        "odoo community association (oca)",
        "odoo",
        "migration",
        "upgrade",
        "module"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "54ae8458207f1c522fd9c4c2a5c58c7760d5226f7af2541bd9c37b803fe1553a",
                "md5": "bb5381dae80b28f4a9372fdba345af4d",
                "sha256": "84e4cb3dc8a86648345cddf272b11629a960f688075ce60be0e14a37cab27b7e"
            },
            "downloads": -1,
            "filename": "odoo_module_migrator-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bb5381dae80b28f4a9372fdba345af4d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 43871,
            "upload_time": "2023-05-15T10:46:23",
            "upload_time_iso_8601": "2023-05-15T10:46:23.595083Z",
            "url": "https://files.pythonhosted.org/packages/54/ae/8458207f1c522fd9c4c2a5c58c7760d5226f7af2541bd9c37b803fe1553a/odoo_module_migrator-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "92b44bcf9caebd6eb41ecb80a5fb035de3396bd8ab97027e7715c7898100be41",
                "md5": "36b7258f819df4945787950e1aff070e",
                "sha256": "5332a520aed10afe937fd8e526d7a76aced7f93f198da67d67e707eebe9ece73"
            },
            "downloads": -1,
            "filename": "odoo-module-migrator-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "36b7258f819df4945787950e1aff070e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 36913,
            "upload_time": "2023-05-15T10:46:25",
            "upload_time_iso_8601": "2023-05-15T10:46:25.584140Z",
            "url": "https://files.pythonhosted.org/packages/92/b4/4bcf9caebd6eb41ecb80a5fb035de3396bd8ab97027e7715c7898100be41/odoo-module-migrator-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-15 10:46:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "OCA",
    "github_project": "odoo-module-migrator",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "test_requirements": [],
    "lcname": "odoo-module-migrator"
}
        
Elapsed time: 0.06637s