diff --git a/11.0.Dockerfile b/11.0.Dockerfile index 1fa6c330..f3d88f63 100644 --- a/11.0.Dockerfile +++ b/11.0.Dockerfile @@ -79,7 +79,7 @@ RUN pip install \ watchdog \ wdb \ && sync -COPY bin/* /usr/local/bin/ +COPY bin-deprecated/* bin/* /usr/local/bin/ COPY lib/doodbalib /usr/local/lib/python3.5/site-packages/doodbalib RUN ln -s /usr/local/lib/python3.5/site-packages/doodbalib \ /usr/local/lib/python3.5/site-packages/odoobaselib diff --git a/12.0.Dockerfile b/12.0.Dockerfile index 84f59b62..f6669d6e 100644 --- a/12.0.Dockerfile +++ b/12.0.Dockerfile @@ -75,7 +75,7 @@ RUN pip install \ watchdog \ wdb \ && sync -COPY bin/* /usr/local/bin/ +COPY bin-deprecated/* bin/* /usr/local/bin/ COPY lib/doodbalib /usr/local/lib/python3.5/site-packages/doodbalib COPY build.d common/build.d COPY conf.d common/conf.d diff --git a/8.0.Dockerfile b/8.0.Dockerfile index 0c8fc251..9fb72548 100644 --- a/8.0.Dockerfile +++ b/8.0.Dockerfile @@ -82,7 +82,7 @@ RUN pip install \ virtualenv \ wdb \ && sync -COPY bin/* /usr/local/bin/ +COPY bin-deprecated/* bin/* /usr/local/bin/ COPY lib/doodbalib /usr/local/lib/python2.7/dist-packages/doodbalib RUN ln -s /usr/local/lib/python2.7/dist-packages/doodbalib \ /usr/local/lib/python2.7/dist-packages/odoobaselib diff --git a/README.md b/README.md index 45c0ac24..18ae6f81 100644 --- a/README.md +++ b/README.md @@ -317,7 +317,7 @@ l10n-spain: - l10n_es # Overrides built-in l10n_es under odoo/addons server-tools: - "*date*" # All modules that contain "date" in their name - - module_auto_update # Makes `autoupdate` script actually autoupdate addons + - auditlog web: - "*" # All web addons --- @@ -427,6 +427,8 @@ The great [`click-odoo`][] scripting framework and the collection of scripts found in [`click-odoo-contrib`][] are included. Refer to their sites to know how to use them. +\* Note: This replaces the deprecated `python-odoo-shell` binary. + ### [`nano`][] The CLI text editor we all know, just in case you need to inspect some bug in @@ -446,41 +448,7 @@ Usage: pot my_addon,my_other_addon -### `python-odoo-shell` - -Little shortcut to make your `odoo shell` scripts executable. - -For example, create this file in your scaffolding-based project: -`odoo/custom/shell-scripts/whoami.py`. Fill it with: - -```python -#!/usr/local/bin/python-odoo-shell -from __future__ import print_function -print(env.user.name) -print(env.context) -``` - -Now run it: - -```bash -$ chmod a+x odoo/custom/shell-scripts/whoami.py # Make it executable -$ docker-compose build --pull # Rebuild the image, unless in devel -$ docker-compose run --rm odoo custom/shell-scripts/whoami.py -``` - -### `unittest` - -Another little shell script, useful for debugging. Just run it like this and -Odoo will execute unit tests in its default database: - - unittest my_addon,my_other_addon - -Note that the addon must be installed for it to work. Otherwise, you should run -it as: - - unittest my_addon,my_other_addon -i my_addon,my_other_addon - -### [`psql`](https://www.postgresql.org/docs/9.5/static/app-psql.html) +### [`psql`](https://www.postgresql.org/docs/current/app-psql.html) Environment variables are there so that if you need to connect with the database, you just need to execute: @@ -990,8 +958,17 @@ In production: ##### Run unit tests for some addon - docker-compose run --rm odoo odoo --stop-after-init --init addon1,addon2 - docker-compose run --rm odoo unittest addon1,addon2 +```bash +modules=addon1,addon2 +# Install their dependencies first +docker-compose run --rm odoo addons init --dependencies $modules +# Test them at install +docker-compose run --rm odoo addons init --test $modules +# Test them again at update +docker-compose run --rm odoo addons update --test $modules +``` + +\* Note: This replaces the old deprecated `unittest` script. ##### Reading the logs @@ -1013,22 +990,19 @@ Only Odoo's: ##### Update changed addons only -Add `module_auto_update` from https://github.com/OCA/server-tools to your -installation following the standard methods of `repos.yaml` + `addons.yaml`. +Just run: -Now we will install the addon: +```bash +docker-compose run --rm odoo click-odoo-update --watcher-max-seconds 30 +``` - docker-compose up -d - docker-compose run --rm odoo --stop-after-init -u base - docker-compose run --rm odoo --stop-after-init -i module_auto_update - docker-compose restart odoo +This script is part of [`click-odoo-contrib`][]; check it for more details. -It will automatically update addons that got updated every night. -To force that automatic update now in a separate container: +\* Note: `--watcher-max-seconds` is available because we ship a +[patched](https://github.com/acsone/click-odoo-contrib/pull/38) +version. Check that PR for docs. - docker-compose up -d - docker-compose run --rm odoo autoupdate - docker-compose restart odoo +\* Note: This replaces the old deprecated `autoupdate` script. ##### Export some addon's translations to stdout diff --git a/bin/autoupdate b/bin-deprecated/autoupdate similarity index 84% rename from bin/autoupdate rename to bin-deprecated/autoupdate index cc9bd68e..51f36777 100755 --- a/bin/autoupdate +++ b/bin-deprecated/autoupdate @@ -5,7 +5,10 @@ import os _logger = logging.getLogger("autoupdate") # TODO Delete this script at some point -_logger.warning("`autoupdate` is DEPRECATED. Use click-odoo-update instead.") +_logger.warning( + "`autoupdate` is DEPRECATED and will be removed in Doodba 13.0, " + "use instead: click-odoo-update" +) # Note: ``module_auto_update`` must be installed in Odoo for this to work. try: diff --git a/bin/install.sh b/bin-deprecated/install.sh similarity index 100% rename from bin/install.sh rename to bin-deprecated/install.sh diff --git a/bin/python-odoo-shell b/bin-deprecated/python-odoo-shell similarity index 50% rename from bin/python-odoo-shell rename to bin-deprecated/python-odoo-shell index 31f3c4cc..9f2ac550 100755 --- a/bin/python-odoo-shell +++ b/bin-deprecated/python-odoo-shell @@ -1,3 +1,5 @@ #!/usr/bin/env bash export PYTHONOPTIMIZE="" # You'll want to `assert` in your scripts +log WARNING python-odoo-shell is deprecated and will be removed in \ + Doodba 13.0, use instead: click-odoo exec odoo shell < "$1" diff --git a/bin/unittest b/bin-deprecated/unittest similarity index 71% rename from bin/unittest rename to bin-deprecated/unittest index 866b8a23..f4017d92 100755 --- a/bin/unittest +++ b/bin-deprecated/unittest @@ -1,4 +1,6 @@ #!/bin/bash +log WARNING unittest is deprecated and will be removed in Doodba 13.0, \ + use instead: addons update --test $@ # Shortcut to run Odoo in unit testing mode set -e addons=$1