Skip to content
Snippets Groups Projects
README.rst 5.16 KiB
Newer Older
Vincent Hatakeyama's avatar
Vincent Hatakeyama committed
odoo scripts
============

start
-----

This script can be used to start odoo.

It need to be run on a machine with all the odoo requirements installed, either system-wide or in a virtual environment (which need to be activated).

Its arguments are forwarded to the Odoo executable (``odoo-bin`` / ``openerp-server``).
Vincent Hatakeyama's avatar
Vincent Hatakeyama committed

It expect the configuration file (`setup.cfg`_) to have the following keys:

- ``odoo_type``: type of odoo (bzr, odoo7, odoo8 or odoo10) [default to odoo8]
- ``modules``: list of directories and files to include (also used by another script)
do_tests.py
-----------

This scripts launches the tests, but with more options than `do_tests`_. It uses docker by default, similar to `docker_dev_start.py`_.
Vincent Hatakeyama's avatar
Vincent Hatakeyama committed
do_tests
--------

This script create a database, install modules and run the tests on those modules and print the result.

It need to be run on a machine with all the odoo requirements installed, either system-wide or in a virtual environment (which need to be activated).
A postgresql server is also needed.

It takes two optional arguments, the host of the postgresql server, and the user for this base (which need database creation rights). If a user is provided, you will need to have a .pgpass with the password if it is not the one in ``conf/dev/odoo.conf``.
Vincent Hatakeyama's avatar
Vincent Hatakeyama committed

The script call `run_tests`_.
Vincent Hatakeyama's avatar
Vincent Hatakeyama committed

It expect the configuration file (`setup.cfg`_) to have the following keys:
- ``module_list``: list (separated by white space) of odoo modules to install on the database (default to empty list)
- ``unaccent``: boolean to indicate if unaccent is to be installed on the database (default to True)
Vincent Hatakeyama's avatar
Vincent Hatakeyama committed
run_tests
---------

This script run the tests on a database.

It need to be run on a machine with all the odoo requirements installed, either system-wide or in a virtual environment (which need to be activated).
A postgresql server is also needed.

The name of the database is the same as do_tests or can be provided.

The script call `start`_.
It expect the configuration file (`setup.cfg`_) to have the following keys:
- ``module_list_tests``: list (separated by white space) of odoo modules to run tests for on the database (default to empty list)
- ``odoo_type``: type of odoo (bzr, odoo7, odoo8 or odoo10) [default to odoo8]
conf2reST.py
This script is used to produce a reST file from setup.cfg, the Dockerfile and the ``.hgconf``/``nest.yaml`` file.

create_archive
--------------

zsh script to create a tar.xz file containing all sources.

update_duplicate_sources
------------------------

This script will update a metaproject that only contain the sources of the one it is launched from.

It expect the configuration file (`setup.cfg`_) to have the following keys:
- ``modules``: list of directories and files to include (also used by another script)
- ``dependencies``: list of directories and files to include (also used by another script)
- ``other_sources``: list of directories and files to include (only used by this script, used for README, ReleaseNotes, script directories, etc.)
 
No change are made to the name of the directories/files included.
docker_dev_start.py
-------------------

This script can be used to start an odoo from a docker but with the local addons modules mounted.

Using it avoids having to create a virtual env for every project.

Before you use this script, you need to install these packages:

.. code-block:: sh

  apt install python-docker python-psycopg2 python-requests

It expect the configuration file (`setup.cfg`_) to have the following keys:

- ``modules``: list of directories and files to include
- …

docker_build.py
---------------

This script builds a docker image of the project.

It uses the super project’s `setup.cfg`_ and ``Dockerfile``.

isort
-----

Run dockerized isort on current directory.

``./isort --help`` for help

setup.cfg
---------

The scripts expects configuration in the odoo_scripts section of ``setup.cfg``. This file is in the super project, not the one in ``odoo_scripts``.

Configuration keys:

modules
    list of modules to install (relative to project directory), those modules are the ones copied in the Dockerfile
odoo_type
    type of odoo (odoo7, odoo8, odoo10, odoo11)
pg.extensions
    postgresql extensions to install (unaccent is added automatically depending on odoo configuration)

Completion files for zsh
------------------------

Your ``.zshrc`` should contain a line like this::

  fpath=(~/.local/share/zsh/completion $fpath)

Create completion directory::

  mkdir -p ~/.local/share/zsh/completion

Clone::

  cd
  mkdir -p src
  cd src
  git clone git@github.com:RobSis/zsh-completion-generator.git

Generate completion file for python scripts (from the superproject for the scripts that need to be run from there, and with the required requirements too)::

  ./odoo_scripts/docker_dev_start.py --help | ~/src/zsh-completion-generator/help2comp.py docker_dev_start.py > ~/.local/share/zsh/completion/_docker_dev_start.py
  ./odoo_scripts/do_tests.py --help | ~/src/zsh-completion-generator/help2comp.py do_tests.py > ~/.local/share/zsh/completion/_do_tests.py
  ./odoo_scripts/conf2reST.py --help | ~/src/zsh-completion-generator/help2comp.py conf2reST.py > ~/.local/share/zsh/completion/_conf2reST.py

Alternatives: genzshcomp