mangono-addon-odoo-custom-server 1.0.0__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 (33) hide show
  1. mangono_addon_odoo_custom_server-1.0.0/.gitignore +146 -0
  2. mangono_addon_odoo_custom_server-1.0.0/.gitlab-ci.yml +88 -0
  3. mangono_addon_odoo_custom_server-1.0.0/.idea/.gitignore +8 -0
  4. mangono_addon_odoo_custom_server-1.0.0/.idea/GitlabLint.xml +11 -0
  5. mangono_addon_odoo_custom_server-1.0.0/.idea/inspectionProfiles/Project_Default.xml +15 -0
  6. mangono_addon_odoo_custom_server-1.0.0/.idea/misc.xml +7 -0
  7. mangono_addon_odoo_custom_server-1.0.0/.idea/modules.xml +8 -0
  8. mangono_addon_odoo_custom_server-1.0.0/.idea/ruff.xml +6 -0
  9. mangono_addon_odoo_custom_server-1.0.0/.idea/vcs.xml +16 -0
  10. mangono_addon_odoo_custom_server-1.0.0/.pre-commit-config.yaml +21 -0
  11. mangono_addon_odoo_custom_server-1.0.0/PKG-INFO +29 -0
  12. mangono_addon_odoo_custom_server-1.0.0/README.md +36 -0
  13. mangono_addon_odoo_custom_server-1.0.0/in_docker_test.sh +9 -0
  14. mangono_addon_odoo_custom_server-1.0.0/odoo-addon-name.txt +1 -0
  15. mangono_addon_odoo_custom_server-1.0.0/odoo_custom_server/__init__.py +2 -0
  16. mangono_addon_odoo_custom_server-1.0.0/odoo_custom_server/__manifest__.py +15 -0
  17. mangono_addon_odoo_custom_server-1.0.0/odoo_custom_server/cli/__init__.py +3 -0
  18. mangono_addon_odoo_custom_server-1.0.0/odoo_custom_server/cli/generic_server.py +23 -0
  19. mangono_addon_odoo_custom_server-1.0.0/odoo_custom_server/cli/update_server.py +38 -0
  20. mangono_addon_odoo_custom_server-1.0.0/odoo_custom_server/cli/web_server.py +19 -0
  21. mangono_addon_odoo_custom_server-1.0.0/odoo_custom_server/command_server.py +175 -0
  22. mangono_addon_odoo_custom_server-1.0.0/odoo_custom_server/odoo_patch/__init__.py +0 -0
  23. mangono_addon_odoo_custom_server-1.0.0/odoo_custom_server/odoo_patch/sql_db.py +61 -0
  24. mangono_addon_odoo_custom_server-1.0.0/pyproject.toml +52 -0
  25. mangono_addon_odoo_custom_server-1.0.0/requirements.txt +4 -0
  26. mangono_addon_odoo_custom_server-1.0.0/ruff.toml +25 -0
  27. mangono_addon_odoo_custom_server-1.0.0/server-commands.iml +21 -0
  28. mangono_addon_odoo_custom_server-1.0.0/tests/__init__.py +0 -0
  29. mangono_addon_odoo_custom_server-1.0.0/tests/example.env +9 -0
  30. mangono_addon_odoo_custom_server-1.0.0/tests/test_cli.py +143 -0
  31. mangono_addon_odoo_custom_server-1.0.0/tests/test_cli_upgrade_server.py +106 -0
  32. mangono_addon_odoo_custom_server-1.0.0/tests/test_odoo_env_patch.py +95 -0
  33. mangono_addon_odoo_custom_server-1.0.0/uv.lock +1792 -0
@@ -0,0 +1,146 @@
1
+ ### Python template
2
+ # Byte-compiled / optimized / DLL files
3
+
4
+ # File _version autogenerate
5
+ _version.py
6
+
7
+ __pycache__/
8
+ *.py[cod]
9
+ *$py.class
10
+
11
+ # C extensions
12
+ *.so
13
+
14
+ # Distribution / packaging
15
+ .Python
16
+ build/
17
+ develop-eggs/
18
+ dist/
19
+ downloads/
20
+ eggs/
21
+ .eggs/
22
+ lib/
23
+ lib64/
24
+ parts/
25
+ sdist/
26
+ var/
27
+ wheels/
28
+ share/python-wheels/
29
+ *.egg-info/
30
+ .installed.cfg
31
+ *.egg
32
+ MANIFEST
33
+
34
+ # PyInstaller
35
+ # Usually these files are written by a python script from a template
36
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
37
+ *.manifest
38
+ *.spec
39
+
40
+ # Installer logs
41
+ pip-log.txt
42
+ pip-delete-this-directory.txt
43
+
44
+ # Unit test / coverage reports
45
+ htmlcov/
46
+ .tox/
47
+ .nox/
48
+ .coverage
49
+ .coverage.*
50
+ .cache
51
+ nosetests.xml
52
+ coverage.xml
53
+ *.cover
54
+ *.py,cover
55
+ .hypothesis/
56
+ .pytest_cache/
57
+ cover/
58
+
59
+ # Translations
60
+ *.mo
61
+ *.pot
62
+
63
+ # Django stuff:
64
+ *.log
65
+ local_settings.py
66
+ db.sqlite3
67
+ db.sqlite3-journal
68
+
69
+ # Flask stuff:
70
+ instance/
71
+ .webassets-cache
72
+
73
+ # Scrapy stuff:
74
+ .scrapy
75
+
76
+ # Sphinx documentation
77
+ docs/_build/
78
+
79
+ # PyBuilder
80
+ .pybuilder/
81
+ target/
82
+
83
+ # Jupyter Notebook
84
+ .ipynb_checkpoints
85
+
86
+ # IPython
87
+ profile_default/
88
+ ipython_config.py
89
+
90
+ # pyenv
91
+ # For a library or package, you might want to ignore these files since the code is
92
+ # intended to run in multiple environments; otherwise, check them in:
93
+ # .python-version
94
+
95
+ # pipenv
96
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
97
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
98
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
99
+ # install all needed dependencies.
100
+ #Pipfile.lock
101
+
102
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
103
+ __pypackages__/
104
+
105
+ # Celery stuff
106
+ celerybeat-schedule
107
+ celerybeat.pid
108
+
109
+ # SageMath parsed files
110
+ *.sage.py
111
+
112
+ # Environments
113
+ .env
114
+ .venv
115
+ env/
116
+ venv/
117
+ ENV/
118
+ env.bak/
119
+ venv.bak/
120
+
121
+ # Spyder project settings
122
+ .spyderproject
123
+ .spyproject
124
+
125
+ # Rope project settings
126
+ .ropeproject
127
+
128
+ # mkdocs documentation
129
+ /site
130
+
131
+ # mypy
132
+ .mypy_cache/
133
+ .dmypy.json
134
+ dmypy.json
135
+
136
+ # Pyre type checker
137
+ .pyre/
138
+
139
+ # pytype static type analyzer
140
+ .pytype/
141
+
142
+ # Cython debug symbols
143
+ cython_debug/
144
+
145
+ # pycharm
146
+ .idea/
@@ -0,0 +1,88 @@
1
+ .if-on-protected-tag: &if-on-protected-tag
2
+ if: $CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"
3
+ .if-on-default-branch: &if-on-default-branch
4
+ if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
5
+ .if-on-merge-request: &if-on-merge-request
6
+ if: $CI_PIPELINE_SOURCE == 'merge_request_event'
7
+
8
+ workflow:
9
+ rules:
10
+ - *if-on-merge-request
11
+ - *if-on-default-branch
12
+ - *if-on-protected-tag
13
+
14
+ include:
15
+ - component: $CI_SERVER_HOST/gitlab-ci/code-quality/ruff@1
16
+ rules:
17
+ - *if-on-merge-request
18
+ - *if-on-default-branch
19
+ - component: $CI_SERVER_FQDN/python-libs/ci-component/build@~latest
20
+ inputs:
21
+ python_version: "3.13"
22
+ - component: $CI_SERVER_FQDN/python-libs/ci-component/upload-pypi@~latest
23
+ rules:
24
+ - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $CI_COMMIT_TAG == null
25
+ inputs:
26
+ registry_token_var: $TESTPYPI_REGISTRY_TOKEN
27
+ dependencies: [ "build:python" ]
28
+ registry_name: "testpypi"
29
+ - component: $CI_SERVER_FQDN/python-libs/ci-component/upload-pypi@~latest
30
+ rules:
31
+ - if: $CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED
32
+ inputs:
33
+ registry_token_var: $PYPI_REGISTRY_TOKEN
34
+ registry_name: "pypi"
35
+ dependencies: [ "build:python" ]
36
+ - component: $CI_SERVER_FQDN/python-libs/ci-component/upload-pypi@~latest
37
+ rules:
38
+ - if: $CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED && $CI_SERVER_HOST
39
+ inputs:
40
+ registry_token_var: $CI_JOB_TOKEN
41
+ registry_name: "$CI_SERVER_HOST"
42
+ dependencies: [ "build:python" ]
43
+
44
+
45
+ "test:odoo:all":
46
+ stage: test
47
+ tags:
48
+ - odoo
49
+ rules:
50
+ - *if-on-merge-request
51
+ - *if-on-default-branch
52
+ parallel:
53
+ matrix:
54
+ - ODOO_VERSION:
55
+ - "12.0"
56
+ - "13.0"
57
+ - "14.0"
58
+ - "15.0"
59
+ - "16.0"
60
+ - "17.0"
61
+ - "18.0"
62
+ image:
63
+ name: registry.mangono.io/odoo-cloud/container:$ODOO_VERSION
64
+ entrypoint: [ "" ]
65
+ before_script:
66
+ - pip install pytest pytest-cov pytest-mock environ-odoo-config
67
+ script:
68
+ - pip install .
69
+ - pytest --cov --cov-report=xml --no-cov-on-fail --junit-xml=report.xml
70
+ artifacts:
71
+ reports:
72
+ coverage_report:
73
+ coverage_format: cobertura
74
+ path: ./coverage.xml
75
+ junit: report.xml
76
+
77
+ # If we are tagging a release according protected rules and all
78
+ # previous checks succeeded, we proceed with creating a release automatically.
79
+ publish:release:
80
+ tags: ["lint"]
81
+ stage: deploy
82
+ image: registry.gitlab.com/gitlab-org/release-cli:latest
83
+ script: echo "Creating release $CI_COMMIT_TAG"
84
+ rules:
85
+ - if: $CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED
86
+ release:
87
+ tag_name: $CI_COMMIT_TAG
88
+ description: "Release $CI_COMMIT_TAG of components repository $CI_PROJECT_PATH"
@@ -0,0 +1,8 @@
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Editor-based HTTP Client requests
5
+ /httpRequests/
6
+ # Datasource local storage ignored files
7
+ /dataSources/
8
+ /dataSources.local.xml
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="com.github.blarc.gitlab.template.lint.plugin.settings.ProjectSettings">
4
+ <option name="gitlabUrl" value="https://gitlab.ndp-systemes.fr/api/v4" />
5
+ <option name="gitlabUrls">
6
+ <set>
7
+ <option value="https://gitlab.ndp-systemes.fr/api/v4" />
8
+ </set>
9
+ </option>
10
+ </component>
11
+ </project>
@@ -0,0 +1,15 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="PyCompatibilityInspection" enabled="true" level="ERROR" enabled_by_default="true" editorAttributes="ERRORS_ATTRIBUTES">
5
+ <option name="ourVersions">
6
+ <value>
7
+ <list size="2">
8
+ <item index="0" class="java.lang.String" itemvalue="3.13" />
9
+ <item index="1" class="java.lang.String" itemvalue="3.8" />
10
+ </list>
11
+ </value>
12
+ </option>
13
+ </inspection_tool>
14
+ </profile>
15
+ </component>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Black">
4
+ <option name="sdkName" value="Python 3.8 (server-command)" />
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (server-commands)" project-jdk-type="Python SDK" />
7
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/server-commands.iml" filepath="$PROJECT_DIR$/server-commands.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="RuffConfigService">
4
+ <option name="globalRuffExecutablePath" value="$USER_HOME$/.local/bin/ruff" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="IssueNavigationConfiguration">
4
+ <option name="links">
5
+ <list>
6
+ <IssueNavigationLink>
7
+ <option name="issueRegexp" value="\bodoo/(\w+)#(\d+)" />
8
+ <option name="linkRegexp" value="https://github.com/odoo/$1/issues/$2" />
9
+ </IssueNavigationLink>
10
+ </list>
11
+ </option>
12
+ </component>
13
+ <component name="VcsDirectoryMappings">
14
+ <mapping directory="" vcs="Git" />
15
+ </component>
16
+ </project>
@@ -0,0 +1,21 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v6.0.0
4
+ hooks:
5
+ - id: check-xml
6
+ - id: check-merge-conflict
7
+ - id: check-json
8
+ - id: check-toml
9
+ - id: check-yaml
10
+ args: [--allow-multiple-documents]
11
+ - id: end-of-file-fixer
12
+ - id: trailing-whitespace
13
+ - repo: https://github.com/astral-sh/ruff-pre-commit
14
+ # Ruff version.
15
+ rev: v0.14.7
16
+ hooks:
17
+ # Run the linter.
18
+ - id: ruff
19
+ args: [ --fix ]
20
+ # Run the formatter.
21
+ - id: ruff-format
@@ -0,0 +1,29 @@
1
+ Metadata-Version: 2.4
2
+ Name: mangono-addon-odoo_custom_server
3
+ Version: 1.0.0
4
+ Project-URL: Homepage, https://mangono.fr/
5
+ Author-Email: mangono <opensource+odoo@mangono.fr>
6
+ License-Expression: AGPL-3.0
7
+ Classifier: Framework :: Odoo
8
+ Classifier: Framework :: Odoo :: 12.0
9
+ Classifier: Framework :: Odoo :: 13.0
10
+ Classifier: Framework :: Odoo :: 14.0
11
+ Classifier: Framework :: Odoo :: 15.0
12
+ Classifier: Framework :: Odoo :: 16.0
13
+ Classifier: Framework :: Odoo :: 17.0
14
+ Classifier: Framework :: Odoo :: 18.0
15
+ Classifier: Framework :: Odoo :: 19.0
16
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3
17
+ Classifier: Programming Language :: Python
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.8
24
+ Classifier: Programming Language :: Python :: 3.9
25
+ Requires-Dist: environ-odoo-config>=0.6.1
26
+ Requires-Dist: addons-installer~=3.7
27
+ Requires-Dist: typing_extensions
28
+ Requires-Dist: wrapt~=1.17
29
+
@@ -0,0 +1,36 @@
1
+
2
+ # Server Command
3
+
4
+ Ce dépôt est séparé en 2 parties, à savoir une libraire et un module Odoo.
5
+
6
+ ## Librairie : Lib Odoo cli
7
+
8
+ Permet d'ajouter des commandes au serveur afin d'adapter Odoo pour des démarrages particulier selon un contexte.
9
+
10
+ _Installation :_
11
+
12
+ Il faut se trouver dans le répertoire et faire `pip install .`
13
+
14
+ ## Module : ndpserver
15
+
16
+ Ce module permet d'installer les nouvelles façons de démarrer Odoo. C'est un Module Odoo qui doit être présent dans le addons-path.
17
+
18
+ Automatiquement rajouté par notre image docker de Odoo (Dans les versions les plus récentes).
19
+
20
+ *Installation :*
21
+
22
+ Ne peut pas être installé, mais doit être présent dans les server wide modules pour utilisation.
23
+
24
+ *Test en local avec odoo V12*
25
+ uv venv --python 3.8.19 --seed
26
+ uv pip install setuptools==58.0.1 # nécessaire pour pouvoir installer suds-jurko
27
+ uv pip install suds-jurko==0.6 --no-build-isolation
28
+ uv pip install lxml==5.1.0 # forcer le problème de lxml_clean
29
+ uv pip install ../../python/odoo/v12/odoo # adapter le chemin vers odoo
30
+ uv pip install -r requirements.txt
31
+ uv pip install mangono-odoo-s3-filestore
32
+ python -m unittest discover
33
+
34
+ *test fonctionnel de lancement de odoo*
35
+ variables d'environnement déclarées en fichier .ENV, venv de ce projet avec `uv pip install .`, chemin de odoo-bin à
36
+ utiliser, paramètre=generic_server
@@ -0,0 +1,9 @@
1
+ #! /usr/bin/env bash
2
+ # Reset this var to be sure no addons_path is find
3
+ export ADDONS_GIT_CLOUD_MODULES="False"
4
+ git config --global --add safe.directory .
5
+ python --version
6
+ pip --version
7
+ pip install -U pip
8
+ pip install --no-input --disable-pip-version-check --no-python-version-warning --verbose .
9
+ python -m unittest discover -s tests -t ./
@@ -0,0 +1 @@
1
+ odoo_custom_server
@@ -0,0 +1,2 @@
1
+ from . import command_server
2
+ from . import cli
@@ -0,0 +1,15 @@
1
+ # -*- coding: utf-8 -*-
2
+ {
3
+ "name": "Server Odoo mangono",
4
+ "summary": """Custom server Odoo for mangono""",
5
+ "description": """""",
6
+ "author": "mangono",
7
+ "website": "https://mangono.fr/",
8
+ "category": "Uncategorized",
9
+ "version": "1.0.0",
10
+ "depends": ["base"],
11
+ "auto_install": False,
12
+ "data": [],
13
+ "installable": False,
14
+ "license": "AGPL-3",
15
+ }
@@ -0,0 +1,3 @@
1
+ from . import generic_server
2
+ from . import update_server
3
+ from . import web_server
@@ -0,0 +1,23 @@
1
+ from __future__ import annotations
2
+
3
+ from addons_installer import cli as installer_cli
4
+ from environ_odoo_config._odoo_command import OdooCommand
5
+
6
+ from odoo_custom_server.command_server import OdooPatchedServer
7
+
8
+
9
+ class GenericServer(OdooCommand):
10
+ """
11
+ 1. apply patch
12
+ 2. install the addons
13
+ 3. start server odoo with the config
14
+ """
15
+
16
+ name = "generic_server"
17
+
18
+ def get_runner(self) -> OdooPatchedServer:
19
+ return OdooPatchedServer(True)
20
+
21
+ def run(self, args: list[str]):
22
+ installer_cli.install_from_env(installer_cli.ArgsCli(all=True, verbose=True))
23
+ self.get_runner().execute_command(args=args)
@@ -0,0 +1,38 @@
1
+ from __future__ import annotations
2
+
3
+ import logging
4
+
5
+ from environ_odoo_config._odoo_command import OdooCommand
6
+
7
+ from odoo_custom_server.command_server import OdooPatchedServer
8
+
9
+ _logger = logging.getLogger("web_server")
10
+
11
+
12
+ class _InternalUpdateServer(OdooPatchedServer):
13
+ def do_somethings(self) -> bool:
14
+ if not self.env_config.update_init.update and not self.env_config.update_init.install:
15
+ _logger.error("Nothing to do, $INSTALL and $UPDATE are empty !!!!!!!")
16
+ return False
17
+ return True
18
+
19
+ def load_env_config(self):
20
+ _logger.info("Start Odoo in Update/Init mode")
21
+ super().load_env_config()
22
+ self.env_config.misc.stop_after_init = True
23
+ self.env_config.http.enable = False
24
+
25
+
26
+ class UpgradeServer(OdooCommand):
27
+ """
28
+ 1. apply patch
29
+ 2. start server odoo with the config in update/init mode, without UI and stop after update
30
+ """
31
+
32
+ name = "update_server"
33
+
34
+ def get_runner(self) -> OdooPatchedServer:
35
+ return _InternalUpdateServer(apply_patcher=True)
36
+
37
+ def run(self, args):
38
+ self.get_runner().execute_command(args)
@@ -0,0 +1,19 @@
1
+ from environ_odoo_config._odoo_command import OdooCommand
2
+
3
+ from odoo_custom_server.command_server import OdooPatchedServer
4
+
5
+
6
+ class WebServer(OdooCommand):
7
+ """
8
+ Only the default behavior
9
+ 1. apply patch
10
+ 2. start server odoo with the config
11
+ """
12
+
13
+ name = "web_server"
14
+
15
+ def get_runner(self) -> OdooPatchedServer:
16
+ return OdooPatchedServer(apply_patcher=True)
17
+
18
+ def run(self, args):
19
+ self.get_runner().execute_command(args)