gOdoo-cli 0.11.12__tar.gz → 0.11.13__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.
Files changed (52) hide show
  1. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/PKG-INFO +26 -25
  2. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/pyproject.toml +28 -28
  3. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/cli.py +3 -0
  4. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/cli_common.py +11 -1
  5. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/__init__.py +1 -1
  6. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/bootstrap.py +7 -1
  7. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/db/query.py +8 -4
  8. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/launch.py +4 -4
  9. godoo_cli-0.11.13/src/godoo_cli/commands/shell/scripts/odoo_banner.py +79 -0
  10. {godoo_cli-0.11.12/src/godoo_cli/commands → godoo_cli-0.11.13/src/godoo_cli/commands/shell}/shell.py +43 -3
  11. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/test/test_load_data.py +3 -3
  12. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/test/test_run.py +8 -8
  13. godoo_cli-0.11.13/src/godoo_cli/version.py +1 -0
  14. godoo_cli-0.11.12/src/godoo_cli/version.py +0 -1
  15. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/LICENSE +0 -0
  16. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/README.md +0 -0
  17. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/__init__.py +0 -0
  18. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/__main__.py +0 -0
  19. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/backup/__init__.py +0 -0
  20. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/backup/cli.py +0 -0
  21. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/backup/dump.py +0 -0
  22. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/backup/load.py +0 -0
  23. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/backup/pull.py +0 -0
  24. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/backup/util.py +0 -0
  25. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/config.py +0 -0
  26. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/db/__init__.py +0 -0
  27. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/db/cli.py +0 -0
  28. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/db/connection.py +0 -0
  29. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/db/passwords.py +0 -0
  30. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/rpc/__init__.py +0 -0
  31. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/rpc/cli.py +0 -0
  32. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/rpc/config_parameters.py +0 -0
  33. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/rpc/importer.py +0 -0
  34. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/rpc/modules.py +0 -0
  35. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/rpc/translations.py +0 -0
  36. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/source_get.py +0 -0
  37. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/test/__init__.py +0 -0
  38. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/commands/test/cli.py +0 -0
  39. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/git/__init__.py +0 -0
  40. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/git/git_odoo.py +0 -0
  41. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/git/git_odoo_addons.py +0 -0
  42. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/git/git_repo.py +0 -0
  43. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/git/git_url.py +0 -0
  44. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/git/zip_download.py +0 -0
  45. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/helpers/__init__.py +0 -0
  46. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/helpers/cli.py +0 -0
  47. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/helpers/modules.py +0 -0
  48. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/helpers/modules_git.py +0 -0
  49. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/helpers/modules_py.py +0 -0
  50. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/helpers/odoo_files.py +0 -0
  51. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/helpers/odoo_manifest.py +0 -0
  52. {godoo_cli-0.11.12 → godoo_cli-0.11.13}/src/godoo_cli/helpers/system.py +0 -0
@@ -1,43 +1,44 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gOdoo-cli
3
- Version: 0.11.12
3
+ Version: 0.11.13
4
4
  Summary: Wrapper around Odoo-Bin with some convinience RPC functions.
5
5
  Home-page: https://github.com/OpenJKSoftware/gOdoo
6
6
  License: LGPL-3
7
7
  Keywords: odoo,godoo,devcontainer
8
8
  Author: Joshua Kreuder
9
9
  Author-email: Joshua_Kreuder@outlook.com
10
- Requires-Python: >=3.9,<3.12
10
+ Requires-Python: >=3.9
11
11
  Classifier: License :: Other/Proprietary License
12
12
  Classifier: Programming Language :: Python :: 3
13
13
  Classifier: Programming Language :: Python :: 3.9
14
14
  Classifier: Programming Language :: Python :: 3.10
15
15
  Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
16
17
  Provides-Extra: codequality
17
18
  Provides-Extra: devcontainer
18
- Requires-Dist: black (>=22.10.0,<23.0.0) ; extra == "codequality"
19
- Requires-Dist: debugpy (>=1.6.0,<2.0.0) ; extra == "devcontainer"
20
- Requires-Dist: flake8 (>=5.0.4,<6.0.0) ; extra == "codequality"
21
- Requires-Dist: gitpython (>=3.1.27,<4.0.0)
22
- Requires-Dist: godoo-rpc (>=0.1.2,<0.2.0)
23
- Requires-Dist: inotify (>=0.2.10,<0.3.0) ; extra == "devcontainer"
24
- Requires-Dist: ipdb (>=0.13.9,<0.14.0) ; extra == "devcontainer"
25
- Requires-Dist: isort (>=5.10.1,<6.0.0) ; extra == "codequality"
26
- Requires-Dist: mock (>=4.0.3,<5.0.0) ; extra == "devcontainer"
27
- Requires-Dist: openupgradelib (>=3.3.4,<4.0.0)
28
- Requires-Dist: passlib (>=1.7.3,<2.0.0)
29
- Requires-Dist: psycopg2 (>=2.8.6,<3.0.0)
30
- Requires-Dist: py-spy (>=0.3.11,<0.4.0) ; extra == "devcontainer"
31
- Requires-Dist: pydevd-odoo (>=1.2.1,<2.0.0) ; extra == "devcontainer"
32
- Requires-Dist: pylint-odoo (>=8.0.16,<9.0.0) ; extra == "codequality"
33
- Requires-Dist: pytest (>=7.2.1,<8.0.0) ; extra == "codequality"
34
- Requires-Dist: pytest-cov (>=4.0.0,<5.0.0) ; extra == "codequality"
35
- Requires-Dist: python-dotenv (>=0.20.0,<0.21.0)
36
- Requires-Dist: rope (>=0.23.0,<0.24.0) ; extra == "devcontainer"
37
- Requires-Dist: ruamel-yaml (>=0.17.21,<0.18.0)
38
- Requires-Dist: typer (>=0.9.0,<0.10.0)
39
- Requires-Dist: typer-common-functions (>=0.0.8,<0.0.9)
40
- Requires-Dist: watchdog (>=2.1.7,<3.0.0) ; extra == "devcontainer"
19
+ Requires-Dist: black (>=22.10.0) ; extra == "codequality"
20
+ Requires-Dist: debugpy (>=1.6.0) ; extra == "devcontainer"
21
+ Requires-Dist: flake8 (>=5.0.4) ; extra == "codequality"
22
+ Requires-Dist: gitpython (>=3.1.27)
23
+ Requires-Dist: godoo-rpc (>=0.1.4)
24
+ Requires-Dist: inotify (>=0.2.10) ; extra == "devcontainer"
25
+ Requires-Dist: ipdb (>=0.13.9) ; extra == "devcontainer"
26
+ Requires-Dist: isort (>=5.10.1) ; extra == "codequality"
27
+ Requires-Dist: mock (>=4.0.3) ; extra == "devcontainer"
28
+ Requires-Dist: openupgradelib (>=3.3.4)
29
+ Requires-Dist: passlib (>=1.7.3)
30
+ Requires-Dist: psycopg2 (>=2.8.6)
31
+ Requires-Dist: py-spy (>=0.3.11) ; extra == "devcontainer"
32
+ Requires-Dist: pydevd-odoo (>=1.2.1) ; extra == "devcontainer"
33
+ Requires-Dist: pylint-odoo (>=8.0.16) ; extra == "codequality"
34
+ Requires-Dist: pytest (>=7.2.1) ; extra == "codequality"
35
+ Requires-Dist: pytest-cov (>=4.0.0) ; extra == "codequality"
36
+ Requires-Dist: python-dotenv (>=0.20.0)
37
+ Requires-Dist: rope (>=0.23.0) ; extra == "devcontainer"
38
+ Requires-Dist: ruamel-yaml (>=0.17.21)
39
+ Requires-Dist: typer (>=0.9.0)
40
+ Requires-Dist: typer-common-functions (>=0.0.12)
41
+ Requires-Dist: watchdog (>=2.1.7) ; extra == "devcontainer"
41
42
  Project-URL: Repository, https://github.com/OpenJKSoftware/gOdoo
42
43
  Description-Content-Type: text/markdown
43
44
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "gOdoo-cli"
3
- version = "0.11.12"
3
+ version = "0.11.13"
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"
@@ -10,7 +10,7 @@ repository = "https://github.com/OpenJKSoftware/gOdoo"
10
10
  keywords = ["odoo", "godoo","devcontainer"]
11
11
 
12
12
  [tool.poetry.group.dev.dependencies]
13
- pre-commit = "^3.4.0"
13
+ pre-commit = ">=3.4.0"
14
14
 
15
15
  [tool.poetry_bumpversion.file."src/godoo_cli/version.py"]
16
16
 
@@ -18,31 +18,31 @@ pre-commit = "^3.4.0"
18
18
  godoo = "godoo_cli:launch_cli"
19
19
 
20
20
  [tool.poetry.dependencies]
21
- python = ">=3.9,<3.12"
22
- python-dotenv = "^0.20.0"
23
- ruamel-yaml = "^0.17.21"
24
- gitpython = "^3.1.27"
25
- godoo-rpc = "^0.1.2"
26
- openupgradelib = "^3.3.4"
27
- psycopg2 = "^2.8.6" # Mirror Odoo Reqs
28
- passlib = "^1.7.3" # Mirror Odoo Reqs
29
- typer-common-functions = "^0.0.8"
30
- typer = "^0.9.0"
31
-
32
- pylint-odoo = { version="^8.0.16", optional = true}
33
- ipdb = { version="^0.13.9", optional = true}
34
- debugpy = { version="^1.6.0", optional = true}
35
- black = { version="^22.10.0", optional = true}
36
- isort = { version="^5.10.1", optional = true}
37
- watchdog = { version="^2.1.7", optional = true}
38
- py-spy = { version="^0.3.11", optional = true}
39
- rope = { version="^0.23.0", optional = true}
40
- flake8 = { version="^5.0.4", optional = true}
41
- inotify = { version="^0.2.10",optional = true}
42
- mock = { version="^4.0.3", optional= true}
43
- pytest = { version="^7.2.1", optional= true}
44
- pytest-cov = {version="^4.0.0",optional=true}
45
- pydevd-odoo = { version="^1.2.1",optional=true}
21
+ python = ">=3.9"
22
+ python-dotenv = ">=0.20.0"
23
+ ruamel-yaml = ">=0.17.21"
24
+ gitpython = ">=3.1.27"
25
+ godoo-rpc = ">=0.1.4"
26
+ openupgradelib = ">=3.3.4"
27
+ psycopg2 = ">=2.8.6" # Mirror Odoo Reqs
28
+ passlib = ">=1.7.3" # Mirror Odoo Reqs
29
+ typer-common-functions = ">=0.0.12"
30
+ typer = ">=0.9.0"
31
+
32
+ pylint-odoo = { version=">=8.0.16", optional = true}
33
+ ipdb = { version=">=0.13.9", optional = true}
34
+ debugpy = { version=">=1.6.0", optional = true}
35
+ black = { version=">=22.10.0", optional = true}
36
+ isort = { version=">=5.10.1", optional = true}
37
+ watchdog = { version=">=2.1.7", optional = true}
38
+ py-spy = { version=">=0.3.11", optional = true}
39
+ rope = { version=">=0.23.0", optional = true}
40
+ flake8 = { version=">=5.0.4", optional = true}
41
+ inotify = { version=">=0.2.10",optional = true}
42
+ mock = { version=">=4.0.3", optional= true}
43
+ pytest = { version=">=7.2.1", optional= true}
44
+ pytest-cov = {version=">=4.0.0",optional=true}
45
+ pydevd-odoo = { version=">=1.2.1",optional=true}
46
46
 
47
47
  [tool.poetry.extras]
48
48
  devcontainer = [
@@ -75,7 +75,7 @@ log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(linen
75
75
  log_cli_date_format = "%Y-%m-%d %H:%M:%S"
76
76
 
77
77
  [tool.pyright]
78
- ignore="**/__manifest__.py"
78
+ ignore=["**/__manifest__.py"]
79
79
 
80
80
  [tool.black]
81
81
  line-length = 120
@@ -1,4 +1,5 @@
1
1
  """Main CLI."""
2
+
2
3
  from typing import Optional
3
4
 
4
5
  import typer
@@ -14,6 +15,7 @@ from .commands import (
14
15
  launch_odoo,
15
16
  odoo_run_tests,
16
17
  odoo_shell,
18
+ odoo_shell_run_script,
17
19
  rpc_cli_app,
18
20
  set_odoo_config,
19
21
  source_cli_app,
@@ -80,6 +82,7 @@ def main_cli():
80
82
  app.command("test")(odoo_run_tests)
81
83
  app.command("config")(set_odoo_config)
82
84
  app.command("shell")(odoo_shell)
85
+ app.command("shell-script")(odoo_shell_run_script)
83
86
  app.command("uninstall")(uninstall_modules)
84
87
  return app
85
88
 
@@ -2,7 +2,7 @@ from dataclasses import dataclass
2
2
  from pathlib import Path
3
3
  from typing import List, Optional
4
4
 
5
- from typer import Option
5
+ from typer import Argument, Option
6
6
  from typer_common_functions import get_type_from_default, typer_retuner, typer_unpacker
7
7
 
8
8
 
@@ -42,6 +42,16 @@ class OdooLaunchArgs:
42
42
  rich_help_panel="Odoo",
43
43
  )
44
44
  log_file_path: Path = Option(None, dir_okay=False, writable=True, help="Logfile Path", rich_help_panel="Odoo")
45
+ banner_text: str = Argument(
46
+ ...,
47
+ help="Banner Text to add to Odoo Log",
48
+ envvar="ODOO_BANNER_TEXT",
49
+ )
50
+ banner_bg_color: str = Option(
51
+ "green",
52
+ help="Banner Background Color",
53
+ envvar="ODOO_BANNER_BG_COLOR",
54
+ )
45
55
 
46
56
 
47
57
  @dataclass
@@ -4,7 +4,7 @@ from .config import set_odoo_config
4
4
  from .db import db_cli_app
5
5
  from .launch import launch_import, launch_odoo
6
6
  from .rpc import rpc_cli_app
7
- from .shell import odoo_shell, uninstall_modules
7
+ from .shell.shell import odoo_shell, odoo_shell_run_script, uninstall_modules
8
8
  from .source_get import source_cli_app
9
9
  from .test import test_cli_app
10
10
  from .test.test_run import odoo_run_tests
@@ -12,6 +12,7 @@ from ..helpers.modules import get_addon_paths, godooModules
12
12
  from ..helpers.modules_py import _install_py_reqs_by_odoo_cmd
13
13
  from ..helpers.system import run_cmd
14
14
  from .db.connection import DBConnection
15
+ from .shell.shell import odoo_shell_run_script
15
16
 
16
17
  CLI = CommonCLI()
17
18
 
@@ -142,11 +143,12 @@ def bootstrap_odoo(
142
143
  install_base_modules: Annotated[
143
144
  bool,
144
145
  typer.Option(
145
- ...,
146
146
  help="Install base and web modules if no other -i or -u is present in Bootstrap",
147
147
  rich_help_panel="Odoo",
148
148
  ),
149
149
  ] = True,
150
+ banner_text=CLI.odoo_launch.banner_text,
151
+ banner_bg_color=CLI.odoo_launch.banner_bg_color,
150
152
  ):
151
153
  """Bootstrap Odoo."""
152
154
 
@@ -186,4 +188,8 @@ def bootstrap_odoo(
186
188
  ret = run_cmd(cmd_string).returncode
187
189
  if ret != 0:
188
190
  LOGGER.error("Odoo-Bin Returned %d", ret)
191
+ if banner_text:
192
+ os.environ["ODOO_BANNER_TEXT"] = banner_text
193
+ os.environ["ODOO_BANNER_BG_COLOR"] = banner_bg_color
194
+ odoo_shell_run_script(script_name="odoo_banner", odoo_main_path=odoo_main_path, odoo_conf_path=odoo_conf_path)
189
195
  return CLI.returner(ret)
@@ -100,10 +100,14 @@ def is_bootstrapped(
100
100
  password=db_password,
101
101
  db_name=db_name,
102
102
  )
103
- boot = _is_bootstrapped(db_connection=connection)
104
- LOGGER.info("Odoo Database Status: %s", boot.value)
105
- return_code = 1 if boot == DB_BOOTSTRAP_STATUS.NO_DB else 2 if boot == DB_BOOTSTRAP_STATUS.EMPTY_DB else 0
106
- raise typer.Exit(return_code)
103
+ bootstrap_value = _is_bootstrapped(db_connection=connection)
104
+ LOGGER.info("Odoo Database Status: %s", bootstrap_value.value)
105
+ ret_mapping = {
106
+ DB_BOOTSTRAP_STATUS.BOOTSTRAPPED: 0,
107
+ DB_BOOTSTRAP_STATUS.NO_DB: 20,
108
+ DB_BOOTSTRAP_STATUS.EMPTY_DB: 21,
109
+ }
110
+ raise typer.Exit(ret_mapping[bootstrap_value])
107
111
 
108
112
 
109
113
  def _get_installed_modules(db_connection: DBConnection, to_install=False):
@@ -59,7 +59,7 @@ def _launch_command(
59
59
  return " ".join(odoo_cmd)
60
60
 
61
61
 
62
- def pre_launch(
62
+ def bootstrap_and_prep_launch_cmd(
63
63
  odoo_main_path: Path,
64
64
  workspace_addon_path: Path,
65
65
  thirdparty_addon_path: Path,
@@ -76,7 +76,7 @@ def pre_launch(
76
76
  launch_or_bootstrap: bool = False,
77
77
  languages: str = "de_DE,en_US",
78
78
  ):
79
- """Start Bootstrap if database is not bootstrapped. And return Launch CMD.
79
+ """Start Bootstrap if database is not bootstrapped. Install Py Depends And return Launch CMD.
80
80
 
81
81
  Parameters
82
82
  ----------
@@ -227,7 +227,7 @@ def launch_odoo(
227
227
  password=db_password,
228
228
  db_name=db_name,
229
229
  )
230
- launch_cmd = pre_launch(
230
+ launch_cmd = bootstrap_and_prep_launch_cmd(
231
231
  odoo_main_path=odoo_main_path,
232
232
  workspace_addon_path=workspace_addon_path,
233
233
  thirdparty_addon_path=thirdparty_addon_path,
@@ -288,7 +288,7 @@ def launch_import(
288
288
  db_name=db_name,
289
289
  )
290
290
 
291
- launch_cmd = pre_launch(
291
+ launch_cmd = bootstrap_and_prep_launch_cmd(
292
292
  odoo_main_path=odoo_main_path,
293
293
  workspace_addon_path=workspace_addon_path,
294
294
  thirdparty_addon_path=thirdparty_addon_path,
@@ -0,0 +1,79 @@
1
+ """Install Web Ribbon addon and set Text and color. To be Piped into Odoo Shell."""
2
+
3
+ import logging
4
+ import os
5
+ from typing import Optional
6
+
7
+ from odoo import api
8
+
9
+ LOGGER = logging.getLogger(__name__)
10
+
11
+ env: api.Environment = env # Just to silence pyright # pyright: ignore # NOQA
12
+
13
+
14
+ def set_banner(banner_text: Optional[str] = "Development", banner_background_color: Optional[str] = ""):
15
+ """Set Odoo top left Banner.
16
+
17
+ Parameters
18
+ ----------
19
+ banner_text : str, optional
20
+ Text to display on banner, by default ""
21
+ banner_background_color : str, optional
22
+ rbg("","","",""), by default ""
23
+ """
24
+ if not banner_background_color:
25
+ banner_background_color = "rgb(255,0,0)"
26
+
27
+ view_env = env["ir.ui.view"]
28
+ view_dic = {
29
+ "name": "godoo.dev_banner",
30
+ "type": "qweb",
31
+ "mode": "extension",
32
+ "active": True,
33
+ "inherit_id": env.ref("web.layout").id,
34
+ "arch_db": f"""
35
+ <data name="Godoo Dev Banner" inherit_id="web.layout" active="False">
36
+ <xpath expr="//body" position="inside">
37
+ <div>
38
+ <span id="oe_neutralize_banner" style="text-align: center; color: #FFFFFF; background-color: {banner_background_color}; position: relative; display: block; font-size: 16px;">
39
+ {banner_text}
40
+ </span>
41
+ </div>
42
+ </xpath>
43
+ </data>
44
+ """,
45
+ }
46
+ if view := view_env.search([("name", "=", view_dic["name"])]):
47
+ LOGGER.info("Updating Banner view: %s", view_dic["name"])
48
+ view.update(view_dic)
49
+ else:
50
+ LOGGER.info(
51
+ "Creating Banner view: %s\nText: %s\nColor: %s", view_dic["name"], banner_text, banner_background_color
52
+ )
53
+ view_env.create(view_dic)
54
+
55
+
56
+ def disable_record(ref):
57
+ if rec := env.ref(ref, raise_if_not_found=False):
58
+ if rec.active:
59
+ LOGGER.info("Disabling Record: %s", rec.display_name)
60
+ rec.active = False
61
+
62
+
63
+ def remove_upgrade_test_ribbon():
64
+ disable_record("__upgrade__.upg_test_banner")
65
+ disable_record("__upgrade__.upg_test_ribbon")
66
+ disable_record("web.neutralize_banner")
67
+
68
+
69
+ set_banner(
70
+ os.getenv("ODOO_BANNER_TEXT"),
71
+ os.getenv("ODOO_BANNER_BG_COLOR"),
72
+ )
73
+ remove_upgrade_test_ribbon()
74
+ if ribb := env["ir.module.module"].search([("name", "=", "web_environment_ribbon"), ("state", "=", "installed")]):
75
+ LOGGER.info("Uninstalling Web Environment Ribbon addon")
76
+ ribb.button_immediate_uninstall()
77
+
78
+
79
+ env.cr.commit()
@@ -5,9 +5,9 @@ from typing import List
5
5
 
6
6
  import typer
7
7
 
8
- from ..cli_common import CommonCLI
9
- from ..helpers.odoo_files import odoo_bin_get_version
10
- from ..helpers.system import run_cmd
8
+ from ...cli_common import CommonCLI
9
+ from ...helpers.odoo_files import odoo_bin_get_version
10
+ from ...helpers.system import run_cmd
11
11
 
12
12
  CLI = CommonCLI()
13
13
  LOGGER = logging.getLogger(__name__)
@@ -67,6 +67,46 @@ def odoo_shell(
67
67
  return CLI.returner(ret.returncode)
68
68
 
69
69
 
70
+ def complete_script_name():
71
+ script_folder = Path(__file__).parent / "scripts"
72
+ return [p.stem for p in script_folder.glob("*.py")]
73
+
74
+
75
+ @CLI.unpacker
76
+ @CLI.arg_annotator
77
+ def odoo_shell_run_script(
78
+ script_name: str = typer.Argument(..., help="Internal Script to run", autocompletion=complete_script_name),
79
+ odoo_main_path=CLI.odoo_paths.bin_path,
80
+ odoo_conf_path=CLI.odoo_paths.conf_path,
81
+ db_host=CLI.database.db_host,
82
+ db_port=CLI.database.db_port,
83
+ db_name=CLI.database.db_name,
84
+ db_user=CLI.database.db_user,
85
+ db_password=CLI.database.db_password,
86
+ ):
87
+ """
88
+ Run Predefined Script using Odoo-Shell (Script selection in Tab-Complete).
89
+ """
90
+ script_folder = Path(__file__).parent / "scripts"
91
+ script_path = script_folder / f"{script_name}.py"
92
+ if not script_path.exists():
93
+ LOGGER.error("Script '%s' not found in %s", script_name, script_folder)
94
+ return CLI.returner(1)
95
+
96
+ shell_cmd = f"{str(odoo_main_path.absolute())}/odoo-bin shell --no-http"
97
+ if odoo_conf_path.exists():
98
+ shell_cmd += f" -c {str(odoo_conf_path.absolute())}"
99
+ else:
100
+ LOGGER.warning("No Odoo Config File found at %s", odoo_conf_path)
101
+ if not all([db_host, db_port, db_name, db_user, db_password]):
102
+ LOGGER.error("Missing database options and Config File. Aborting.")
103
+ return CLI.returner(1)
104
+ shell_cmd += f" --db_host={db_host} --db_port={db_port} --database={db_name} --db_user={db_user} --db_password={db_password}"
105
+
106
+ LOGGER.info("Running Script: %s", script_path)
107
+ run_cmd(shell_cmd, stdin=script_path.open("r"))
108
+
109
+
70
110
  def odoo_pregenerate_assets(odoo_main_path: Path):
71
111
  """Uses Odoo shell to Pregenerate Asset bundles in Odoo.
72
112
  Ensures the Asset bundles are present in Filestore
@@ -7,8 +7,8 @@ from ...cli_common import CommonCLI
7
7
  from ...helpers.modules import get_addon_paths, godooModules
8
8
  from ...helpers.system import run_cmd
9
9
  from ..db.connection import DBConnection
10
- from ..launch import pre_launch
11
- from ..shell import odoo_shell
10
+ from ..launch import bootstrap_and_prep_launch_cmd
11
+ from ..shell.shell import odoo_shell
12
12
 
13
13
  CLI = CommonCLI()
14
14
  LOGGER = logging.getLogger(__name__)
@@ -87,7 +87,7 @@ def odoo_load_test_data(
87
87
  db_name=db_name,
88
88
  )
89
89
 
90
- launch_cmd = pre_launch(
90
+ launch_cmd = bootstrap_and_prep_launch_cmd(
91
91
  odoo_main_path=odoo_main_path,
92
92
  workspace_addon_path=workspace_addon_path,
93
93
  thirdparty_addon_path=thirdparty_addon_path,
@@ -4,15 +4,15 @@ from pathlib import Path
4
4
  from typing import List
5
5
 
6
6
  import typer
7
- from typing_extensions import Annotated
7
+ from typing_extensions import Annotated, Optional
8
8
 
9
9
  from ...cli_common import CommonCLI
10
10
  from ...helpers.modules import get_addon_paths, godooModules
11
11
  from ...helpers.modules_git import get_changed_modules_and_depends
12
12
  from ...helpers.system import run_cmd
13
13
  from ..db.connection import DBConnection
14
- from ..launch import pre_launch
15
- from ..shell import odoo_pregenerate_assets
14
+ from ..launch import bootstrap_and_prep_launch_cmd
15
+ from ..shell.shell import odoo_pregenerate_assets
16
16
 
17
17
  CLI = CommonCLI()
18
18
  LOGGER = logging.getLogger(__name__)
@@ -47,12 +47,12 @@ def odoo_get_changed_modules(
47
47
  changed_modules = get_changed_modules_and_depends(diff_ref=diff_ref, addon_path=workspace_addon_path)
48
48
  if not changed_modules:
49
49
  return
50
- print("\n".join(sorted([p.stem for p in changed_modules]))) # pylint: disable=print-used
50
+ print("\n".join(sorted([p.name for p in changed_modules]))) # pylint: disable=print-used
51
51
 
52
52
 
53
53
  @CLI.arg_annotator
54
54
  def odoo_run_tests(
55
- test_modules: List[str] = typer.Argument(
55
+ test_module_names: List[str] = typer.Argument(
56
56
  ...,
57
57
  help="""
58
58
  Space separated list of Modules to Test or special commands:
@@ -76,7 +76,7 @@ def odoo_run_tests(
76
76
  db_user=CLI.database.db_user,
77
77
  db_password=CLI.database.db_password,
78
78
  skip_test_modules: Annotated[
79
- List[str],
79
+ Optional[List[str]],
80
80
  typer.Option(envvar="ODOO_TEST_SKIP_MODULES", help="Modules not to Test even if specified in test_modules"),
81
81
  ] = None,
82
82
  odoo_log_level: str = typer.Option("test", help="Log level"),
@@ -87,7 +87,7 @@ def odoo_run_tests(
87
87
  Will set test specific odoo.conf if it needs to bootstrap
88
88
  """
89
89
 
90
- test_module_names = _test_modules_special_cases(test_modules, workspace_addon_path)
90
+ test_module_names = _test_modules_special_cases(test_module_names, workspace_addon_path)
91
91
  addon_paths = get_addon_paths(odoo_main_path, workspace_addon_path, thirdparty_addon_path)
92
92
  module_reg = godooModules(addon_paths)
93
93
  test_modules = list(module_reg.get_modules(test_module_names))
@@ -146,7 +146,7 @@ def odoo_run_tests(
146
146
  db_name=db_name,
147
147
  )
148
148
 
149
- launch_cmd = pre_launch(
149
+ launch_cmd = bootstrap_and_prep_launch_cmd(
150
150
  odoo_main_path=odoo_main_path,
151
151
  workspace_addon_path=workspace_addon_path,
152
152
  thirdparty_addon_path=thirdparty_addon_path,
@@ -0,0 +1 @@
1
+ __version__ = "0.12.0"
@@ -1 +0,0 @@
1
- __version__ = "0.11.12"
File without changes
File without changes