diff --git a/module_analysis/README.rst b/module_analysis/README.rst index 0ef3d66c8..7c4986615 100644 --- a/module_analysis/README.rst +++ b/module_analysis/README.rst @@ -56,9 +56,8 @@ Installation To use this module, you have to install the application ``cloc`` -.. code-block:: shell +``sudo apt-get install cloc`` - sudo apt-get install cloc Configuration ============= diff --git a/module_analysis/__init__.py b/module_analysis/__init__.py index 0650744f6..b4e782e8d 100644 --- a/module_analysis/__init__.py +++ b/module_analysis/__init__.py @@ -1 +1,19 @@ from . import models + +# Copyright 2016-2018 Akretion France +# @author: Alexis de Lattre +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, SUPERUSER_ID + + +def post_init_hook(cr, registry): + """This post_install script is required because, when the module + is installed, Odoo creates the column in the DB and compute the field + and THEN it loads the file data/res_country_department_data.yml... + So, when it computes the field on module installation, the + departments are not available in the DB, so the department_id field + on res.partner stays null. This post_install script fixes this.""" + print("=====================") + print("=====================") + print("=====================") diff --git a/module_analysis/__manifest__.py b/module_analysis/__manifest__.py index fe304b429..7c1e35341 100644 --- a/module_analysis/__manifest__.py +++ b/module_analysis/__manifest__.py @@ -29,5 +29,6 @@ 'external_dependencies': { 'lib': ['cloc'], }, + 'post_init_hook': 'post_init_hook', 'installable': True, } diff --git a/module_analysis/readme/INSTALL.rst b/module_analysis/readme/INSTALL.rst index 019f9c023..0064beeb9 100644 --- a/module_analysis/readme/INSTALL.rst +++ b/module_analysis/readme/INSTALL.rst @@ -1,5 +1,3 @@ To use this module, you have to install the application ``cloc`` -.. code-block:: shell - - sudo apt-get install cloc +``sudo apt-get install cloc``