gOdoo-cli 0.14.10__tar.gz → 0.15.1__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 (108) hide show
  1. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/.github/workflows/quality.yml +5 -16
  2. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/.gitignore +1 -0
  3. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/PKG-INFO +1 -1
  4. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/addons/godoo_test_succ_mod/tests/data.py +0 -1
  5. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/docker/Dockerfile +37 -23
  6. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/docker/depends_build.sh +6 -8
  7. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/docker/docker-compose.base.yml +1 -1
  8. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/docker/docker-compose.devcontainer.yml +0 -8
  9. godoo_cli-0.15.1/docker/psql.gpg +0 -0
  10. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/makefile +3 -0
  11. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/__about__.py +1 -1
  12. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/cli.py +14 -28
  13. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/cli_common.py +1 -0
  14. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/commands/__init__.py +11 -5
  15. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/commands/backup/dump.py +17 -3
  16. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/commands/backup/load.py +1 -1
  17. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/commands/backup/util.py +1 -1
  18. godoo_cli-0.15.1/src/godoo_cli/commands/db/cli.py +64 -0
  19. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/commands/db/passwords.py +1 -1
  20. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/commands/db/query.py +5 -1
  21. godoo_cli-0.15.1/src/godoo_cli/commands/odoo_bin/__init__.py +6 -0
  22. godoo_cli-0.15.1/src/godoo_cli/commands/odoo_bin/bootstrap.py +211 -0
  23. godoo_cli-0.15.1/src/godoo_cli/commands/odoo_bin/cli_generate.py +150 -0
  24. godoo_cli-0.15.1/src/godoo_cli/commands/odoo_bin/godoo_test/__init__.py +5 -0
  25. {godoo_cli-0.14.10/src/godoo_cli/commands/test → godoo_cli-0.15.1/src/godoo_cli/commands/odoo_bin/godoo_test}/test_load_data.py +17 -24
  26. {godoo_cli-0.14.10/src/godoo_cli/commands/test → godoo_cli-0.15.1/src/godoo_cli/commands/odoo_bin/godoo_test}/test_run.py +24 -34
  27. godoo_cli-0.15.1/src/godoo_cli/commands/odoo_bin/launch.py +196 -0
  28. {godoo_cli-0.14.10/src/godoo_cli/commands/shell → godoo_cli-0.15.1/src/godoo_cli/commands/odoo_bin}/shell.py +16 -23
  29. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/commands/rpc/translations.py +1 -1
  30. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/commands/source_get.py +44 -31
  31. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/git/git_repo.py +13 -3
  32. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/helpers/modules_git.py +1 -1
  33. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/helpers/modules_py.py +1 -1
  34. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/helpers/odoo_files.py +1 -15
  35. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/helpers/system.py +14 -0
  36. godoo_cli-0.15.1/src/godoo_cli/models/__init__.py +5 -0
  37. godoo_cli-0.14.10/src/godoo_cli/commands/db/connection.py → godoo_cli-0.15.1/src/godoo_cli/models/db_connection.py +6 -31
  38. godoo_cli-0.15.1/src/godoo_cli/models/godoo_models.py +102 -0
  39. godoo_cli-0.14.10/src/godoo_cli/helpers/modules.py → godoo_cli-0.15.1/src/godoo_cli/models/godoo_modules.py +9 -56
  40. godoo_cli-0.14.10/src/godoo_cli/commands/bootstrap.py +0 -203
  41. godoo_cli-0.14.10/src/godoo_cli/commands/db/cli.py +0 -34
  42. godoo_cli-0.14.10/src/godoo_cli/commands/launch.py +0 -364
  43. godoo_cli-0.14.10/src/godoo_cli/commands/test/__init__.py +0 -9
  44. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/.codecovrc +0 -0
  45. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/.devcontainer/devcontainer.json +0 -0
  46. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/.env.sample +0 -0
  47. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/.eslintignore +0 -0
  48. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/.eslintrc.yml +0 -0
  49. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/.github/FUNDING.yml +0 -0
  50. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/.github/workflows/README.md +0 -0
  51. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/.github/workflows/version-bump.yml +0 -0
  52. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/.github/workflows/version-publish.yml +0 -0
  53. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/.pre-commit-config.yaml +0 -0
  54. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/.prettierrc.yml +0 -0
  55. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/.vscode/launch.json +0 -0
  56. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/LICENSE +0 -0
  57. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/README.md +0 -0
  58. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/addons/.gitkeep +0 -0
  59. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/addons/godoo_test_succ_mod/__init__.py +0 -0
  60. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/addons/godoo_test_succ_mod/__manifest__.py +0 -0
  61. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/addons/godoo_test_succ_mod/models/__init__.py +0 -0
  62. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/addons/godoo_test_succ_mod/tests/__init__.py +0 -0
  63. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/addons/godoo_test_succ_mod/tests/test_succ.py +0 -0
  64. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/assets/godoo-main-cli.png +0 -0
  65. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/assets/odoo_logo.png +0 -0
  66. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/config/nginx.conf +0 -0
  67. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/config/postgresql.conf +0 -0
  68. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/config/supervisord.conf +0 -0
  69. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/docker/cups/Dockerfile +0 -0
  70. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/docker/cups/config/cups-pdf.conf +0 -0
  71. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/docker/cups/config/cupsd.conf +0 -0
  72. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/docker/cups/cups_entrypoint.sh +0 -0
  73. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/docker/depends_runtime.sh +0 -0
  74. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/docker/docker-compose.devcontainer-traefik.yml +0 -0
  75. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/docker/docker-compose.traefik.yml +0 -0
  76. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/godoo_src.code-workspace +0 -0
  77. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/odoo_manifest.yml +0 -0
  78. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/pyproject.toml +0 -0
  79. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/scripts/container_requirements.sh +0 -0
  80. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/scripts/launchodoo.sh +0 -0
  81. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/scripts/migrations/development/shrink_database.py +0 -0
  82. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/scripts/reset_devcontainer.sh +0 -0
  83. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/__init__.py +0 -0
  84. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/__main__.py +0 -0
  85. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/commands/backup/__init__.py +0 -0
  86. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/commands/backup/cli.py +0 -0
  87. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/commands/backup/pull.py +0 -0
  88. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/commands/config.py +0 -0
  89. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/commands/db/__init__.py +0 -0
  90. {godoo_cli-0.14.10/src/godoo_cli/commands/test → godoo_cli-0.15.1/src/godoo_cli/commands/odoo_bin/godoo_test}/cli.py +0 -0
  91. {godoo_cli-0.14.10/src/godoo_cli/commands/shell/scripts → godoo_cli-0.15.1/src/godoo_cli/commands/odoo_bin/shell_scripts}/odoo_banner.py +0 -0
  92. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/commands/rpc/__init__.py +0 -0
  93. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/commands/rpc/cli.py +0 -0
  94. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/commands/rpc/config_parameters.py +0 -0
  95. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/commands/rpc/importer.py +0 -0
  96. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/commands/rpc/modules.py +0 -0
  97. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/git/__init__.py +0 -0
  98. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/git/git_odoo.py +0 -0
  99. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/git/git_odoo_addons.py +0 -0
  100. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/git/git_url.py +0 -0
  101. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/git/zip_download.py +0 -0
  102. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/helpers/__init__.py +0 -0
  103. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/helpers/cli.py +0 -0
  104. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/helpers/odoo_manifest.py +0 -0
  105. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/godoo_cli/helpers/pip.py +0 -0
  106. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/src/tests/test_git_clone.py +0 -0
  107. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/thirdparty/.gitkeep +0 -0
  108. {godoo_cli-0.14.10 → godoo_cli-0.15.1}/uv.lock +0 -0
@@ -25,10 +25,10 @@ jobs:
25
25
  matrix:
26
26
  python-version: ["3.9", "3.11", "3.12"]
27
27
  steps:
28
- - uses: actions/checkout@v4
28
+ - uses: actions/checkout@v5
29
29
 
30
30
  - name: Install UV
31
- uses: astral-sh/setup-uv@v2
31
+ uses: astral-sh/setup-uv@v7
32
32
  with:
33
33
  enable-cache: true
34
34
  cache-dependency-glob: "pyproject.toml"
@@ -66,20 +66,13 @@ jobs:
66
66
  packages: write
67
67
 
68
68
  steps:
69
- - uses: actions/checkout@v4
69
+ - uses: actions/checkout@v5
70
70
  with:
71
71
  fetch-depth: 1 # Shallow clone sufficient for build
72
72
 
73
73
  - name: Set up Docker Buildx
74
74
  uses: docker/setup-buildx-action@v3
75
75
 
76
- - name: Cache Docker layers
77
- uses: actions/cache@v4
78
- with:
79
- path: /tmp/.buildx-cache
80
- key: ${{ runner.os }}-buildx-${{ github.sha }}
81
- restore-keys: |
82
- ${{ runner.os }}-buildx-
83
76
 
84
77
  - name: Login to Container registry
85
78
  uses: docker/login-action@v3
@@ -103,10 +96,6 @@ jobs:
103
96
  push: true
104
97
  tags: ${{ steps.meta.outputs.tags }}
105
98
  labels: ${{ steps.meta.outputs.labels }}
106
- cache-from: type=local,src=/tmp/.buildx-cache
107
- cache-to: type=local,dest=/tmp/.buildx-cache-new
99
+ cache-from: type=gha
100
+ cache-to: type=gha,mode=max
108
101
 
109
- - name: Move cache
110
- run: |
111
- rm -rf /tmp/.buildx-cache
112
- mv /tmp/.buildx-cache-new /tmp/.buildx-cache
@@ -60,6 +60,7 @@ coverage.xml
60
60
  .hypothesis/
61
61
  .pytest_cache/
62
62
  cover/
63
+ junit/
63
64
 
64
65
  # Translations
65
66
  *.mo
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gOdoo-cli
3
- Version: 0.14.10
3
+ Version: 0.15.1
4
4
  Summary: Wrapper around Odoo-Bin with some convinience RPC functions.
5
5
  Project-URL: repository, https://github.com/OpenJKSoftware/gOdoo
6
6
  Author-email: Joshua Kreuder <Joshua_Kreuder@outlook.com>
@@ -4,7 +4,6 @@ from odoo import api
4
4
 
5
5
 
6
6
  # pylint: disable=unused-argument
7
- # ruff: noqa: ARG001
8
7
  def generate_test_data(env: api.Environment):
9
8
  """Generate Test Data for the ven Environment."""
10
9
  # Add your Test Data Generation code here
@@ -40,8 +40,10 @@ ARG SOURCE_CLONE_ARCHIVE
40
40
  ENV SOURCE_CLONE_ARCHIVE=${SOURCE_CLONE_ARCHIVE}
41
41
 
42
42
  # Install Dependencies using depends_build.sh
43
- RUN --mount=type=bind,source=docker/depends_build.sh,target=/tmp/depends_build.sh \
44
- set -ex; sudo bash /tmp/depends_build.sh
43
+ COPY docker/depends_build.sh docker/psql.gpg /tmp/
44
+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
45
+ --mount=type=cache,target=/var/lib/apt/lists,sharing=locked set -ex; \
46
+ sudo bash /tmp/depends_build.sh
45
47
 
46
48
  # ------------------------------------------------------------------------------------------------------
47
49
  # Install godoo from this workspace. (see pip install below)
@@ -159,48 +161,60 @@ FROM dev_odoo AS devcontainer
159
161
  # Instal godoo autocomplete. Env var to disable shellingham, as docker doesnt run in a shell
160
162
  RUN set -ex; _TYPER_COMPLETE_TEST_DISABLE_SHELL_DETECTION=true godoo --install-completion zsh
161
163
 
162
- ARG USERNAME
163
164
  ARG NVM_VERSION
164
165
  ARG NODE_VERSION
165
166
  ENV NVM_DIR=/usr/local/nvm \
166
167
  NODE_VERSION=${NODE_VERSION}
168
+
169
+ # Setup NVM directory with proper permissions
167
170
  RUN set -ex; sudo install -d -m 0755 -o ${USERNAME} -g ${USERNAME} $NVM_DIR
168
171
 
172
+ # Install NVM, Node.js and npm as non-root user
169
173
  RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh | bash
170
- # install node and npm
171
- RUN set -ex; \
174
+ # Install node and npm
175
+ RUN set -e; \
172
176
  . $NVM_DIR/nvm.sh \
173
177
  && nvm install $NODE_VERSION \
174
178
  && nvm alias default $NODE_VERSION \
175
179
  && npm config -g set cafile /etc/ssl/certs/ca-certificates.crt \
176
180
  && nvm use default
177
- # add node and npm to path so the commands are available
181
+ # Add node and npm to path so the commands are available
178
182
  ENV NODE_PATH=$NVM_DIR/v$NODE_VERSION/lib/node_modules \
179
183
  PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH\
180
184
  NODE_EXTRA_CA_CERTS=/etc/ssl/certs/ca-certificates.crt
181
185
 
182
- # Install PostgreSQL client and other development tools
183
- RUN --mount=type=bind,source=docker/depends_build.sh,target=/tmp/depends_build.sh \
184
- set -ex; \
185
- sudo bash /tmp/depends_build.sh \
186
- && sudo bash -c 'mkdir -p /home/$USERNAME/{.vscode-server/extensions,.cache/pre-commit} \
187
- && chown -R $USERNAME:$USERNAME /home/$USERNAME/{.vscode-server,.cache} \
188
- && mkdir -p /etc/cups \
186
+ # Configure system settings that require root
187
+ USER root
188
+ RUN set -ex; \
189
+ mkdir -p /etc/cups \
189
190
  && echo "ServerName cups:631" > /etc/cups/client.conf \
190
- && printf "Host upgrade.odoo.com\n\tStrictHostKeyChecking accept-new" > /etc/ssh/ssh_config.d/odoo_upgrade.conf'
191
+ && printf "Host upgrade.odoo.com\n\tStrictHostKeyChecking accept-new" > /etc/ssh/ssh_config.d/odoo_upgrade.conf
191
192
 
192
193
  ARG WORKSPACE
193
194
  ENV ODOO_PRINT_PDF_LOCATION=$WORKSPACE
194
195
 
196
+ # Setup nginx and fix permissions
195
197
  RUN set -ex; \
196
- sudo rm -rf /tmp/* \
197
- && sudo usermod -a -G www-data ${USERNAME} \
198
- && bash -c 'sudo chown -R ${USERNAME} {/var/lib/nginx,/var/log/nginx}'
199
-
200
- RUN --mount=type=cache,target=/var/cache/apt \
201
- --mount=type=cache,target=$UV_CACHE_DIR,uid=1000,gid=1000 \
202
- set -ex; \
198
+ rm -rf /tmp/* \
199
+ && rm -f /etc/nginx/nginx.conf \
200
+ && ln -s /odoo/config/nginx.conf /etc/nginx/nginx.conf \
201
+ && rm -f /etc/nginx/proxy_headers.conf \
202
+ && ln -s /odoo/config/nginx-proxy_headers.conf /etc/nginx/proxy_headers.conf \
203
+ && usermod -a -G www-data ${USERNAME} \
204
+ && chown -R ${USERNAME} /var/lib/nginx /var/log/nginx
205
+
206
+ # Install system packages that require root
207
+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
208
+ --mount=type=cache,target=/var/lib/apt/lists,sharing=locked set -ex; \
209
+ apt-get update \
210
+ && apt-get install default-jre -y
211
+
212
+ # Switch back to non-root user for npm and pip installations
213
+ USER ${USERNAME}
214
+ RUN --mount=type=cache,target=$UV_CACHE_DIR,uid=1000,gid=1000 \
215
+ --mount=type=cache,target=/root/.npm,uid=1000,gid=1000 set -ex; \
203
216
  npm install -g prettier eslint \
204
- && git config --global --add safe.directory ${WORKSPACE}
217
+ && uv pip install pydevd-odoo pre-commit jingtrang
218
+
205
219
  ENV EDITOR=code
206
- ENTRYPOINT [ "/bin/sh", "-c", "sudo nginx -c /odoo/config/nginx.conf; sleep infinity"]
220
+ ENTRYPOINT [ "/bin/sh", "-c", "service nginx start; sleep infinity"]
@@ -7,14 +7,10 @@ rm -f /etc/apt/apt.conf.d/docker-clean
7
7
  apt-get update
8
8
  apt-get install -y --no-install-recommends \
9
9
  lsb-release \
10
- gpg \
11
- wget \
12
- curl
10
+ gpg
13
11
 
14
- # Add PostgreSQL repository and key
15
12
  echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
16
- # Download the PostgreSQL key directly instead of using a local file
17
- wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
13
+ mv $DIR/psql.gpg /etc/apt/trusted.gpg.d/
18
14
  apt-get update --fix-missing
19
15
 
20
16
  # ######################### Install gOdoo dependencies #########################
@@ -22,12 +18,14 @@ apt-get install -y -q --no-install-recommends \
22
18
  git \
23
19
  apt-utils \
24
20
  openssh-client \
21
+ wget \
25
22
  rsync \
23
+ curl \
26
24
  unzip \
27
25
  postgresql-client-17 \
28
26
  libldap2-dev \
29
27
  libssl-dev \
30
28
  libsasl2-dev \
31
- libcups2-dev \
32
29
  build-essential \
33
- pkg-config
30
+ pkg-config \
31
+ libcups2-dev
@@ -23,7 +23,7 @@ services:
23
23
  - "postgres_socket:/var/run/postgresql"
24
24
 
25
25
  db:
26
- image: postgres:16-alpine
26
+ image: postgres:17-alpine
27
27
  environment:
28
28
  - TZ=${TZ:-Europe/Berlin}
29
29
  - POSTGRES_DB=postgres
@@ -2,16 +2,11 @@ services:
2
2
  app:
3
3
  build:
4
4
  target: devcontainer
5
- args:
6
- SOURCE_CLONE_ARCHIVE: False
7
5
  command: ""
8
6
  volumes:
9
- - vscode_server:/home/ContainerUser/.vscode-server
10
- - devcontainer_cache:/home/ContainerUser/.cache
11
7
  - commandhistory:/home/ContainerUser/.commandhistory
12
8
  - ../:/odoo/godoo_workspace # Mount vscode Workspace
13
9
  - ../config:/odoo/config # Mount config folder
14
- - venv:/odoo/venv
15
10
  cap_add:
16
11
  - SYS_PTRACE
17
12
 
@@ -20,7 +15,4 @@ services:
20
15
  context: cups
21
16
 
22
17
  volumes:
23
- venv:
24
- vscode_server:
25
18
  commandhistory:
26
- devcontainer_cache:
Binary file
@@ -28,3 +28,6 @@ reset-hard: # To be called from Outside the Devcontainer
28
28
 
29
29
  rebuild:
30
30
  cd docker && docker compose -f docker-compose.base.yml -f docker-compose.devcontainer.yml build
31
+
32
+ lint:
33
+ hatch run dev:lint
@@ -2,7 +2,7 @@
2
2
 
3
3
  from packaging import version
4
4
 
5
- __version__ = "0.14.10" # Initial version, will be managed by Hatch
5
+ __version__ = "0.15.1" # Initial version, will be managed by Hatch
6
6
 
7
7
 
8
8
  def get_version_tuple() -> tuple[int, int, int]:
@@ -13,22 +13,8 @@ from dotenv import load_dotenv
13
13
  from rich import print as rich_print
14
14
 
15
15
  from . import __about__
16
+ from . import commands as cmd
16
17
  from .cli_common import CommonCLI
17
- from .commands import (
18
- backup_cli_app,
19
- bootstrap_odoo,
20
- db_cli_app,
21
- launch_import,
22
- launch_odoo,
23
- odoo_run_tests,
24
- odoo_shell,
25
- odoo_shell_run_script,
26
- rpc_cli_app,
27
- set_odoo_config,
28
- source_cli_app,
29
- test_cli_app,
30
- uninstall_modules,
31
- )
32
18
  from .helpers.odoo_files import odoo_bin_get_version
33
19
  from .helpers.system import set_logging
34
20
 
@@ -83,30 +69,30 @@ def main_cli():
83
69
 
84
70
  # Nested Subcommands
85
71
  app.add_typer(
86
- typer_instance=rpc_cli_app(),
72
+ typer_instance=cmd.rpc_cli_app(),
87
73
  name="rpc",
88
74
  )
89
75
  app.add_typer(
90
- typer_instance=db_cli_app(),
76
+ typer_instance=cmd.db_cli_app(),
91
77
  name="db",
92
78
  )
93
79
  app.add_typer(
94
- typer_instance=source_cli_app(),
80
+ typer_instance=cmd.source_cli_app(),
95
81
  name="source",
96
82
  )
97
- app.add_typer(typer_instance=backup_cli_app(), name="backup")
98
- app.add_typer(typer_instance=test_cli_app(), name="test")
83
+ app.add_typer(typer_instance=cmd.backup_cli_app(), name="backup")
84
+ app.add_typer(typer_instance=cmd.test_cli_app(), name="test")
99
85
 
100
86
  # Normal Subcommands
101
87
  app.command("version")(print_versions)
102
- app.command("bootstrap")(bootstrap_odoo)
103
- app.command("launch")(launch_odoo)
104
- app.command("launch-import")(launch_import)
105
- app.command("test")(odoo_run_tests)
106
- app.command("config")(set_odoo_config)
107
- app.command("shell")(odoo_shell)
108
- app.command("shell-script")(odoo_shell_run_script)
109
- app.command("uninstall")(uninstall_modules)
88
+ app.command("bootstrap")(cmd.bootstrap_odoo)
89
+ app.command("launch")(cmd.launch_odoo)
90
+ app.command("launch-import")(cmd.launch_import)
91
+ app.command("test")(cmd.odoo_run_tests)
92
+ app.command("config")(cmd.set_odoo_config)
93
+ app.command("shell")(cmd.odoo_shell)
94
+ app.command("shell-script")(cmd.odoo_shell_run_script)
95
+ app.command("uninstall")(cmd.odoo_shell_uninstall_modules)
110
96
  return app
111
97
 
112
98
 
@@ -163,6 +163,7 @@ class SourceGetArgs:
163
163
  "--source-download-archive",
164
164
  envvar="SOURCE_CLONE_ARCHIVE",
165
165
  help="When using a HTTPs Repo Url for Github we can download a snapshop without the Repo history",
166
+ is_flag=True,
166
167
  )
167
168
 
168
169
 
@@ -11,12 +11,18 @@ of the gOdoo CLI, including:
11
11
  """
12
12
 
13
13
  from .backup import backup_cli_app
14
- from .bootstrap import bootstrap_odoo
15
14
  from .config import set_odoo_config
16
15
  from .db import db_cli_app
17
- from .launch import launch_import, launch_odoo
16
+ from .odoo_bin import (
17
+ bootstrap_odoo,
18
+ launch_import,
19
+ launch_odoo,
20
+ odoo_load_test_data,
21
+ odoo_run_tests,
22
+ odoo_shell,
23
+ odoo_shell_run_script,
24
+ odoo_shell_uninstall_modules,
25
+ test_cli_app,
26
+ )
18
27
  from .rpc import rpc_cli_app
19
- from .shell.shell import odoo_shell, odoo_shell_run_script, uninstall_modules
20
28
  from .source_get import source_cli_app
21
- from .test import test_cli_app
22
- from .test.test_run import odoo_run_tests
@@ -14,7 +14,8 @@ import typer
14
14
 
15
15
  from ...cli_common import CommonCLI
16
16
  from ...helpers.odoo_files import odoo_bin_get_version
17
- from ..db.connection import DBConnection
17
+ from ...helpers.system import sizeof_fmt
18
+ from ...models import DBConnection
18
19
  from .util import call_rsync
19
20
 
20
21
  LOGGER = logging.getLogger(__name__)
@@ -70,12 +71,18 @@ def dump_instance(
70
71
  LOGGER.info("Dumping Filestore -> %s", filestore_target)
71
72
  call_rsync(source_folder=data_dir, target_folder=filestore_target)
72
73
 
74
+ def get_folder_size(path: Path) -> int:
75
+ return sum(f.stat().st_size for f in path.rglob("*") if f.is_file())
76
+
77
+ filestore_size_human = sizeof_fmt(get_folder_size(filestore_target))
78
+ LOGGER.info("Filestore Dump Completed with size -> %s", filestore_size_human)
79
+
73
80
  # Dump DB using pg_dump
74
81
  db_dump_target = dump_path / "odoo.dump"
75
82
  LOGGER.info("Dumping DB -> %s", db_dump_target)
76
83
  db_dump_target.unlink(missing_ok=True)
77
84
  db_connection.run_psql_shell_command(f"pg_dump --format c {{}} > {db_dump_target}")
78
- LOGGER.info("SQL Dump Completed with size -> %.2f MB", db_dump_target.stat().st_size / (1024 * 1024))
85
+ LOGGER.info("SQL Dump Completed with size -> %s", sizeof_fmt(db_dump_target.stat().st_size))
79
86
 
80
87
  readme_path = dump_path / "README.md"
81
88
  readme_path.unlink(missing_ok=True)
@@ -95,4 +102,11 @@ SQL Dump and Filestore of gOdoo Instance.
95
102
 
96
103
  """
97
104
  readme_path.write_text(readme_content)
98
- LOGGER.info("Odoo Dump Completed -> %s", dump_path)
105
+ total_dump_size_human = sizeof_fmt(
106
+ get_folder_size(filestore_target) + db_dump_target.stat().st_size + readme_path.stat().st_size
107
+ )
108
+ LOGGER.info(
109
+ "Odoo Dump with total size %s Completed -> %s",
110
+ total_dump_size_human,
111
+ dump_path,
112
+ )
@@ -11,7 +11,7 @@ from typing import Annotated, Optional
11
11
  import typer
12
12
 
13
13
  from ...cli_common import CommonCLI
14
- from ..db.connection import DBConnection
14
+ from ...models import DBConnection
15
15
  from .util import call_rsync, create_db, drop_db
16
16
 
17
17
  LOGGER = logging.getLogger(__name__)
@@ -8,7 +8,7 @@ import logging
8
8
  import subprocess
9
9
  from pathlib import Path
10
10
 
11
- from ..db.connection import DBConnection
11
+ from ...models import DBConnection
12
12
 
13
13
  LOGGER = logging.getLogger(__name__)
14
14
 
@@ -0,0 +1,64 @@
1
+ """Database management CLI module.
2
+
3
+ This module provides the command-line interface for database management operations,
4
+ including password management, database queries, and bootstrap status checks.
5
+ """
6
+
7
+ import subprocess
8
+ from typing import Annotated
9
+
10
+ import typer
11
+
12
+ from ...cli_common import CommonCLI
13
+ from .passwords import set_passwords
14
+ from .query import get_installed_modules, is_bootstrapped, query_database
15
+
16
+ CLI = CommonCLI()
17
+
18
+
19
+ def login_db(
20
+ db_name: Annotated[str, CLI.database.db_name],
21
+ db_user: Annotated[str, CLI.database.db_user],
22
+ db_host: Annotated[str, CLI.database.db_host] = "",
23
+ db_port: Annotated[int, CLI.database.db_port] = 0,
24
+ db_password: Annotated[str, CLI.database.db_password] = "",
25
+ ):
26
+ """Launch an interactive psql CLI session with the provided credentials.
27
+
28
+ This function starts an interactive PostgreSQL command-line session using
29
+ the provided database connection parameters.
30
+
31
+ Args:
32
+ db_host: Database host address.
33
+ db_port: Database port number.
34
+ db_name: Name of the database to connect to.
35
+ db_user: Database username.
36
+ db_password: Database password.
37
+ """
38
+ command = ["psql", f"-h{db_host}", f"-U{db_user}", f"-d{db_name}"]
39
+ if db_port != 0:
40
+ command.append(f"-p{db_port}")
41
+ subprocess.run(command, env={"PGPASSWORD": db_password})
42
+
43
+
44
+ def db_cli_app():
45
+ """Create and configure the database CLI application.
46
+
47
+ This function sets up the command-line interface for database operations,
48
+ including commands for password management, database queries, and status checks.
49
+
50
+ Returns:
51
+ typer.Typer: The configured CLI application instance.
52
+ """
53
+ app = typer.Typer(
54
+ no_args_is_help=True,
55
+ help="Functions that directly act on the Postgres DB",
56
+ )
57
+
58
+ app.command()(set_passwords)
59
+ app.command("login")(login_db)
60
+ app.command("query")(query_database)
61
+ app.command("odoo-bootstrapped")(is_bootstrapped)
62
+ app.command("installed-modules")(get_installed_modules)
63
+
64
+ return app
@@ -12,7 +12,7 @@ from passlib.context import CryptContext
12
12
 
13
13
  from ...cli_common import CommonCLI
14
14
  from ...helpers.cli import check_dangerous_command
15
- from .connection import DBConnection
15
+ from ...models import DBConnection
16
16
 
17
17
  LOGGER = logging.getLogger(__name__)
18
18
  CLI = CommonCLI()
@@ -13,7 +13,7 @@ from psycopg2 import OperationalError, ProgrammingError
13
13
 
14
14
  from ...cli_common import CommonCLI
15
15
  from ...helpers.cli import check_dangerous_command
16
- from .connection import DBConnection
16
+ from ...models import DBConnection
17
17
 
18
18
 
19
19
  class DbBootstrapStatus(enum.Enum):
@@ -41,6 +41,7 @@ def query_database(
41
41
  db_host: Annotated[str, CLI.database.db_host] = "",
42
42
  db_port: Annotated[int, CLI.database.db_port] = 0,
43
43
  db_password: Annotated[str, CLI.database.db_password] = "",
44
+ readonly: Annotated[bool, typer.Option(help="Run query in readonly mode", show_default=True)] = True,
44
45
  ):
45
46
  """Run a Query against the database.
46
47
 
@@ -60,6 +61,7 @@ def query_database(
60
61
  username=db_user,
61
62
  password=db_password,
62
63
  db_name=db_name,
64
+ readonly=readonly,
63
65
  )
64
66
  with connection.connect() as cursor:
65
67
  try:
@@ -114,6 +116,7 @@ def is_bootstrapped(
114
116
  username=db_user,
115
117
  password=db_password,
116
118
  db_name=db_name,
119
+ readonly=True,
117
120
  )
118
121
  bootstrap_value = _is_bootstrapped(db_connection=connection)
119
122
  LOGGER.info("Odoo Database Status: %s", bootstrap_value.value)
@@ -162,6 +165,7 @@ def get_installed_modules(
162
165
  username=db_user,
163
166
  password=db_password,
164
167
  db_name=db_name,
168
+ readonly=True,
165
169
  )
166
170
  installed_modules = _get_installed_modules(db_connection=db_connection, to_install=to_install)
167
171
  if isinstance(installed_modules, int):
@@ -0,0 +1,6 @@
1
+ """CLI command to Bootstrap or launch Odoo using odoo-bin."""
2
+
3
+ from .bootstrap import bootstrap_odoo
4
+ from .godoo_test import *
5
+ from .launch import launch_import, launch_odoo
6
+ from .shell import odoo_shell, odoo_shell_run_script, odoo_shell_uninstall_modules