gOdoo-cli 0.3.4__tar.gz → 0.3.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/PKG-INFO +1 -1
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/pyproject.toml +2 -2
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/setup.py +1 -1
- godoo_cli-0.3.5/src/godoo_cli/__init__.py +2 -0
- godoo_cli-0.3.5/src/godoo_cli/cli.py +95 -0
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/commands/bootstrap.py +57 -17
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/commands/launch.py +28 -18
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/commands/rpc/cli.py +7 -2
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/commands/rpc/cli_callbacks.py +4 -0
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/commands/rpc/modules.py +5 -1
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/commands/shell.py +1 -1
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/commands/source_get.py +7 -7
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/commands/test.py +4 -3
- godoo_cli-0.3.5/src/godoo_cli/version.py +1 -0
- godoo_cli-0.3.4/src/godoo_cli/__init__.py +0 -2
- godoo_cli-0.3.4/src/godoo_cli/cli.py +0 -78
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/LICENSE +0 -0
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/README.md +0 -0
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/__main__.py +0 -0
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/commands/__init__.py +0 -0
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/commands/config.py +0 -0
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/commands/rpc/__init__.py +0 -0
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/commands/rpc/importer.py +0 -0
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/commands/rpc/translations.py +0 -0
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/git/__init__.py +0 -0
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/git/git_odoo.py +0 -0
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/git/git_odoo_addons.py +0 -0
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/git/git_repo.py +0 -0
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/git/git_url.py +0 -0
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/git/zip_download.py +0 -0
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/helpers/__init__.py +0 -0
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/helpers/bootstrap.py +0 -0
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/helpers/cli.py +0 -0
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/helpers/odoo_files.py +0 -0
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/helpers/odoo_manifest.py +0 -0
- {godoo_cli-0.3.4 → godoo_cli-0.3.5}/src/godoo_cli/helpers/system.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "gOdoo-cli"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.5"
|
|
4
4
|
description = "Wrapper around Odoo-Bin with some convinience RPC functions."
|
|
5
5
|
authors = ["Joshua Kreuder <Joshua_Kreuder@outlook.com>"]
|
|
6
6
|
license = "LGPL-3"
|
|
@@ -9,7 +9,7 @@ packages = [{include = "godoo_cli", from = "src"}]
|
|
|
9
9
|
repository = "https://github.com/OpenJKSoftware/gOdoo"
|
|
10
10
|
keywords = ["odoo", "godoo","devcontainer"]
|
|
11
11
|
|
|
12
|
-
[tool.poetry_bumpversion.file."src/godoo_cli/
|
|
12
|
+
[tool.poetry_bumpversion.file."src/godoo_cli/version.py"]
|
|
13
13
|
|
|
14
14
|
[tool.poetry.scripts]
|
|
15
15
|
godoo = "godoo_cli:launch_cli"
|
|
@@ -40,7 +40,7 @@ entry_points = \
|
|
|
40
40
|
|
|
41
41
|
setup_kwargs = {
|
|
42
42
|
'name': 'godoo-cli',
|
|
43
|
-
'version': '0.3.
|
|
43
|
+
'version': '0.3.5',
|
|
44
44
|
'description': 'Wrapper around Odoo-Bin with some convinience RPC functions.',
|
|
45
45
|
'long_description': '# gOdoo Dev Environment\n\n\n\n\n[<img src="https://raw.githubusercontent.com/OpenJKSoftware/gOdoo/main/assets/godoo-main-cli.png" width="1000"/>](image.png)\n\n**gOdoo** is short for **go Odoo**. \\\nIt is a [Vscode Devcontainer](https://code.visualstudio.com/docs/remote/containers) Environment for [Odoo](https://odoo.com/)\nwith Python CLI `godoo` convenience wrapper around `odoo-bin`.\n\nThis repository is the base source for the Python package [godoo-cli](https://pypi.org/project/godoo-cli/) and serves as\nan all batteries included development environment.\n\nMade Possible by: [WEMPE Elektronic GmbH](https://wetech.de)\n\n# gOdoo-cli\n\nPython package that provides `godoo` command line interface around `odoo-bin`.\n\nIt\'s build with [Typer](https://github.com/tiangolo/typer) to provide some convenience Wrappers for Odoo development and\nDeployment.\n\nMost flags can be configured by Env variables. \\\nUse `godoo --help` to find out more. HINT: Install tab-completion with `godoo --install-completion`\n\n# Docker\n\nThis workspace also contains Docker and Docker-Compose files. \\\n\nThey are used to provide either easy Odoo instances where the source is pulled according to\n[ODOO_MANIFEST.yml](./ODOO_MANIFEST.yml), or as a all batteries included devcontainer for VScode.\n\n## Requirements\n\n- [Docker Compose](https://github.com/docker/compose)\n- [Traefik](https://doc.traefik.io/traefik/) container running with docker provider and "traefik" named docker network.\n Example: [Traefik Devproxy](https://github.com/joshkreud/traefik_devproxy)\n- SSH Agent running. (check `echo $SSH_AUTH_SOCK`)\\\n This gets passed trough in the Buildprocess to clone Thirdparty repos.\n\n## Just wanna have a quick and easy Odoo Instance?\n\n```bash\ngit clone https://github.com/OpenJKSoftware/gOdoo\ncd godoo\n. scripts/container_requirements.sh # Check Requirements\ndocker-compose build\ndocker-compose up\n# wait......\n# wait a bit mode ...\n# just a little bit longer ..\n# There we go.\n# Odoo should be reachable on \'https://godoo.docker.localhost\' assuming you didn\'t change .env TRAEFIK_HOST_RULE or COMPOSE_PROJECT_NAME\n```\n\n# Devcontainer\n\n## Features\n\n- All batteries included [Devcontainer](https://code.visualstudio.com/docs/remote/containers) with postgres service\n Container and local DNS resolvig managed by [Traefik](https://doc.traefik.io/traefik/).\n- Easy fully working Odoo instance by `docker-compose up` with https access.\n- `godoo` CLI wrapper around Odoo. (Most flags can be configured by Environment Variables and are already preconfigured\n in the Containers. See [.env.sample](./.env.sample))\n- `odoo-bin` is added to PATH and can thus be invoked from every folder.\n- Odoo will run in Proxy_Mode behind a Traefik reverse proxy for easy access on\n `https://$COMPOSE_PROJECT_NAME.docker.localhost`\n- [Odoo Pylint plugin](https://github.com/OCA/pylint-odoo) preconfigured in vscode\n- Preinstalled vscode Extensions Highlights:\n - [SQL Tools](https://marketplace.visualstudio.com/items?itemName=mtxr.sqltools) with preconfigured connection for\n easy Database access in the Sidebar.\n - [Docker Extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker) controls\n container host.\n - [Odoo Snippets](https://marketplace.visualstudio.com/items?itemName=mstuttgart.odoo-snippets)\n - [Odoo Developments](https://marketplace.visualstudio.com/items?itemName=scapigliato.vsc-odoo-development) can Grab\n Odoo Model information from a running Server\n - [Todo Tree](https://marketplace.visualstudio.com/items?itemName=Gruntfuggly.todo-tree)\n\n## Usage\n\n1. For Docker on windows: Clone the repo into the WSL2 Filesystem for better IO performance\n2. Have [Traefik](https://github.com/traefik/traefik) Running on `docker.localhost`\n [Example](https://github.com/joshkreud/traefik_devproxy) \\\n There must be a Docker network called `traefik` that can reach traefik.\n3. Open Devcontianer:\n - If you have the Devcontainer CLI: `devcontainer open .`\n - If not open the workspace in Local Vscode. In the Command pallete search for `Reopen in container`\n4. From **within the container** start Odoo using one of the following commands:\n - You can enable godoo tab-completion by `godoo --install-completion`\n - `make` -> Loads Odoo + Workspace Addons\n - `make bare` -> Loads Odoo with ony `web` installed.\n - `make kill` -> Search for `odoo-bin` processes and kill them\n - `make reset` -> Drops DB, deletes config file and datafolder\n - The full init script is available via "`godoo`". (See --help for Options)\n5. Open Odoo `https://$COMPOSE_PROJECT_NAME.docker.localhost`\\\n For example `COMPOSE_PROJECT_NAME=godoo` --> [https://godoo.docker.localhost](https://godoo.docker.localhost)\n6. Login with `admin:admin`\n7. Profit!\n\n### Access to Odoo and Thirdparty addon Source\n\nYou can access the Odoo source by opening the VsCode workspace [full.code-workspace](full.code-workspace) from within\nthe Container. This will open a [Multi-Root Workspace](https://code.visualstudio.com/docs/editor/multi-root-workspaces).\nReally waiting for https://github.com/microsoft/vscode-remote-release/issues/3665 here.\n\n## Reset Devcontainer Data\n\nWhen you screwed up so bad its time to just start Over godoo has you covered:\n\n### Automatic Reset\n\nThere are 3 Options to reset the Dev Env.\n\n1. From **Outside** the Container run `make reset` in the project root to delete docker volumes and restart the\n container. (Vscode will prompt to reconnect if still open)\n2. From **Outside** the Container run `make reset-hard` in the project root to force rebuild the main Odoo container and\n then do the same as `make reset`\n3. From **Inside** the Container run `make reset` to drop the DB and delete varlib and the bootstrap flag, which is way\n quicker than the other options.\n\n### Manual Reset\n\n1. Close vscode\n2. Remove `app` and `db` container from docker.\n3. Remove volumes: `db, odoo_thirdparty, odoo_web, vscode_extensions`\n4. Restart Devcontainer\n\n## Python Debugging\n\n### VsCode Debugging\n\nDebugging doesn\'t reliably work with\n[Odoo Multiprocess](https://www.odoo.com/documentation/14.0/developer/misc/other/cmdline.html#multiprocessing) mode\nenabled. \\\nThe container ships with a Vscode Debug profile, that sets `--workers 0` to allow for Debugging Breakpoints. See [.vscode/launch.json](./.vscode/launch.json)\n\n### Interactive Shell\n\nUse `godoo shell` to enter an interactive shell on the Database.\n\n# Odoo Modules\n\n## Third Party Modules (manifest.yml)\n\nThe `godoo` bootstrap function, will download some modules using git. \\\nWhich Repos to download is specified in `ODOO_MANIFEST.yml` ([Default](./ODOO_MANIFEST.yml)) \\\nNot all of the cloned addons are automatically installed. \\\nInstall them via the Apps Page in Odoo using `godoo rpc modules install` or using `odoo-bin`.\\\nModules downloaded on the Odoo Marketplace can be dropped as a `.zip` archive in [./thirdparty](./thirdparty)\n',
|
|
46
46
|
'author': 'Joshua Kreuder',
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"""Main CLI."""
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from types import SimpleNamespace
|
|
4
|
+
from typing import Optional
|
|
5
|
+
|
|
6
|
+
import typer
|
|
7
|
+
from dotenv import load_dotenv
|
|
8
|
+
|
|
9
|
+
from .commands import (
|
|
10
|
+
bootstrap_odoo,
|
|
11
|
+
get_source,
|
|
12
|
+
get_source_file,
|
|
13
|
+
install_module_dependencies,
|
|
14
|
+
launch_odoo,
|
|
15
|
+
odoo_shell,
|
|
16
|
+
odoo_test,
|
|
17
|
+
rpc_cli_app,
|
|
18
|
+
set_odoo_config,
|
|
19
|
+
uninstall_modules,
|
|
20
|
+
)
|
|
21
|
+
from .helpers.system import set_logging
|
|
22
|
+
from .version import __version__
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def main_callback(
|
|
26
|
+
ctx: typer.Context,
|
|
27
|
+
odoo_main_path: Path = typer.Option(
|
|
28
|
+
...,
|
|
29
|
+
envvar="ODOO_MAIN_FOLDER",
|
|
30
|
+
help="folder with odoo-bin",
|
|
31
|
+
rich_help_panel="Paths",
|
|
32
|
+
),
|
|
33
|
+
odoo_conf_path: Path = typer.Option(
|
|
34
|
+
...,
|
|
35
|
+
envvar="ODOO_CONF_PATH",
|
|
36
|
+
help="odoo.conf path",
|
|
37
|
+
rich_help_panel="Paths",
|
|
38
|
+
),
|
|
39
|
+
workspace_addon_path: Path = typer.Option(
|
|
40
|
+
...,
|
|
41
|
+
envvar="ODOO_WORKSPACE_ADDON_LOCATION",
|
|
42
|
+
help="path to dev workspace addons",
|
|
43
|
+
rich_help_panel="Paths",
|
|
44
|
+
),
|
|
45
|
+
bootstrap_flag_location: Path = typer.Option(
|
|
46
|
+
...,
|
|
47
|
+
envvar="ODOO_BOOTSTRAP_FLAG",
|
|
48
|
+
help="Location of the Bootstrap indicator file",
|
|
49
|
+
rich_help_panel="Paths",
|
|
50
|
+
),
|
|
51
|
+
source_download_archive: Optional[bool] = typer.Option(
|
|
52
|
+
False,
|
|
53
|
+
"--source-download-archive",
|
|
54
|
+
envvar="SOURCE_CLONE_ARCHIVE",
|
|
55
|
+
help="When using a HTTPs Repo Url for Github we can download a snapshop without the Repo history",
|
|
56
|
+
),
|
|
57
|
+
verbose: Optional[bool] = typer.Option(False, "--verbose", help="Verbose Logging with Error stacktraces"),
|
|
58
|
+
):
|
|
59
|
+
ctx.obj = SimpleNamespace(
|
|
60
|
+
odoo_main_path=odoo_main_path,
|
|
61
|
+
odoo_conf_path=odoo_conf_path,
|
|
62
|
+
workspace_addon_path=workspace_addon_path,
|
|
63
|
+
bootstrap_flag_location=bootstrap_flag_location,
|
|
64
|
+
source_download_archive=source_download_archive,
|
|
65
|
+
)
|
|
66
|
+
set_logging(verbose=verbose)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def main_cli():
|
|
70
|
+
load_dotenv(".env", override=True)
|
|
71
|
+
|
|
72
|
+
help_text = f"gOdoo CLI version: [bold green]{__version__}[/bold green]"
|
|
73
|
+
app = typer.Typer(callback=main_callback, no_args_is_help=True, rich_markup_mode="rich", help=help_text)
|
|
74
|
+
# Nested Subcommands
|
|
75
|
+
app.add_typer(
|
|
76
|
+
typer_instance=rpc_cli_app(),
|
|
77
|
+
name="rpc",
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
# Normal Subcommands
|
|
81
|
+
app.command("launch")(launch_odoo)
|
|
82
|
+
app.command("bootstrap")(bootstrap_odoo)
|
|
83
|
+
app.command("test")(odoo_test)
|
|
84
|
+
app.command("config")(set_odoo_config)
|
|
85
|
+
app.command("source-get-file")(get_source_file)
|
|
86
|
+
app.command("source-get-depends")(install_module_dependencies)
|
|
87
|
+
app.command("source-get")(get_source)
|
|
88
|
+
app.command("shell")(odoo_shell)
|
|
89
|
+
app.command("uninstall")(uninstall_modules)
|
|
90
|
+
return app
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def launch_cli():
|
|
94
|
+
app = main_cli()
|
|
95
|
+
app()
|
|
@@ -129,27 +129,67 @@ def _boostrap_command(
|
|
|
129
129
|
def bootstrap_odoo(
|
|
130
130
|
ctx: typer.Context,
|
|
131
131
|
thirdparty_addon_path: Path = typer.Option(
|
|
132
|
-
...,
|
|
132
|
+
...,
|
|
133
|
+
envvar="ODOO_THIRDPARTY_LOCATION",
|
|
134
|
+
help="folder that contains thirdparty repos like OCA",
|
|
135
|
+
),
|
|
136
|
+
db_host: str = typer.Option(
|
|
137
|
+
...,
|
|
138
|
+
envvar="ODOO_DB_HOST",
|
|
139
|
+
help="db hostname",
|
|
140
|
+
rich_help_panel="Database Options",
|
|
141
|
+
),
|
|
142
|
+
db_filter: str = typer.Option(
|
|
143
|
+
...,
|
|
144
|
+
envvar="ODOO_DB_FILTER",
|
|
145
|
+
help="database filter for odoo_conf",
|
|
146
|
+
rich_help_panel="Database Options",
|
|
147
|
+
),
|
|
148
|
+
db_name: str = typer.Option(
|
|
149
|
+
...,
|
|
150
|
+
envvar="ODOO_MAIN_DB",
|
|
151
|
+
help="launch database name",
|
|
152
|
+
rich_help_panel="Database Options",
|
|
153
|
+
),
|
|
154
|
+
db_user: str = typer.Option(
|
|
155
|
+
...,
|
|
156
|
+
envvar="ODOO_DB_USER",
|
|
157
|
+
help="db user",
|
|
158
|
+
rich_help_panel="Database Options",
|
|
159
|
+
),
|
|
160
|
+
db_password: str = typer.Option(
|
|
161
|
+
...,
|
|
162
|
+
envvar="ODOO_DB_PASSWORD",
|
|
163
|
+
help="db password",
|
|
164
|
+
rich_help_panel="Database Options",
|
|
165
|
+
),
|
|
166
|
+
db_port: str = typer.Option(
|
|
167
|
+
...,
|
|
168
|
+
envvar="ODOO_DB_PORT",
|
|
169
|
+
help="db host port",
|
|
170
|
+
rich_help_panel="Database Options",
|
|
133
171
|
),
|
|
134
|
-
db_host: str = typer.Option(..., envvar="ODOO_DB_HOST", help="db hostname"),
|
|
135
|
-
db_filter: str = typer.Option(..., envvar="ODOO_DB_FILTER", help="database filter for odoo_conf"),
|
|
136
|
-
db_name: str = typer.Option(..., envvar="ODOO_MAIN_DB", help="launch database name"),
|
|
137
|
-
db_user: str = typer.Option(..., envvar="ODOO_DB_USER", help="db user"),
|
|
138
|
-
db_password: str = typer.Option(..., envvar="ODOO_DB_PASSWORD", help="db password"),
|
|
139
|
-
db_port: str = typer.Option(..., envvar="ODOO_DB_PORT", help="db host port"),
|
|
140
172
|
extra_cmd_args: List[str] = typer.Option(None, help="extra agruments to pass to odoo-bin"),
|
|
141
|
-
|
|
142
|
-
install_workspace_modules: bool = typer.Option(True, help="install all modules found in workspace_path"),
|
|
143
|
-
multithread_worker_count: int = typer.Option(9, help="count of worker threads. will enable proxy_mode if >0"),
|
|
173
|
+
multithread_worker_count: int = typer.Option(5, help="count of worker threads. will enable proxy_mode if >0"),
|
|
144
174
|
languages: str = typer.Option("de_DE,en_US", help="languages to load by default"),
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
175
|
+
no_install_base: bool = typer.Option(
|
|
176
|
+
False, "--no-install-base", help="dont install [bold]base[/bold] and [bold]web[/bold] module"
|
|
177
|
+
),
|
|
178
|
+
no_install_workspace_modules: bool = typer.Option(
|
|
179
|
+
False,
|
|
180
|
+
"--no-install-workspace-modules",
|
|
181
|
+
help="dont automatically install modules found in [bold cyan]--workspace_path[/bold cyan]",
|
|
182
|
+
),
|
|
183
|
+
no_update_source: bool = typer.Option(False, "--no-update-source", help="Update Odoo Source and Thirdparty Addons"),
|
|
184
|
+
no_addons_remove_unspecified: bool = typer.Option(
|
|
185
|
+
False,
|
|
186
|
+
"--no-addons-remove-unspecified",
|
|
187
|
+
help="don't remove unspecified addons if not '[bold cyan]--no-update-source[/bold cyan]'",
|
|
148
188
|
),
|
|
149
189
|
):
|
|
150
190
|
"""Bootstrap Odoo."""
|
|
151
|
-
if
|
|
152
|
-
get_source(ctx=ctx, remove_unspecified_addons=
|
|
191
|
+
if not no_update_source:
|
|
192
|
+
get_source(ctx=ctx, remove_unspecified_addons=not no_addons_remove_unspecified)
|
|
153
193
|
|
|
154
194
|
addon_paths = get_addon_paths(
|
|
155
195
|
odoo_main_repo=ctx.obj.odoo_main_path,
|
|
@@ -169,8 +209,8 @@ def bootstrap_odoo(
|
|
|
169
209
|
db_password=db_password,
|
|
170
210
|
db_port=db_port,
|
|
171
211
|
extra_cmd_args=extra_cmd_args,
|
|
172
|
-
install_base=
|
|
173
|
-
install_workspace_modules=
|
|
212
|
+
install_base=not no_install_base,
|
|
213
|
+
install_workspace_modules=not no_install_workspace_modules,
|
|
174
214
|
multithread_worker_count=multithread_worker_count,
|
|
175
215
|
languages=languages,
|
|
176
216
|
)
|
|
@@ -54,21 +54,32 @@ def _launch_command(
|
|
|
54
54
|
@typer_unpacker
|
|
55
55
|
def launch_odoo(
|
|
56
56
|
ctx: typer.Context,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
odoo_demo: bool = typer.Option(False, "--odoo-demo", help="Load Demo Data"),
|
|
58
|
+
dev_mode: bool = typer.Option(False, "--dev-mode", help="Pass --dev xml,qweb,reload to odoo"),
|
|
59
|
+
no_launch: bool = typer.Option(False, "--no-launch", help="Launch after Bootstrap"),
|
|
60
|
+
no_install_base: bool = typer.Option(
|
|
61
|
+
False, "--no-install-base", help="dont install [bold]base[/bold] and [bold]web[/bold] module"
|
|
62
|
+
),
|
|
63
|
+
no_install_workspace_addons: bool = typer.Option(
|
|
64
|
+
False, "--no-install-workspace-addons", help="Install Workspace addons"
|
|
65
|
+
),
|
|
66
|
+
no_update_source: bool = typer.Option(False, "--no-update-source", help="Update Odoo Source and Thirdparty Addons"),
|
|
67
|
+
no_addons_remove_unspecified: bool = typer.Option(
|
|
68
|
+
False,
|
|
69
|
+
"--no-addons-remove-unspecified",
|
|
70
|
+
help="don't remove unspecified addons if not '[bold cyan]--no-update-source[/bold cyan]'",
|
|
71
|
+
),
|
|
72
|
+
load_data_path: List[Path] = typer.Option(
|
|
73
|
+
None,
|
|
74
|
+
help="Starts Async Importer Job with provided path(s). [bold red]Must provide options from godoo rpc[/bold red]",
|
|
75
|
+
),
|
|
65
76
|
extra_args: List[str] = typer.Option([], help="Extra args to Pass to odoo Launch"),
|
|
66
77
|
extra_bootstrap_args: List[str] = typer.Option([], help="Extra args to Pass to odoo Bootstrap"),
|
|
67
78
|
log_file_path: Path = typer.Option(None, dir_okay=False, writable=True, help="Logfile Path"),
|
|
68
79
|
multithread_worker_count: int = typer.Option(9, help="count of worker threads. will enable proxy_mode if >0"),
|
|
69
80
|
):
|
|
70
81
|
"""
|
|
71
|
-
|
|
82
|
+
Launch Odoo, Bootstrap if bootstrapflag is not present.
|
|
72
83
|
"""
|
|
73
84
|
LOGGER.info("Starting godoo Init Script")
|
|
74
85
|
|
|
@@ -90,13 +101,13 @@ def launch_odoo(
|
|
|
90
101
|
ret = bootstrap_odoo(
|
|
91
102
|
ctx=ctx,
|
|
92
103
|
extra_cmd_args=_extra_bootstrap_args,
|
|
93
|
-
|
|
94
|
-
|
|
104
|
+
no_install_base=no_install_base,
|
|
105
|
+
no_install_workspace_modules=no_install_workspace_addons or no_install_base,
|
|
95
106
|
multithread_worker_count=multithread_worker_count,
|
|
96
|
-
|
|
97
|
-
|
|
107
|
+
no_update_source=no_update_source,
|
|
108
|
+
no_addons_remove_unspecified=no_addons_remove_unspecified,
|
|
98
109
|
)
|
|
99
|
-
|
|
110
|
+
no_install_workspace_addons = False
|
|
100
111
|
bootstraped = ret == 0
|
|
101
112
|
if not bootstraped:
|
|
102
113
|
LOGGER.error("godoo Launch Failed. Bootstrap unsuccessfull. Aborting Launch...")
|
|
@@ -110,12 +121,11 @@ def launch_odoo(
|
|
|
110
121
|
"--dev xml,qweb" if load_data_path else "--dev xml,qweb,reload"
|
|
111
122
|
) # Prevent server restart if Importer threads will be spawned.
|
|
112
123
|
|
|
113
|
-
if bootstraped and
|
|
124
|
+
if bootstraped and no_launch:
|
|
114
125
|
return typer_retuner(ret)
|
|
115
126
|
|
|
116
|
-
rpc_callback(ctx) # Add RPC Options using Defaults and Envvars
|
|
117
|
-
|
|
118
127
|
if load_data_path:
|
|
128
|
+
rpc_callback(ctx) # Add RPC Options using Defaults and Envvars
|
|
119
129
|
LOGGER.info("Starting Data Importer Thread for: '%s'", ", ".join(map(str, load_data_path)))
|
|
120
130
|
loader_thread = threading.Thread(
|
|
121
131
|
target=import_to_odoo,
|
|
@@ -130,7 +140,7 @@ def launch_odoo(
|
|
|
130
140
|
odoo_conf_path=ctx.obj.odoo_conf_path,
|
|
131
141
|
extra_cmd_args=extra_odoo_args,
|
|
132
142
|
workspace_addon_path=ctx.obj.workspace_addon_path,
|
|
133
|
-
upgrade_workspace_modules=
|
|
143
|
+
upgrade_workspace_modules=no_install_workspace_addons,
|
|
134
144
|
)
|
|
135
145
|
LOGGER.info("Launching Odoo")
|
|
136
146
|
return typer_retuner(run_cmd(cmd_string).returncode)
|
|
@@ -7,10 +7,15 @@ from .translations import dump_translations
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
def rpc_cli_app():
|
|
10
|
-
app = typer.Typer(
|
|
10
|
+
app = typer.Typer(
|
|
11
|
+
no_args_is_help=True,
|
|
12
|
+
callback=rpc_callback,
|
|
13
|
+
help="Functions that act on a running Odoo instance via RPC.",
|
|
14
|
+
)
|
|
11
15
|
|
|
12
16
|
app.add_typer(
|
|
13
|
-
typer_instance=modules_cli_app(),
|
|
17
|
+
typer_instance=modules_cli_app(),
|
|
18
|
+
name="modules",
|
|
14
19
|
)
|
|
15
20
|
app.command("import", help="Imports all files in a Folder according to a regex or a specific file")(import_to_odoo)
|
|
16
21
|
app.command(help="Upgrades or Installs Modules in Odoo via RPC.")
|
|
@@ -14,21 +14,25 @@ def rpc_callback(
|
|
|
14
14
|
...,
|
|
15
15
|
envvar="ODOO_RPC_HOST",
|
|
16
16
|
help="Odoo RPC Host",
|
|
17
|
+
rich_help_panel="RPC Options",
|
|
17
18
|
),
|
|
18
19
|
odoo_main_db: str = typer.Option(
|
|
19
20
|
...,
|
|
20
21
|
envvar="ODOO_MAIN_DB",
|
|
21
22
|
help="Odoo Database for RPC Calls",
|
|
23
|
+
rich_help_panel="RPC Options",
|
|
22
24
|
),
|
|
23
25
|
odoo_rpc_user: str = typer.Option(
|
|
24
26
|
...,
|
|
25
27
|
envvar="ODOO_RPC_USER",
|
|
26
28
|
help="User for RPC login",
|
|
29
|
+
rich_help_panel="RPC Options",
|
|
27
30
|
),
|
|
28
31
|
odoo_rpc_password: str = typer.Option(
|
|
29
32
|
...,
|
|
30
33
|
envvar="ODOO_RPC_PASSWORD",
|
|
31
34
|
help="Password RPC Login Password",
|
|
35
|
+
rich_help_panel="RPC Options",
|
|
32
36
|
),
|
|
33
37
|
):
|
|
34
38
|
ctx.obj.odoo_rpc_host = odoo_rpc_host
|
|
@@ -102,7 +102,11 @@ def install_modules(
|
|
|
102
102
|
|
|
103
103
|
|
|
104
104
|
def modules_cli_app():
|
|
105
|
-
app = typer.Typer(
|
|
105
|
+
app = typer.Typer(
|
|
106
|
+
callback=rpc_callback,
|
|
107
|
+
no_args_is_help=True,
|
|
108
|
+
help="Wrapper around Odoo modules. (Install/upgrade, etc)",
|
|
109
|
+
)
|
|
106
110
|
|
|
107
111
|
app.command(name="install")(install_modules)
|
|
108
112
|
return app
|
|
@@ -15,7 +15,7 @@ def uninstall_modules(
|
|
|
15
15
|
module_list: List[str] = typer.Argument(..., help="List of Modules to uninstall"),
|
|
16
16
|
):
|
|
17
17
|
"""
|
|
18
|
-
Uninstall
|
|
18
|
+
Uninstall given Modules from Odoo via shell.
|
|
19
19
|
"""
|
|
20
20
|
module_list_str = str(list(module_list))
|
|
21
21
|
uninstall_cmd = f"env['ir.module.module'].search([('name','in',{module_list_str})]).filtered(lambda m: m.state not in ['uninstallable','uninstalled']).button_immediate_uninstall()"
|
|
@@ -101,6 +101,7 @@ def install_module_dependencies(
|
|
|
101
101
|
help="Modules to check for dependencies (can use all for all available addons)",
|
|
102
102
|
),
|
|
103
103
|
):
|
|
104
|
+
"""Install dependencies from __manifest__.py in specified modules."""
|
|
104
105
|
odoo_addon_paths = get_addon_paths(
|
|
105
106
|
odoo_main_repo=ctx.obj.odoo_main_path,
|
|
106
107
|
workspace_addon_path=ctx.obj.workspace_addon_path,
|
|
@@ -122,9 +123,7 @@ def get_source_file(
|
|
|
122
123
|
file_path: str = typer.Option(..., help="Relative Filepath in Repository"),
|
|
123
124
|
save_path: Path = typer.Option(..., file_okay=True, dir_okay=False, help="Where to write the file"),
|
|
124
125
|
):
|
|
125
|
-
"""Get Raw file from git remote.
|
|
126
|
-
Either from the Odoo Repo defined in manifest file or from a custom Git remote.
|
|
127
|
-
"""
|
|
126
|
+
"""Get Raw file from manifest git remotes or specific git remote."""
|
|
128
127
|
|
|
129
128
|
if not repo_url and not manifest_yml:
|
|
130
129
|
raise ValueError("Need to provide either manifest_yml or repo_url")
|
|
@@ -148,7 +147,7 @@ def get_source(
|
|
|
148
147
|
ctx: typer.Context,
|
|
149
148
|
update_mode: UpdateMode = typer.Argument(UpdateMode.all, help="What to Update"),
|
|
150
149
|
manifest_yml: Path = typer.Option(
|
|
151
|
-
..., envvar="ODOO_MANIFEST", help="
|
|
150
|
+
..., envvar="ODOO_MANIFEST", help="manifest.yml file, that specifies which repos to download."
|
|
152
151
|
),
|
|
153
152
|
thirdparty_addon_path: Path = typer.Option(
|
|
154
153
|
..., envvar="ODOO_THIRDPARTY_LOCATION", help="Root folder of the Thirdparty addon repos"
|
|
@@ -157,17 +156,18 @@ def get_source(
|
|
|
157
156
|
..., envvar="ODOO_THIRDPARTY_ZIP_LOCATION", help="Source folder, where to look for Addon zips"
|
|
158
157
|
),
|
|
159
158
|
add_compare_comments: bool = typer.Option(
|
|
160
|
-
False, help="Wether to add github.com three dot compare links as comments."
|
|
159
|
+
False, "--add-compare-comments", help="Wether to add github.com three dot compare links as comments."
|
|
161
160
|
),
|
|
162
161
|
remove_unspecified_addons: bool = typer.Option(
|
|
163
|
-
False, help="Remove Addon folders that are not in YML or thirdparty.zip"
|
|
162
|
+
False, "--remove-unspecified-addons", help="Remove Addon folders that are not in YML or thirdparty.zip"
|
|
164
163
|
),
|
|
165
164
|
force_fetch: bool = typer.Option(
|
|
166
165
|
False,
|
|
166
|
+
"--force-fetch",
|
|
167
167
|
help="Forces origin fetch, regardless of current branch or commit sha (may be slow)",
|
|
168
168
|
),
|
|
169
169
|
):
|
|
170
|
-
"""
|
|
170
|
+
"""Download/Unzip Odoo Source and thirdparty addons."""
|
|
171
171
|
LOGGER.info("Updating Source Repos")
|
|
172
172
|
zip_addon_path = get_zip_addon_path(thirdparty_addon_path)
|
|
173
173
|
|
|
@@ -47,6 +47,7 @@ def odoo_test(
|
|
|
47
47
|
),
|
|
48
48
|
odoo_log_level: str = typer.Option("test", help="Log level"),
|
|
49
49
|
):
|
|
50
|
+
"""Bootstrap or Launch odoo in Testing Mode."""
|
|
50
51
|
workspace_addon_path = ctx.obj.workspace_addon_path
|
|
51
52
|
|
|
52
53
|
test_modules = _test_modules_special_cases(test_modules, workspace_addon_path)
|
|
@@ -85,12 +86,12 @@ def odoo_test(
|
|
|
85
86
|
|
|
86
87
|
ret = launch_odoo(
|
|
87
88
|
ctx=ctx,
|
|
88
|
-
|
|
89
|
+
no_install_workspace_addons=True,
|
|
89
90
|
extra_args=launch_args,
|
|
90
91
|
extra_bootstrap_args=bootstrap_args,
|
|
91
|
-
|
|
92
|
+
no_launch=True,
|
|
92
93
|
multithread_worker_count=0,
|
|
93
94
|
odoo_demo=True,
|
|
94
|
-
|
|
95
|
+
no_update_source=True,
|
|
95
96
|
)
|
|
96
97
|
return typer_retuner(ret)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.5"
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"""Main CLI."""
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
from types import SimpleNamespace
|
|
4
|
-
|
|
5
|
-
import typer
|
|
6
|
-
from dotenv import load_dotenv
|
|
7
|
-
|
|
8
|
-
from .commands import (
|
|
9
|
-
bootstrap_odoo,
|
|
10
|
-
get_source,
|
|
11
|
-
get_source_file,
|
|
12
|
-
install_module_dependencies,
|
|
13
|
-
launch_odoo,
|
|
14
|
-
odoo_shell,
|
|
15
|
-
odoo_test,
|
|
16
|
-
rpc_cli_app,
|
|
17
|
-
set_odoo_config,
|
|
18
|
-
uninstall_modules,
|
|
19
|
-
)
|
|
20
|
-
from .helpers.system import set_logging
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def main_callback(
|
|
24
|
-
ctx: typer.Context,
|
|
25
|
-
odoo_main_path: Path = typer.Option(..., envvar="ODOO_MAIN_FOLDER", help="folder with odoo-bin"),
|
|
26
|
-
odoo_conf_path: Path = typer.Option(..., envvar="ODOO_CONF_PATH", help="odoo.conf path"),
|
|
27
|
-
workspace_addon_path: Path = typer.Option(
|
|
28
|
-
..., envvar="ODOO_WORKSPACE_ADDON_LOCATION", help="path to dev workspace addons"
|
|
29
|
-
),
|
|
30
|
-
bootstrap_flag_location: Path = typer.Option(
|
|
31
|
-
..., envvar="ODOO_BOOTSTRAP_FLAG", help="Location of the Bootstrap indicator file"
|
|
32
|
-
),
|
|
33
|
-
source_download_archive: bool = typer.Option(
|
|
34
|
-
False,
|
|
35
|
-
envvar="SOURCE_CLONE_ARCHIVE",
|
|
36
|
-
help="When using a HTTPs Repo Url for Github we can download a snapshop without the Repo history",
|
|
37
|
-
),
|
|
38
|
-
verbose: bool = typer.Option(False),
|
|
39
|
-
):
|
|
40
|
-
ctx.obj = SimpleNamespace(
|
|
41
|
-
odoo_main_path=odoo_main_path,
|
|
42
|
-
odoo_conf_path=odoo_conf_path,
|
|
43
|
-
workspace_addon_path=workspace_addon_path,
|
|
44
|
-
bootstrap_flag_location=bootstrap_flag_location,
|
|
45
|
-
source_download_archive=source_download_archive,
|
|
46
|
-
)
|
|
47
|
-
set_logging(verbose=verbose)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def main_cli():
|
|
51
|
-
load_dotenv(".env", override=True)
|
|
52
|
-
|
|
53
|
-
app = typer.Typer(callback=main_callback, no_args_is_help=True)
|
|
54
|
-
# Nested Subcommands
|
|
55
|
-
app.add_typer(
|
|
56
|
-
typer_instance=rpc_cli_app(),
|
|
57
|
-
name="rpc",
|
|
58
|
-
help="Commands that act on a running Odoo instance through RPC",
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
# Normal Subcommands
|
|
62
|
-
app.command("config", help="Set odoo.conf options")(set_odoo_config)
|
|
63
|
-
app.command("launch", help="Launch Odoo, Bootstrap if bootstrapflag is not present")(launch_odoo)
|
|
64
|
-
app.command("bootstrap", help="Bootstrap Odoo")(bootstrap_odoo)
|
|
65
|
-
app.command("source-get-file", help="Get Raw file from odoo git remote or specific git remote.")(get_source_file)
|
|
66
|
-
app.command("source-get-depends", help="Install dependencies from __manifest__.py in specified modules")(
|
|
67
|
-
install_module_dependencies
|
|
68
|
-
)
|
|
69
|
-
app.command("source-get", help="Download/Unzip Odoo Source and thirdparty addons.")(get_source)
|
|
70
|
-
app.command("test", help="Bootstrap or Launch odoo in Testing Mode")(odoo_test)
|
|
71
|
-
app.command("shell", help="Start interactive Odoo shell")(odoo_shell)
|
|
72
|
-
app.command("uninstall", help="Uninstall Modules")(uninstall_modules)
|
|
73
|
-
return app
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
def launch_cli():
|
|
77
|
-
app = main_cli()
|
|
78
|
-
app()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|