# odoo-analyse
Analyse tool for odoo modules
## Installation
Install the module with the ability to render graphs:
```bash
apt install cloc graphviz
npm install -g eslintcc # required for JS complexity
pip3 install "odoo-analyse[graph]"
```
## Usage
```odoo_analyse --help```
### Read in modules
`--config /path/to/odoo.cfg` .. Load modules using an odoo configuration file
`--path /path/to/modules` .. Load modules within a directory
`--load /path/to/data.json` .. Load the modules from a previously stored data file
Or if you want to load the file from `stdin`:
`--load -` .. Loads the data from the module analysis directly from the `stdin`
### Save the loaded modules
`-s /path/to/data.json` .. Store the loaded modules in a file
Or if you want to output it to `stdout`:
`-s -` .. Output the loaded modules to `stdout`
### Filtering
`--modules '*'` .. Only show modules with a matching name
`--models '*'` .. Only show models with a matching name
`--views '*'` .. Only show views with a matching name
`--path-filter '*'` .. Only modules with a matching file path
`--test-filter` .. Include module starting with `test_`
`--estimate-state` .. Estimate the state of a module (installed/uninstalled) only using dependencies and auto_install flags.
`--state-filter installed` .. Only modules with a specific state. This connects to a database to determine the state of a module. The connection information are extracted from a configuration file or using the database parameters
`--full-graph` .. If set all the above filters are only used for the starting nodes and not for the base modules
### Module graph
Use atleast one of the following `--show-*` options to show a module graph.
`--show-dependency` .. Show module dependencies from the manifests
`--show-import` .. Show imports of module from other modules
`--show-reference` .. Show XML references of modules from other modules
`--migration '*'` .. Color all modules with a matching version
### Database
These options can be used to extract instance specific information about modules such as installation state to be used in filters.
`--db-host host` .. Host on which the database is running
`--db-port 5432` .. Port on which the database is running
`--db-name odoo` .. Name of the database
`--db-user user` .. Name of the user to access the database
`--db-password` .. If specified a password prompt will ask for the password to connect to the database
### Skipping
These options control what is analysed and can result in a faster analyse.
`--skip-all` .. All of the below
`--skip-assets` .. Skip analysing assets (JS, CSS, Web Templates, ...)
`--skip-data` .. Skip analysing CSV and XML data
`--skip-language` .. Skip analysing the lines of code
`--skip-python` .. Skip analysing python files (controllers, models, ...)
`--skip-readme` .. Skip reading the readme files
## Examples
### Usage as library
If you'd like to import the package and use it within a Odoo module you can add it as an import and call the options:
```python
>>> from odoo_analyse import Odoo
>>> odoo = Odoo.from_path(".")
>>> odoo["auth_session_timeout"].models
{'ir.http': <Model: ir.http>, 'ir.config_parameter': <Model: ir.config_parameter>, 'res.users': <Model: res.users>}
>>> odoo["auth_session_timeout"].manifest
{"auth_session_timeout": {"path": "/x/y/z", "name": "auth_session_timeout", ...}}
```
### Usage as command line tool
```bash
# Analyse all modules in a folder and create a module dependency graph to module.gv.pdf
$ odoo_analyse -p /path/to/modules --show-dependency
# Analyse all available modules of an Odoo instance and save it to a json file for later usage
$ odoo_analyse -c /path/to/odoo.cfg -s /path/to/cache.json
```
The following examples are using a previously created cache file.
```bash
# Create the dependency graph of all modules starting with `sale_`
$ odoo_analyse -l /path/to/cache.json --modules 'sale_*' --show-dependency
# Create the full dependency graph of all modules starting with `sale_`
$ odoo_analyse -l /path/to/cache.json --modules 'sale_*' --show-dependency --full-graph
# Connect to the database from the odoo.cfg and create the dependency graph of all installed modules
$ odoo_analyse -l /path/to/cache.json -c /path/to/odoo.cfg --state-filter installed --show-dependency
# Estimate the state using the module dependencies and auto_install flags based on the `modules` given via stdin. Output the analysed installed modules to `analyse.json`.
$ cat modules.txt | odoo_analyse -p odoo --modules - --analyse analyse.json --estimate-state --state-filter installed
```
Raw data
{
"_id": null,
"home_page": "https://github.com/initOS/odoo-analyse",
"name": "odoo-analyse",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "odoo modules analyze dependency graph",
"author": "initOS GmbH",
"author_email": "info@initos.com",
"download_url": "",
"platform": null,
"description": "# odoo-analyse\n\nAnalyse tool for odoo modules\n\n## Installation\n\nInstall the module with the ability to render graphs:\n```bash\napt install cloc graphviz\nnpm install -g eslintcc # required for JS complexity\npip3 install \"odoo-analyse[graph]\"\n```\n\n## Usage\n\n```odoo_analyse --help```\n\n### Read in modules\n\n`--config /path/to/odoo.cfg` .. Load modules using an odoo configuration file\n\n`--path /path/to/modules` .. Load modules within a directory\n\n`--load /path/to/data.json` .. Load the modules from a previously stored data file\n\nOr if you want to load the file from `stdin`:\n\n`--load -` .. Loads the data from the module analysis directly from the `stdin`\n\n### Save the loaded modules\n\n`-s /path/to/data.json` .. Store the loaded modules in a file\n\nOr if you want to output it to `stdout`:\n\n`-s -` .. Output the loaded modules to `stdout`\n\n### Filtering\n\n`--modules '*'` .. Only show modules with a matching name\n\n`--models '*'` .. Only show models with a matching name\n\n`--views '*'` .. Only show views with a matching name\n\n`--path-filter '*'` .. Only modules with a matching file path\n\n`--test-filter` .. Include module starting with `test_`\n\n`--estimate-state` .. Estimate the state of a module (installed/uninstalled) only using dependencies and auto_install flags.\n\n`--state-filter installed` .. Only modules with a specific state. This connects to a database to determine the state of a module. The connection information are extracted from a configuration file or using the database parameters\n\n`--full-graph` .. If set all the above filters are only used for the starting nodes and not for the base modules\n\n### Module graph\n\nUse atleast one of the following `--show-*` options to show a module graph.\n\n`--show-dependency` .. Show module dependencies from the manifests\n\n`--show-import` .. Show imports of module from other modules\n\n`--show-reference` .. Show XML references of modules from other modules\n\n`--migration '*'` .. Color all modules with a matching version\n\n### Database\n\nThese options can be used to extract instance specific information about modules such as installation state to be used in filters.\n\n`--db-host host` .. Host on which the database is running\n\n`--db-port 5432` .. Port on which the database is running\n\n`--db-name odoo` .. Name of the database\n\n`--db-user user` .. Name of the user to access the database\n\n`--db-password` .. If specified a password prompt will ask for the password to connect to the database\n\n### Skipping\n\nThese options control what is analysed and can result in a faster analyse.\n\n`--skip-all` .. All of the below\n\n`--skip-assets` .. Skip analysing assets (JS, CSS, Web Templates, ...)\n\n`--skip-data` .. Skip analysing CSV and XML data\n\n`--skip-language` .. Skip analysing the lines of code\n\n`--skip-python` .. Skip analysing python files (controllers, models, ...)\n\n`--skip-readme` .. Skip reading the readme files\n\n## Examples\n\n### Usage as library\n\nIf you'd like to import the package and use it within a Odoo module you can add it as an import and call the options:\n```python\n>>> from odoo_analyse import Odoo\n>>> odoo = Odoo.from_path(\".\")\n>>> odoo[\"auth_session_timeout\"].models\n{'ir.http': <Model: ir.http>, 'ir.config_parameter': <Model: ir.config_parameter>, 'res.users': <Model: res.users>}\n>>> odoo[\"auth_session_timeout\"].manifest\n{\"auth_session_timeout\": {\"path\": \"/x/y/z\", \"name\": \"auth_session_timeout\", ...}}\n```\n\n### Usage as command line tool\n\n```bash\n# Analyse all modules in a folder and create a module dependency graph to module.gv.pdf\n$ odoo_analyse -p /path/to/modules --show-dependency\n\n# Analyse all available modules of an Odoo instance and save it to a json file for later usage\n$ odoo_analyse -c /path/to/odoo.cfg -s /path/to/cache.json\n```\n\nThe following examples are using a previously created cache file.\n\n```bash\n# Create the dependency graph of all modules starting with `sale_`\n$ odoo_analyse -l /path/to/cache.json --modules 'sale_*' --show-dependency\n\n# Create the full dependency graph of all modules starting with `sale_`\n$ odoo_analyse -l /path/to/cache.json --modules 'sale_*' --show-dependency --full-graph\n\n# Connect to the database from the odoo.cfg and create the dependency graph of all installed modules\n$ odoo_analyse -l /path/to/cache.json -c /path/to/odoo.cfg --state-filter installed --show-dependency\n\n# Estimate the state using the module dependencies and auto_install flags based on the `modules` given via stdin. Output the analysed installed modules to `analyse.json`.\n$ cat modules.txt | odoo_analyse -p odoo --modules - --analyse analyse.json --estimate-state --state-filter installed\n```\n",
"bugtrack_url": null,
"license": "LGPL-3.0",
"summary": "Package to analyse odoo modules",
"version": "2.0.0",
"project_urls": {
"Documentation": "https://github.com/initOS/odoo-analyse/blob/master/README.md",
"Homepage": "https://github.com/initOS/odoo-analyse",
"Usage": "https://odoo-code-search.com"
},
"split_keywords": [
"odoo",
"modules",
"analyze",
"dependency",
"graph"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "41460d48c52e952f65f1fc74b0f19beae5690dcfd2b71a71d70c64b6e0ebb351",
"md5": "cc7795c1884fa168601494daed36ad6a",
"sha256": "4d8c42e134269f4f14c9a96da308f5d01edd6351636f0bbf1b1624e8f5409466"
},
"downloads": -1,
"filename": "odoo_analyse-2.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cc7795c1884fa168601494daed36ad6a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 28089,
"upload_time": "2024-03-19T07:30:37",
"upload_time_iso_8601": "2024-03-19T07:30:37.773805Z",
"url": "https://files.pythonhosted.org/packages/41/46/0d48c52e952f65f1fc74b0f19beae5690dcfd2b71a71d70c64b6e0ebb351/odoo_analyse-2.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-19 07:30:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "initOS",
"github_project": "odoo-analyse",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"tox": true,
"lcname": "odoo-analyse"
}