官术网_书友最值得收藏!

Upgrading a module

Developing a module is an iterative process, and you will want changes made on source files to be applied to and made visible in Odoo.

In many cases, this is done by upgrading the module: look up the module in the Apps list and once it is already installed, you will have an Upgrade button available.

However, when the changes are only in Python code, the upgrade may not have an effect. Instead of a module upgrade, an application server restart is needed. Since Odoo loads Python code only once, any later changes to code require a server restart to be applied.

In some cases, if the module changes were in both data files and Python code, you might need both the operations. This is a common source of confusion for new Odoo developers.

But fortunately, there is a better way. The safest way to make all our changes to a module effective is to stop and restart the server instance, requesting our modules to be upgraded to our work database.

In the terminal where the server instance is running, use Ctrl + C to stop it. Then, start the server and upgrade the todo_app module using the following command:

$ ./odoo-bin -d todo -u todo_app

The -u option (or --update in the long form) requires the -d option and accepts a comma-separated list of modules to update. For example, we could use -u todo_app,mail. When a module is updated, all other installed modules depending on it are also updated. This is essential to maintain the integrity of the inheritance mechanisms, used to extend features.

Throughout the book, when you need to apply the work done in modules, the safest way is to restart the Odoo instance with the preceding command. Pressing the up arrow key brings to you the previous command that was used. So, most of the time, you will find yourself using the Ctrl + C, up, and Enter key combination.

Until Odoo 10.0, before a new addon module could be installed, the module list had to be manually updated from the web client menu option for it to be known to Odoo. Since 11.0, the list of modules available has been automatically updated when a module is installed or updated.

Similarly, a -i option, or --install,  is also available to perform the installation (or reinstallation) of modules. For new modules, you had to update the module list in the web client before they could be installed, but since Odoo 11 this has not been necessary and new modules can immediately be installed.

主站蜘蛛池模板: 潞西市| 桦川县| 呼和浩特市| 昭苏县| 河北省| 定西市| 阜康市| 慈利县| 肇源县| 蓬安县| 龙江县| 平邑县| 凯里市| 莫力| 仙居县| 内黄县| 屯昌县| 金沙县| 女性| 安溪县| 西充县| 堆龙德庆县| 樟树市| 江门市| 镇远县| 钦州市| 南通市| 绩溪县| 新民市| 乾安县| 克山县| 饶阳县| 扬州市| 秭归县| 芦山县| 凉城县| 千阳县| 当雄县| 东至县| 明水县| 鄄城县|