在 Odoo 中更新从 Developement 实例到 Production 实例的变化

Update changes from Developement instance to Production instance in Odoo

我在同一台服务器 (Ubuntu 14.04) 中有 2 个 Odoo v9 运行 实例。我想在开发实例中进行更改(安装模块、更改源代码或其他任何内容),并在确认它们正常后,将更改移至生产实例。有没有办法不重复整个开发过程?

谢谢。

据我了解,您不想停止生产实例。

如果它们只是 XML 文件,您可能只能通过从前端更新模块(应用程序-> 您的模块-> 更新。尽管如果您修改了 __openerp__.py 文件在你的模块中,你必须首先进入调试模式并单击 Update Apps List

对于模块 static 文件夹中文件的更改,您不需要停止服务器。不过,您的用户必须单击 ctr + shift + R 才能刷新缓存并将新内容带到浏览器中。

对于 Python 源代码,恐怕您必须停止服务器的两个实例,以便可以正确地重新编译代码。 (见注释 1)

最后你应该停止并更新所有内容,因为由于资源未正确更新,可能会随机弹出意外内容。

注 1: 关于 Python 模块编译的 Python 文档提到:

As an important speed-up of the start-up time for short programs that use a lot of standard modules, if a file called spam.pyc exists in the directory where spam.py is found, this is assumed to contain an already-“byte-compiled” version of the module spam. The modification time of the version of spam.py used to create spam.pyc is recorded in spam.pyc, and the .pyc file is ignored if these don’t match.

因此理论上,如果您在模块中修改 fileA.py 并生成新的 fileA.pyc,服务器将能够解释和使用它。无论如何,我遇到了两个实例 运行 的问题,其中 py 文件正在创建字段,而 XML 文件正在使用它,并且服务器报告尚未为 [=36 创建一个文件=] 查看,这意味着服务器确实获取并解析了 XML 文件,但没有重新编译 py.