将Odoo模块从一个版本迁移到另一个版本的小工具
odoo-module-migrator的Python项目详细描述
odoo模块迁移器
odoo-module-migrator是一个python3库,它允许您自动实现 将Odoo模块从一个版本迁移到另一个版本时的重复更改。 例如:
- 正在将__openerp__.py文件重命名为__manifest__.py
- 从V11.0开始删除# -*- encoding: utf-8-*-
- 将openerpimport替换为odooimport
- 正在删除migrations文件夹
该库将:
- (可选)从旧分支获取提交(如果启用了格式修补程序)
- 自动应用更改。(重命名、替换等)
- (取决于配置和版本)黑你的代码。在
- 提交更改。在
- 如果代码属于过时的代码模式,则在日志中显示警告或错误。在
INFO log
它提到lib自动更改了一些内容。 你没有什么事可做。例如,对于从8.0迁移到 最新版本:
12:38:54 INFO Renaming file: '/my_module/__openerp__.py' by '/my_module/__manifest__.py'
{str}1警告
它提到你应该检查一些东西。有也许有事情要做 使模块正常工作。例如:
^{pr2}$错误日志
它提到你应该改变你的代码。不是,模块 不会工作,当然。(不可安装,或在 执行)
例如,如果您有一个8.0模块,它依赖于“account_anglo_-saxon”, 在较新版本中消失的,将显示以下日志
12:38:54 ERROR Depends on removed module 'account_anglo_saxon'
发展与改进
如果您想改进或完善此库,请阅读 DEVELOP.rst文件和“路线图/已知问题”部分。在
安装
pip3 install odoo-module-migrator
用法
使用Format Patch命令
(由OCA推荐)
例如,如果您想将Odoo模块从版本8.0迁移到12.0,例如 OCA“pos”存储库中的模块pos_order_pricelist_change。在
git clone https://github.com/OCA/pos -b 12.0 cd pos odoo-module-migrator --directory ./ --modules pos_order_pricelist_change --init-version-name 8.0 --target-version-name 12.0 --format-patch
没有格式修补命令
(主要用于自定义模块)
如果您已经基于10.0分支创建了一个新分支(例如12.0) 您可以运行以下命令
odoo-module-migrator --directory /path/to/repository --modules module_1,module_2,module_3 --init-version-name 10.0 --target-version-name 12.0
此工具将操作每个模块的更改。在
可用参数
name | shortcut | Options | description |
---|---|---|---|
^{tt10}$ | ^{tt11}$ | Default: ^{tt12}$ | Local folder that belongs the module(s) to migrate. |
^{tt13}$ | ^{tt14}$ | Required | Initial version of your module(s) you want to migrate. |
^{tt15}$ | ^{tt16}$ | Default: the laster odoo version | Final Version you want to migrate. |
^{tt17}$ | ^{tt18}$ | Default: All modules present in the directory | Module(s) to migrate. Note if format-patch option is enabled, you have to provide only one module. |
^{tt19}$ | ^{tt20}$ | disabled by default | Recover code, using git format-patch command. |
^{tt21}$ | ^{tt22}$ | Default: ^{tt23}$ | Name of the main remote, used by format-patch command. |
^{tt24}$ | ^{tt25}$ | depends on the configuration | Force to use black library. |
^{tt26}$ | ^{tt27}$ | Default: ^{tt28}$ | Possible value: ^{tt29}$, ^{tt28}$, ^{tt31}$, etc. |
^{tt32}$ | ^{tt33}$ | Default: False | If set, the logs will not be displayed at screen, but stored in a file |
^{tt34}$ | ^{tt35}$ | Default: commit | If set the library will not git add and git commit changes. |
路线图/已知问题
- 在这种情况下,用<;odoo>;替换标签<;opener>;<;data>;将失败 存在大量数据的地方。 我们可以用lxmllib而不是正则表达式来解决这个问题。在
变化
0.2.0(2019年10月13日)
- 第二次发行
0.1.4(2019年10月12日)
- 试验
[添加]测试
- 框架
[添加]--file-path选项。 [添加]_DEPRECATED_MODULES语法。在
- 迁移脚本
[修复]正则表达式语法不正确,要删除python 2头 [IMP]从8.0到13.0的所有步骤的首次发布
0.1.3(2019年10月11日)
- 框架
[ADD]--no-commit选项,用于禁用git ADD和git commit调用 [修复]如果迁移有许多步骤,请不要多次提交。 [REF]删除无用的注释代码 [REF]创建_commit_changes()和_replace_in_file()函数
- 元
[FIX]中项目的github url设置.py [添加]Travis文件+工作服链接 [添加]测试_要求.txt在
- 迁移脚本
[添加]12.0到13.0,如果找到指向web_settings_dashboard的引用,则添加警告。科特西@yelizariev [添加]清单文件中的凹凸版本 [ADD]将installable设置为True
0.1.2(2019年10月10日)
- 首次发布
- grap,Regional Food Group de Commission
- 热门话题
- 在glassfish3服务器上上载应用程序文件(ords.war)时发生java部署错误 java如何更改Elasticsearch上的别名值? java如何使用Xpath读取更多XSD模式? java使用jstl在两个jsp之间访问值 java将控制台输出转换为PDF文件 java在循环后没有得到任何结果,几乎完成 java运行的程序无法适应变化 java 安卓 RecyclerView添加新项目将回收移至列表顶部 将字符串转换为日期时的java偏移量 导入包的java问题 java gl。glScalef()隐藏gl。glDrawArrays()绘图 java在读取URL时没有协议异常 javascript Nashorn错误与某些函数有关