click-odoo 脚本集合
项目描述
click-odoo-contrib 是一组有用的Odoo维护函数。它们可以作为CLI脚本(基于click-odoo)使用,也可以作为可组合的Python函数。
脚本
click-odoo-copydb (测试版)
Usage: click-odoo-copydb [OPTIONS] SOURCE DEST
Create an Odoo database by copying an existing one.
This script copies using postgres CREATEDB WITH TEMPLATE. It also copies
the filestore.
Options:
-c, --config FILE ...
...
-f, --force-disconnect Attempt to disconnect users from the template
database.
--unless-dest-exists Don't report error if destination database already
exists.
--if-source-exists Don't report error if source database does not
exist.
--filestore-copy-mode [default|rsync|hardlink]
Mode for copying the filestore. Default uses
python shutil copytree which copies
everything. If the target filestore already
exists and just needs an update you can use
rsync to rsync the filestore instead. If both
filestores are on the same filesystem supporting
hardlinks you can use the option hardlink to hard
link the files to the inodes of the files of the
source directory which saves on space on the disk.
--help Show this message and exit.
click-odoo-dropdb (稳定版)
Usage: click-odoo-dropdb [OPTIONS] DBNAME
Drop an Odoo database and associated file store.
Options:
-c, --config FILE ...
...
--if-exists Don't report error if database doesn't exist.
--help Show this message and exit.
click-odoo-initdb (稳定版)
Usage: click-odoo-initdb [OPTIONS]
Create an Odoo database with pre-installed modules.
Almost like standard Odoo does with the -i option, except this script
manages a cache of database templates with the exact same addons
installed. This is particularly useful to save time when initializing test
databases.
Cached templates are identified by computing a sha1 checksum of modules
provided with the -m option, including their dependencies and
corresponding auto_install modules.
Options:
-c, --config FILE ...
...
-n, --new-database TEXT Name of new database to create, possibly from
cache. If absent, only the cache trimming
operation is executed.
-m, --modules TEXT Comma separated list of addons to install.
[default: base]
--demo / --no-demo Load Odoo demo data. [default: True]
--cache / --no-cache Use a cache of database templates with the exact
same addons installed. Disabling this option also
disables all other cache-related operations such
as max-age or size. Note: when the cache is
enabled, all attachments created during database
initialization are stored in database instead of
the default Odoo file store. [default: True]
--cache-prefix TEXT Prefix to use when naming cache template databases
(max 8 characters). CAUTION: all databases named
like {prefix}-____________-% will eventually be
dropped by the cache control mechanism, so choose
the prefix wisely. [default: cache]
--cache-max-age INTEGER Drop cache templates that have not been used for
more than N days. Use -1 to disable. [default:
30]
--cache-max-size INTEGER Keep N most recently used cache templates. Use -1
to disable. Use 0 to empty cache. [default: 5]
--unless-exists Don't report error if database already exists.
--help Show this message and exit.
click-odoo-backupdb (测试版)
Usage: click-odoo-backupdb [OPTIONS] DBNAME DEST
Create an Odoo database backup.
This script dumps the database using pg_dump. It also copies the filestore.
Unlike Odoo, this script allows you to make a backup of a database without
going through the web interface. This avoids timeout and file size
limitation problems when databases are too large.
It also allows you to make a backup directly to a directory. This type of
backup has the advantage that it reduces memory consumption since the
files in the filestore are directly copied to the target directory as well
as the database dump.
Options:
-c, --config FILE ...
...
--force Don't report error if destination file/folder
already exists. [default: False]
--if-exists Don't report error if database does not exist.
--format [zip|dump|folder] Output format [default: zip]
--filestore / --no-filestore Include filestore in backup [default: True]
--help Show this message and exit.
click-odoo-restoredb (测试版)
Usage: click-odoo-restoredb [OPTIONS] DBNAME SOURCE
Restore an Odoo database backup.
This script allows you to restore databses created by using the Odoo web
interface or the backupdb script. This avoids timeout and file size
limitation problems when databases are too large.
Options:
-c, --config FILE ...
...
--copy / --move This database is a copy. In order to avoid conflicts
between databases, Odoo needs to know if thisdatabase was
moved or copied. If you don't know, set is a copy.
--force Don't report error if destination database already
exists. If force and destination database exists, it will
be dropped before restore. [default: False]
--neutralize Neutralize the database after restore. This will disable
scheduled actions, outgoing emails, and sets other
external providers in test mode. This works only in odoo
16.0 and above.
--jobs INTEGER Uses this many parallel jobs to restore. Only used to
restore folder format backup.
--help Show this message and exit.
click-odoo-makepot (稳定版)
Usage: click-odoo-makepot [OPTIONS]
Export translation (.pot) files of addons installed in the database and
present in addons_dir. Additionally, run msgmerge on the existing .po
files to keep them up to date. Commit changes to git, if any.
Options:
-c, --config FILE ...
-d, --database TEXT ...
...
--addons-dir TEXT [default: .]
-m, --modules TEXT Comma separated list of addons to export
translation.
--msgmerge / --no-msgmerge Merge .pot changes into all .po files
[default: False]
--msgmerge-if-new-pot / --no-msg-merge-if-new-pot
Merge .pot changes into all .po files, only
if a new .pot file has been created.
[default: False]
--fuzzy-matching / --no-fuzzy-matching
Use fuzzy matching when merging .pot changes
into .po files.
Only applies when --msgmerge
or --msgmerge-if-new-pot are passed.
[default: True]
--purge-old-translations / --no-purge-old-translations
Remove comment lines containing old
translations from .po files.
Only applies when --msgmerge
or --msgmerge-if-new-pot are passed.
[default: False]
--commit / --no-commit Git commit exported .pot files if needed.
[default: False]
--help Show this message and exit.
click-odoo-listdb (测试版)
Usage: click-odoo-listdb [OPTIONS]
List Odoo databases.
Options:
-c, --config FILE Specify the Odoo configuration file. Other ways to
provide it are with the ODOO_RC or OPENERP_SERVER
environment variables, or ~/.odoorc (Odoo >= 10) or
~/.openerp_serverrc.
--log-level TEXT Specify the logging level. Accepted values depend on the
Odoo version, and include debug, info, warn, error.
[default: warn]
--logfile FILE Specify the log file.
--help Show this message and exit.
click-odoo-uninstall (稳定版)
Usage: click-odoo-uninstall [OPTIONS]
Options:
-c, --config PATH ...
-d, --database TEXT ...
...
-m, --modules TEXT Comma-separated list of modules to uninstall
[required]
--help Show this message and exit.
click-odoo-update (稳定版)
Usage: click-odoo-update [OPTIONS]
Update an Odoo database (odoo -u), automatically detecting addons to
update based on a hash of their file content, compared to the hashes
stored in the database.
It allows updating in parallel while another Odoo instance is still
running against the same database, by using a watcher that aborts the
update in case a DB lock happens.
Options:
-c, --config FILE Specify the Odoo configuration file. Other ways
to provide it are with the ODOO_RC or
OPENERP_SERVER environment variables, or
~/.odoorc (Odoo >= 10) or ~/.openerp_serverrc.
--addons-path TEXT Specify the addons path. If present, this
parameter takes precedence over the addons path
provided in the Odoo configuration file.
-d, --database TEXT Specify the database name. If present, this
parameter takes precedence over the database
provided in the Odoo configuration file.
--log-level TEXT Specify the logging level. Accepted values
depend on the Odoo version, and include debug,
info, warn, error. [default: info]
--logfile FILE Specify the log file.
--i18n-overwrite Overwrite existing translations
--update-all Force a complete upgrade (-u base)
--ignore-addons TEXT A comma-separated list of addons to ignore.
These will not be updated if their checksum has
changed. Use with care.
--ignore-core-addons If this option is set, Odoo CE and EE addons
are not updated. This is normally safe, due the
Odoo stable policy.
--if-exists Don't report error if database doesn't exist
--watcher-max-seconds FLOAT Max DB lock seconds allowed before aborting the
update process. Default: 0 (disabled).
--list-only Log the list of addons to update without
actually updating them.
--help Show this message and exit.
有用链接
开发
要运行测试,请输入 tox。测试使用 pytest 进行。要运行匹配特定关键词的测试,例如针对 Odoo 12 和 Python 3.6,使用 tox -e py36-12.0 -- -k keyword。运行测试需要有一个可以无密码访问的用户在 /var/run/postgresql/.s.PGSQL.5432 上的 postgres 服务器。
在您提交之前,确保遵守本地编码规范,请安装 pre-commit 并在克隆仓库后运行 pre-commit install。
要发布,请在 GitHub 上创建一个带标签的发布。这将触发发布到 PyPI。
致谢
贡献者
维护者
该项目由 ACSONE SA/NV 维护。
变更
1.9 (2024-07-22)
功能
click-odoo-restoredb:添加 --neutralize 选项。此选项仅在 Odoo 16.0 及以上版本中有效。(#143)
1.18.1 (2023-11-16)
功能
click-odoo-update:当没有模块需要更新时,不要运行/更新 Odoo。(#144)
1.18.0 (2023-10-29)
功能
支持 Odoo 17。(#190)
1.17.0 (2023-09-03)
功能
1.16.0 (2022-09-21)
功能
添加对 manifestoo_core 的依赖以获取 Odoo 核心插件列表(由 click-odoo-update 用于忽略核心插件)。(#114)
为 Odoo 16 适配 click-odoo-update。(#119)
弃用和删除
移除对 Python < 3.6 和 Odoo < 11 的支持。(#110)
1.15.1 (2021-12-04)
错误修复
静默 Odoo 15 关于使用自动提交的嘈杂警告。(#105)
1.15.0 (2021-10-06)
功能
更新核心插件列表,支持 Odoo 15。(#104)
1.14.0 (2021-06-28)
功能
添加一个新的选项以启用使用 rsync 和硬链接来复制文件存储: –filestore-copy-mode [default|rsync|hardlink]。(#86)
1.13.0 (2021-06-25)
功能
备份和恢复命令:添加对“dump”格式的支持。(#79)
click-odoo-makepot:添加 –modules 选项以选择要导出的模块。(#92)
click-odoo-update:也将所有修改过的模块传递给 Odoo,以便在更新状态中进行更新;这有助于在新依赖项存在时升级,与 Odoo #72661 结合使用。(#97)
错误修复
click-odoo-update:不要尝试更新不可卸载的插件。(#89)
1.12.0 (2020-11-25)
功能
click-odoo-makepot 获得了新的选项,用于控制它如何合并现有 .po 文件中的新字符串: --no-fuzzy-matching 和 --purge-old-translation。(#87)
1.11.0 (2020-10-01)
功能
1.10.1 (2020-04-29)
错误修复
click-odoo-update:修复打包问题(缺少核心插件列表)。 (#77)
1.10.0 (2020-04-28)
功能
click-odoo-initdb:添加对数据库名称中点号和下划线的支持。 (#35)
click-odoo-update:添加 –list-only 选项。 (#68)
click-odoo-update:添加 –ignore-addons 和 –ignore-core-addons 选项以排除插件,使其不参与校验和更改检测。 (#69)
改进文档
initdb、dropdb、update:移出测试版。 (#70)
弃用和删除
移除已弃用的 click-odoo-upgrade。 (#71)
1.9.0 (2020-03-23)
click-odoo-update:在数据库上获取咨询锁,以确保多个 click-odoo-update 实例不会同时在同一数据库上启动(当有多个 Odoo 实例在同一数据库上运行并且所有实例在启动时都运行 click-odoo-update 时很有用)
1.8.0 (2019-10-01)
支持 Odoo SaaS 版本
click-odoo-update 现在在另一个 Odoo 实例运行相同数据库的情况下提供了一些更新支持,通过使用监视器在发生 DB 锁定时中止更新(这是一个高级功能)
1.7.0 (2019-09-02)
makepot:始终检查 .po 文件的正确性
1.6.0 (2019-03-28)
update:支持 postgres 9.4
backupdb:当 list_db 为 false 时也能正常工作
backupdb:新 –(no-)filestore 选项
dropdb:重构以使用 Odoo api 而不是自定义代码
1.5.0 (2019-02-05)
添加 click-odoo-backupdb
1.4.1 (2018-11-21)
修复损坏的 click-odoo-update –i18n-overwrite
1.4.0 (2018-11-19)
新的 click-odoo-update,它实现了 module_auto_update 的功能,无需在数据库中安装 module_auto_update,并且更加健壮(在识别要更新的模块后执行常规 -u)
upgrade:弃用,以 click-odoo-update 代替
initdb:保存已安装的校验和,以便 click-odoo-update 可以方便地使用它们
initdb:添加 –addons-path 选项
copydb:修复源文件存储不存在时的错误
1.3.1 (2018-11-05)
向 click-odoo-initdb 添加 –unless-exists 选项
1.3.0 (2018-10-31)
添加 click-odoo-copydb
添加 click-odoo-dropdb
向 click-odoo-upgrade 添加 –if-exists 选项
1.2.0 (2018-10-07)
支持 Odoo 12
1.1.4 (2018-06-21)
makepot:修复当 addons-dir 不是当前目录时的问题(这也应该修复存在符号链接时的问题)
1.1.3 (2018-06-20)
makepot:添加 –commit-message 选项
1.1.2 (2018-06-20)
makepot:强制 git add,以防 .pot 文件在 .gitignore 中(为 https://github.com/OCA/maintainer-quality-tools/issues/558 制作)
1.1.1 (2018-06-16)
makepot:添加 –msgmerge-if-new-pot 选项
1.1.0 (2018-06-13, Sevilla OCA代码马拉松)
添加 click-odoo-makepot
在 click-odoo-initdb 中,将 active=True 的模块包含在哈希计算中(因为 active=True 的模块由 Odoo 自动安装)
1.0.4 (2018-06-02)
在从缓存创建数据库后更新模块列表,这在我们在创建数据库的环境中添加了模块而模板已创建时很有用
1.0.3 (2018-05-30)
修复:处理两个 initdb 同时启动,导致创建缓存模板时出现“已存在”错误的情况
1.0.2 (2018-05-29)
修复:initdb 现在在启用缓存时将附件存储在数据库中,因此从缓存创建的数据库不会丢失文件存储
1.0.1 (2018-05-27)
更好的文档
修复:initdb 现在考虑自动安装模块
1.0.0 (2018-05-27)
添加 click-odoo-initdb
1.0.0b3 (2018-05-17)
在按钮_upgrade静默失败的情况下,更加健壮
1.0.0b2 (2018-03-28)
卸载:提交并隐藏 – 回滚
升级:重构以添加可组合函数
1.0.0b1 (2018-03-28)
升级:在完整升级后保存已安装的校验和
1.0.0a1 (2018-03-22)
第一个alpha版本
点击-odoo卸载
点击-odoo升级
项目详情
下载文件
下载适用于您平台的文件。如果您不确定选择哪一个,请了解更多关于 安装包 的信息。