Skip to main content

click-odoo scripts collection

Project description

License: LGPL-3 https://badge.fury.io/py/click-odoo-contrib.svg

click-odoo-contrib is a set of useful Odoo maintenance functions. They are available as CLI scripts (based on click-odoo), as well as composable python functions.

Scripts

click-odoo-copydb (beta)

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.
  --help                  Show this message and exit.

click-odoo-dropdb (beta)

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 (beta)

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 (beta)

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|folder]         Output format  [default: zip]
--filestore / --no-filestore  Include filestore in backup  [default: True]
--help                        Show this message and exit.

click-odoo-makepot (stable)

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: .]
  --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]
  --commit / --no-commit      Git commit exported .pot files if needed.
                              [default: False]
  --help                      Show this message and exit.

click-odoo-uninstall (stable)

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 (beta)

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.

Options:
  -c, --config FILE    ...
  -d, --database TEXT  ...
  ...
  --i18n-overwrite     Overwrite existing translations
  --update-all         Force a complete upgrade (-u base)
  --if-exists          Don't report error if database doesn't exist
  --help               Show this message and exit.

click-odoo-upgrade (deprecated, see click-odoo-update)

Usage: click-odoo-upgrade [OPTIONS]

  Upgrade an Odoo database (odoo -u), taking advantage of
  module_auto_update's upgrade_changed_checksum method if present.

Options:
  -c, --config FILE    ...
  -d, --database TEXT  ...
  ...
  --i18n-overwrite     Overwrite existing translations
  --upgrade-all        Force a complete upgrade (-u base)
  --if-exists          Don't report error if database doesn't exist.
  --help               Show this message and exit.

Developement

To run tests, type tox. Tests are made using pytest. To run tests matching a specific keyword for, say, Odoo 12 and python 3.6, use tox -e py36-12.0 -- -k keyword.

This project uses black as code formatting convention, as well as isort and flake8. To make sure local coding convention are respected before you commit, install pre-commit and run pre-commit install after cloning the repository.

Credits

Contributors:

Maintainer

ACSONE SA/NV

This project is maintained by ACSONE SA/NV.

Changes

1.6.0 (2019-03-28)

  • update: support postgres 9.4

  • backupdb: work correctly when list_db is false too

  • backupdb: new –(no-)filestore option

  • dropdb: refactored to use Odoo api instead of custom code

1.5.0 (2019-02-05)

  • add click-odoo-backupdb

1.4.1 (2018-11-21)

  • fix broken click-odoo-update –i18n-overwrite

1.4.0 (2018-11-19)

  • new click-odoo-update which implements the functionality of module_auto_update natively, alleviating the need to have module_auto_update installed in the database, and is more robust (it does a regular -u after identifying modules to update)

  • upgrade: deprecated in favor of click-odoo-update

  • initdb: save installed checksums so click-odoo-update can readily use them

  • initdb: add –addons-path option

  • copydb: fix error when source filestore did not exist

1.3.1 (2018-11-05)

  • Add –unless-exists option to click-odoo-initdb

1.3.0 (2018-10-31)

  • Add click-odoo-copydb

  • Add click-odoo-dropdb

  • Add –if-exists option to click-odoo-upgrade

1.2.0 (2018-10-07)

  • Odoo 12 support

1.1.4 (2018-06-21)

  • makepot: fix issue when addons-dir is not current directory (this should also fix issues when there are symlinks)

1.1.3 (2018-06-20)

  • makepot: add –commit-message option

1.1.2 (2018-06-20)

1.1.1 (2018-06-16)

  • makepot: add –msgmerge-if-new-pot option

1.1.0 (2018-06-13, Sevilla OCA code sprint)

  • add click-odoo-makepot

  • in click-odoo-initdb, include active=True modules in hash computation (because modules with active=True are auto installed by Odoo)

1.0.4 (2018-06-02)

  • update module list after creating a database from cache, useful when we are creating a database in an environment where modules have been added since the template was created

1.0.3 (2018-05-30)

  • fix: handle situations where two initdb start at the same time ending up with an “already exists” error when creating the cached template

1.0.2 (2018-05-29)

  • fix: initdb now stores attachments in database when cache is enabled, so databases created from cache do not miss the filestore

1.0.1 (2018-05-27)

  • better documentation

  • fix: initdb now takes auto_install modules into account

1.0.0 (2018-05-27)

  • add click-odoo-initdb

1.0.0b3 (2018-05-17)

  • be more robust in rare case button_upgrade fails silently

1.0.0b2 (2018-03-28)

  • uninstall: commit and hide –rollback

  • upgrade: refactor to add composable function

1.0.0b1 (2018-03-28)

  • upgrade: save installed checksums after full upgrade

1.0.0a1 (2018-03-22)

  • first alpha

  • click-odoo-uninstall

  • click-odoo-upgrade

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

click-odoo-contrib-1.6.0.tar.gz (37.0 kB view details)

Uploaded Source

Built Distribution

click_odoo_contrib-1.6.0-py2.py3-none-any.whl (26.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file click-odoo-contrib-1.6.0.tar.gz.

File metadata

  • Download URL: click-odoo-contrib-1.6.0.tar.gz
  • Upload date:
  • Size: 37.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.14

File hashes

Hashes for click-odoo-contrib-1.6.0.tar.gz
Algorithm Hash digest
SHA256 2da4f9c27077cbea0a9f75b3587b5b7602bc4a1293cd2065c71432a9d1dc62d9
MD5 076f2a9150b2bde24bdc28adeaf0845e
BLAKE2b-256 7f522d60b5b62d3c04562a0845a8e70578f95960aad1517ced5ad0d6fa71c0ce

See more details on using hashes here.

File details

Details for the file click_odoo_contrib-1.6.0-py2.py3-none-any.whl.

File metadata

  • Download URL: click_odoo_contrib-1.6.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.14

File hashes

Hashes for click_odoo_contrib-1.6.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c4bd8de4d8b70aa37e6a545385701cc0e4dade3f2eb1c4742d1f0df288a08bf9
MD5 d7114bf512915150dedcb8603fd67c62
BLAKE2b-256 caa3ccbda3675dc1c4563e1d3473a732871d42a49db7b060aa712bf430ef34de

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page