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

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.

主站蜘蛛池模板: 金沙县| 丰县| 九江市| 南和县| 哈巴河县| 四子王旗| 灵宝市| 辉县市| 四平市| 武清区| 高雄市| 姚安县| 桂阳县| 红原县| 垦利县| 博野县| 正宁县| 中阳县| 浮山县| 满洲里市| 红河县| 儋州市| 武义县| 庆元县| 清镇市| 丰县| 蕉岭县| 都安| 桃源县| 甘谷县| 东乌珠穆沁旗| 内丘县| 尼玛县| 兴化市| 来宾市| 鄂尔多斯市| 永州市| 南阳市| 宿松县| 大庆市| 德兴市|