diff --git a/CHANGELOG.md b/CHANGELOG.md index dc85d3e..7d417d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,14 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Added +- Script for hardening the installation + +## [1.6.0] - 2025-04-25 + +## Added + - Support multiple Odoo versions (12.0, 14.0, 16.0) in same workspace - - This will help for the migration of modules + - This will help for the migration of modules - Selenium script for increasing open software client interface and automating some actions. - Video recording - Support scrolling and word generating @@ -32,13 +38,14 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Test can be launched with a json configuration and support log/result individually - Script to search docker compose into the system - Script search class model can output into json format and support field information -- Improve Docker minimal installation docs in README for Ubuntu, test with Debian (https://github.com/ERPLibre/ERPLibre/issues/73) +- Improve Docker minimal installation docs in README for Ubuntu, test with + Debian (https://github.com/ERPLibre/ERPLibre/issues/73) - Statistic script showing evolution module into ERPLibre supporting Odoo 17 and Odoo 18 - Latest version wkhtmltopdf 0.12.6.1-3 ### Fixed -- NPM instaled locally and not globally +- NPM installed locally and not globally - Improve python code writer efficiency - Config generator supporting space into ERPLibre directory - Script to update Poetry to support @ URL @@ -441,7 +448,9 @@ Because addons repository has change, config file need to be updated. - Support only python3.6 and python3.7, python3.8 causes error in runtime. -[Unreleased]: https://github.com/ERPLibre/ERPLibre/compare/v1.5.0...HEAD +[Unreleased]: https://github.com/ERPLibre/ERPLibre/compare/v1.6.0...HEAD + +[1.6.0]: https://github.com/ERPLibre/ERPLibre/compare/v1.5.0...v1.6.0 [1.5.0]: https://github.com/ERPLibre/ERPLibre/compare/v1.4.0...v1.5.0 diff --git a/README.md b/README.md index 693db7b..20797c7 100644 --- a/README.md +++ b/README.md @@ -22,14 +22,14 @@ This has been tested in Debian 12 and Ubuntu 24.04 LTS. 1. Make sure Docker and nginx web server are installed:
```sudo apt install docker docker-compose nginx``` 1. Get the latest ERPLibre Docker compose file:
-```wget https://raw.githubusercontent.com/ERPLibre/ERPLibre/v1.5.0/docker-compose.yml``` +```wget https://raw.githubusercontent.com/ERPLibre/ERPLibre/v1.6.0/docker-compose.yml``` 1. Install and run ERPLibre with Docker running as a daemon (web server):
```sudo docker-compose up -d``` 1. Open the final installation step at this web page :
```http://[server IP]:8069```
![Capture du 2024-11-05 08-34-45](https://github.com/user-attachments/assets/7c6295b6-cc95-462d-822c-3ff72b772155) 1. Finish the installation by providing a database name, email and password. then click on **Create Database**. Depending on your system resources **this may take more than 2 minutes without feedback !** Check your browser loading indicator. -1. Next, the web page will reload itself and you should see the Applications list in ERPLibre:
+1. Next, the web page will reload itself, and you should see the Applications list in ERPLibre:
![2024-11-05_09-54](https://github.com/user-attachments/assets/1742c4a9-da96-466b-9c17-35eb5ca786ff) You can now personalize your ERPLibre installation. diff --git a/conf/supported_version_erplibre.json b/conf/supported_version_erplibre.json index cc8fe30..c3486bf 100644 --- a/conf/supported_version_erplibre.json +++ b/conf/supported_version_erplibre.json @@ -2,9 +2,7 @@ "odoo12.0_python3.7.17": { "odoo_version": "12.0", "python_version": "3.7.17", - "poetry_version": "1.5.0", - "default": true, - "note": "Official support ERPLibre 1.5.0" + "poetry_version": "1.5.0" }, "odoo14.0_python3.8.20": { "odoo_version": "14.0", @@ -14,6 +12,8 @@ "odoo16.0_python3.10.14": { "odoo_version": "16.0", "python_version": "3.10.14", - "poetry_version": "1.8.3" + "poetry_version": "1.8.3", + "default": true, + "note": "Official support ERPLibre 1.6.0" } } diff --git a/doc/RELEASE.md b/doc/RELEASE.md index b1a4c9b..caeb74f 100644 --- a/doc/RELEASE.md +++ b/doc/RELEASE.md @@ -19,13 +19,15 @@ This will erase everything in addons. Useful before creating docker, manifest an And update all from dev to merge into prod. +Test all supported Odoo version : + ```bash -./script/install/install_locally_dev.sh +make install_odoo_all_version ``` ## Validate environment -- Check if [manifest/default.dev.xml](../manifest/default.dev.xml) is ready for production. +- Check if each manifest version like [manifest/default.dev.odoo16.0.xml](../manifest/default.dev.odoo16.0.xml) is ready for production. - Run test : ```bash @@ -61,7 +63,7 @@ make docker_build_odoo_16 Search old version, like : ```bash -grep --color=always --exclude-dir={.repo,.venv,.git} --exclude="*.svg" -nri v1.2.0 +grep --color=always --exclude-dir={.repo,.venv,.git} --exclude="*.svg" -nri v1.6.0 ``` Replace if need it to new version. diff --git a/docker-compose.yml b/docker-compose.yml index 1dd72ac..7f09eff 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: "3.3" services: ERPLibre: - image: technolibre/erplibre:1.5.0 + image: technolibre/erplibre:1.6.0 ports: - 8069:8069 - 8071:8071 diff --git a/docker/Dockerfile.prod.pkg b/docker/Dockerfile.prod.pkg index 2b3baaf..83fd927 100644 --- a/docker/Dockerfile.prod.pkg +++ b/docker/Dockerfile.prod.pkg @@ -1,4 +1,4 @@ -ARG ERPLIBRE_IMAGE_NAME=1.5.0 +ARG ERPLIBRE_IMAGE_NAME=1.6.0 FROM technolibre/erplibre-base:${ERPLIBRE_IMAGE_NAME} diff --git a/docker/docker-compose_odoo_12.0.yml b/docker/docker-compose_odoo_12.0.yml new file mode 100644 index 0000000..dcdaccb --- /dev/null +++ b/docker/docker-compose_odoo_12.0.yml @@ -0,0 +1,50 @@ +version: "3.3" +services: + ERPLibre: + image: technolibre/erplibre:1.5.0_1f40c56 + ports: + - 8069:8069 + - 8071:8071 + - 8072:8072 + environment: + HOST: db + PASSWORD: mysecretpassword + USER: odoo + POSTGRES_DB: postgres + STOP_BEFORE_INIT: "False" + DB_NAME: "" + UPDATE_ALL_DB: "False" + depends_on: + - db + # not behind a proxy + #command: odoo --workers 0 + # behind a proxy + #command: odoo --workers 2 --proxy-mode + # For production ready + #command: odoo --workers 2 --proxy-mode --no-database-list + command: odoo + volumes: + # See the volume section at the end of the file + - erplibre_data_dir:/home/odoo/.local/share/Odoo + - ./addons/addons:/ERPLibre/addons/addons + - erplibre_conf:/etc/odoo + restart: always + + db: + image: postgis/postgis:12-3.1-alpine + environment: + POSTGRES_PASSWORD: mysecretpassword + POSTGRES_USER: odoo + POSTGRES_DB: postgres + PGDATA: /var/lib/postgresql/data/pgdata + volumes: + - erplibre-db-data:/var/lib/postgresql/data/pgdata + restart: always + +# We configure volume without specific destination to let docker manage it. To configure it through docker use (read related documentation before continuing) : +# - docker volume --help +# - docker-compose down --help +volumes: + erplibre_data_dir: + erplibre_conf: + erplibre-db-data: diff --git a/docker/docker-compose_odoo_14.0.yml b/docker/docker-compose_odoo_14.0.yml new file mode 100644 index 0000000..aba13eb --- /dev/null +++ b/docker/docker-compose_odoo_14.0.yml @@ -0,0 +1,50 @@ +version: "3.3" +services: + ERPLibre: + image: technolibre/erplibre:1.5.0_odoo_14.0_29e1957 + ports: + - 8069:8069 + - 8071:8071 + - 8072:8072 + environment: + HOST: db + PASSWORD: mysecretpassword + USER: odoo + POSTGRES_DB: postgres + STOP_BEFORE_INIT: "False" + DB_NAME: "" + UPDATE_ALL_DB: "False" + depends_on: + - db + # not behind a proxy + #command: odoo --workers 0 + # behind a proxy + #command: odoo --workers 2 --proxy-mode + # For production ready + #command: odoo --workers 2 --proxy-mode --no-database-list + command: odoo + volumes: + # See the volume section at the end of the file + - erplibre_data_dir:/home/odoo/.local/share/Odoo + - ./addons/addons:/ERPLibre/addons/addons + - erplibre_conf:/etc/odoo + restart: always + + db: + image: postgis/postgis:12-3.1-alpine + environment: + POSTGRES_PASSWORD: mysecretpassword + POSTGRES_USER: odoo + POSTGRES_DB: postgres + PGDATA: /var/lib/postgresql/data/pgdata + volumes: + - erplibre-db-data:/var/lib/postgresql/data/pgdata + restart: always + +# We configure volume without specific destination to let docker manage it. To configure it through docker use (read related documentation before continuing) : +# - docker volume --help +# - docker-compose down --help +volumes: + erplibre_data_dir: + erplibre_conf: + erplibre-db-data: diff --git a/docker/docker-compose_odoo_16.0.yml b/docker/docker-compose_odoo_16.0.yml new file mode 100644 index 0000000..adf1c55 --- /dev/null +++ b/docker/docker-compose_odoo_16.0.yml @@ -0,0 +1,50 @@ +version: "3.3" +services: + ERPLibre: + image: technolibre/erplibre:1.5.0_odoo_16.0_91a7d1b + ports: + - 8069:8069 + - 8071:8071 + - 8072:8072 + environment: + HOST: db + PASSWORD: mysecretpassword + USER: odoo + POSTGRES_DB: postgres + STOP_BEFORE_INIT: "False" + DB_NAME: "" + UPDATE_ALL_DB: "False" + depends_on: + - db + # not behind a proxy + #command: odoo --workers 0 + # behind a proxy + #command: odoo --workers 2 --proxy-mode + # For production ready + #command: odoo --workers 2 --proxy-mode --no-database-list + command: odoo + volumes: + # See the volume section at the end of the file + - erplibre_data_dir:/home/odoo/.local/share/Odoo + - ./addons/addons:/ERPLibre/addons/addons + - erplibre_conf:/etc/odoo + restart: always + + db: + image: postgis/postgis:12-3.1-alpine + environment: + POSTGRES_PASSWORD: mysecretpassword + POSTGRES_USER: odoo + POSTGRES_DB: postgres + PGDATA: /var/lib/postgresql/data/pgdata + volumes: + - erplibre-db-data:/var/lib/postgresql/data/pgdata + restart: always + +# We configure volume without specific destination to let docker manage it. To configure it through docker use (read related documentation before continuing) : +# - docker volume --help +# - docker-compose down --help +volumes: + erplibre_data_dir: + erplibre_conf: + erplibre-db-data: diff --git a/env_var.sh b/env_var.sh index c5d6e17..2fc09a5 100755 --- a/env_var.sh +++ b/env_var.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -ERPLIBRE_VERSION="1.5.0" +ERPLIBRE_VERSION="1.6.0" EL_USER="erplibre" EL_HOME="/${EL_USER}" diff --git a/manifest/default.dev.odoo12.0.xml b/manifest/default.dev.odoo12.0.xml index d77a982..1fdcb2b 100644 --- a/manifest/default.dev.odoo12.0.xml +++ b/manifest/default.dev.odoo12.0.xml @@ -101,8 +101,8 @@ - - + + diff --git a/package-lock.json b/package-lock.json index c3e6e97..4a90e28 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "erplibre", - "version": "1.5.0", + "version": "1.6.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "erplibre", - "version": "1.5.0", + "version": "1.6.0", "license": "AGPLv3", "devDependencies": { "@prettier/plugin-xml": "==2.2.0", diff --git a/package.json b/package.json index fef8ce6..bcd57ec 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "erplibre", "description": "Easy installation of Odoo", - "version": "1.5.0", + "version": "1.6.0", "license": "AGPLv3", "homepage": "https://erplibre.ca", "devDependencies": { diff --git a/requirement/poetry.odoo16.0_python3.10.14.lock b/requirement/poetry.odoo16.0_python3.10.14.lock index b7b225c..d537aeb 100644 --- a/requirement/poetry.odoo16.0_python3.10.14.lock +++ b/requirement/poetry.odoo16.0_python3.10.14.lock @@ -139,6 +139,17 @@ files = [ [package.dependencies] aiohttp = "*" +[[package]] +name = "aioshutil" +version = "1.5" +description = "Asynchronous shutil module." +optional = false +python-versions = ">=3.8" +files = [ + {file = "aioshutil-1.5-py3-none-any.whl", hash = "sha256:bc2a6cdcf1a8615b62f856154fd81131031d03f2834912ebb06d8a2391253652"}, + {file = "aioshutil-1.5.tar.gz", hash = "sha256:2756d6cd3bb03405dc7348ac11a0b60eb949ebd63cdd15f56e922410231c1201"}, +] + [[package]] name = "aiosignal" version = "1.3.2" @@ -8475,4 +8486,4 @@ bindings = ["ghostscript"] [metadata] lock-version = "2.0" python-versions = "^3.10.14" -content-hash = "49785f9e198e6124847a9b304493e184d6155f5261a53211d28cbb6679dd7a3e" +content-hash = "350819d1b0358148243e33c0d3a0731e258153a097d85e45725435d0ee03f38b" diff --git a/requirement/pyproject.odoo12.0_python3.7.17.toml b/requirement/pyproject.odoo12.0_python3.7.17.toml index 4ded27d..3715ddf 100644 --- a/requirement/pyproject.odoo12.0_python3.7.17.toml +++ b/requirement/pyproject.odoo12.0_python3.7.17.toml @@ -12,7 +12,7 @@ target-version = [ "py37",] [tool.poetry] name = "ERPLibre" -version = "1.5.0" +version = "1.6.0" description = "Easy way to configure Odoo community" license = "AGPL-3.0-or-later" authors = [ "Mathieu Benoit ",] diff --git a/requirement/pyproject.odoo14.0_python3.8.10.toml b/requirement/pyproject.odoo14.0_python3.8.10.toml index eb96f65..b759506 100644 --- a/requirement/pyproject.odoo14.0_python3.8.10.toml +++ b/requirement/pyproject.odoo14.0_python3.8.10.toml @@ -12,7 +12,7 @@ target-version = [ "py37",] [tool.poetry] name = "ERPLibre" -version = "1.5.0" +version = "1.6.0" description = "Easy way to configure Odoo community" license = "AGPL-3.0-or-later" authors = [ "Mathieu Benoit ",] diff --git a/requirement/pyproject.odoo14.0_python3.8.20.toml b/requirement/pyproject.odoo14.0_python3.8.20.toml index 14862a8..d4525ac 100644 --- a/requirement/pyproject.odoo14.0_python3.8.20.toml +++ b/requirement/pyproject.odoo14.0_python3.8.20.toml @@ -12,7 +12,7 @@ target-version = [ "py37",] [tool.poetry] name = "ERPLibre" -version = "1.5.0" +version = "1.6.0" description = "Easy way to configure Odoo community" license = "AGPL-3.0-or-later" authors = [ "Mathieu Benoit ",] diff --git a/requirement/pyproject.odoo16.0_python3.10.14.toml b/requirement/pyproject.odoo16.0_python3.10.14.toml index 2b0bb43..e513b8c 100644 --- a/requirement/pyproject.odoo16.0_python3.10.14.toml +++ b/requirement/pyproject.odoo16.0_python3.10.14.toml @@ -12,7 +12,7 @@ target-version = [ "py37",] [tool.poetry] name = "ERPLibre" -version = "1.5.0" +version = "1.6.0" description = "Easy way to configure Odoo community" license = "AGPL-3.0-or-later" authors = [ "Mathieu Benoit ",] @@ -20,6 +20,7 @@ authors = [ "Mathieu Benoit ",] [tool.poetry.dependencies] python = "^3.10.14" agithub = "^2.2.2" +aioshutil = "^1.5" argcomplete = "^3.6.2" asana = "^5.1.0" asn1crypto = "^1.5.1" diff --git a/requirement/requirements.odoo16.0_python3.10.14.txt b/requirement/requirements.odoo16.0_python3.10.14.txt index 7625779..01e0897 100644 --- a/requirement/requirements.odoo16.0_python3.10.14.txt +++ b/requirement/requirements.odoo16.0_python3.10.14.txt @@ -20,6 +20,7 @@ python-randomword-fr isort pykeepass click +aioshutil # For OSX cython diff --git a/script/code_generator/check_git_change_code_generator.sh b/script/code_generator/check_git_change_code_generator.sh index 453c81c..8f64c22 100755 --- a/script/code_generator/check_git_change_code_generator.sh +++ b/script/code_generator/check_git_change_code_generator.sh @@ -73,6 +73,8 @@ On_IPurple='\033[0;105m' # Purple On_ICyan='\033[0;106m' # Cyan On_IWhite='\033[0;107m' # White +ODOO_VERSION=$(cat .odoo-version) + check_git() { REP=$1 cd "${REP}" || exit @@ -110,5 +112,5 @@ if [ $# -gt 0 ]; then fi else # check_git "./addons/TechnoLibre_odoo-code-generator" - check_git "./addons/TechnoLibre_odoo-code-generator-template" + check_git "./addons.odoo${ODOO_VERSION}/TechnoLibre_odoo-code-generator-template" fi diff --git a/script/code_generator/install_and_test_code_generator.sh b/script/code_generator/install_and_test_code_generator.sh index 4d71798..a59820e 100755 --- a/script/code_generator/install_and_test_code_generator.sh +++ b/script/code_generator/install_and_test_code_generator.sh @@ -15,6 +15,7 @@ fi INIT_DATETIME=$(date +%s) if [[ $# -eq 5 ]]; then + echo ./script/addons/install_addons_dev.sh "$1" "$2" "$5" ./script/addons/install_addons_dev.sh "$1" "$2" "$5" retVal=$? if [[ $retVal -ne 0 ]]; then @@ -22,6 +23,7 @@ if [[ $# -eq 5 ]]; then exit 1 fi else + echo ./script/addons/install_addons_dev.sh "$1" "$2" ./script/addons/install_addons_dev.sh "$1" "$2" retVal=$? if [[ $retVal -ne 0 ]]; then @@ -31,6 +33,7 @@ else fi # Check if the code was updated +echo ./script/code_generator/test_code_generator_update_module.py -m "$4" -d "$3" --datetime "${INIT_DATETIME}" ./script/code_generator/test_code_generator_update_module.py -m "$4" -d "$3" --datetime "${INIT_DATETIME}" retVal=$? if [[ $retVal -ne 0 ]]; then @@ -39,6 +42,7 @@ if [[ $retVal -ne 0 ]]; then fi # TODO check output when got warning +echo ./script/git/repo_revert_git_diff_date_from_code_generator.py --repo "$3" ./script/git/repo_revert_git_diff_date_from_code_generator.py --repo "$3" # Remove pot and po diff cd "$3" || exit 1 @@ -63,6 +67,7 @@ for element in "${elements[@]}"; do done echo "TEST ${2}" +echo ./script/code_generator/check_git_change_code_generator.sh "$3" ./script/code_generator/check_git_change_code_generator.sh "$3" retVal=$? if [[ $retVal -ne 0 ]]; then diff --git a/script/code_generator/new_project.py b/script/code_generator/new_project.py index d2ce269..860e53e 100755 --- a/script/code_generator/new_project.py +++ b/script/code_generator/new_project.py @@ -4,21 +4,17 @@ import argparse import configparser +import json import logging import os import sys import tempfile import uuid -import json from git import Repo from git.exc import InvalidGitRepositoryError, NoSuchPathError -CODE_GENERATOR_DIRECTORY = "./addons/TechnoLibre_odoo-code-generator-template/" -CODE_GENERATOR_DEMO_NAME = "code_generator_demo" -KEY_REPLACE_CODE_GENERATOR_DEMO = 'MODULE_NAME = "%s"' - logging.basicConfig( format=( "%(asctime)s,%(msecs)d %(levelname)-8s [%(filename)s:%(lineno)d]" @@ -29,6 +25,19 @@ logging.basicConfig( ) _logger = logging.getLogger(__name__) +filename_odoo_version = ".odoo-version" +if not os.path.isfile(filename_odoo_version): + _logger.error(f"Missing file {filename_odoo_version}") + sys.exit(1) +with open(".odoo-version", "r") as f: + odoo_version = f.readline() + +CODE_GENERATOR_DIRECTORY = ( + f"./addons.odoo{odoo_version}/TechnoLibre_odoo-code-generator-template/" +) +CODE_GENERATOR_DEMO_NAME = "code_generator_demo" +KEY_REPLACE_CODE_GENERATOR_DEMO = 'MODULE_NAME = "%s"' + class Struct: def __init__(self, **entries): @@ -133,6 +142,11 @@ class ProjectManagement: self.has_config_update = False self.odoo_config = odoo_config + # Replace addons/ by addons.odoo12.0/ + module_directory = module_directory.replace( + "addons/", f"addons.odoo{odoo_version}/" + ) + self.module_directory = module_directory if not os.path.exists(self.module_directory): self.msg_error = ( @@ -569,7 +583,7 @@ class ProjectManagement: has_change = True if has_change: config.set("options", "addons_path", ",".join(lst_addons_path)) - temp_file = tempfile.mktemp() + fd_i, temp_file = tempfile.mkstemp() with open(temp_file, "w") as configfile: config.write(configfile) _logger.info(f"Create temporary config file: {temp_file}") diff --git a/script/code_generator/search_class_model.py b/script/code_generator/search_class_model.py index ce334ea..33fade2 100755 --- a/script/code_generator/search_class_model.py +++ b/script/code_generator/search_class_model.py @@ -3,15 +3,15 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) import argparse - -import astor -import json import ast +import json import logging import os import sys from pathlib import Path +import astor + logging.basicConfig(level=logging.DEBUG) _logger = logging.getLogger(__name__) diff --git a/script/code_generator/test_code_generator_update_module.py b/script/code_generator/test_code_generator_update_module.py index 02c9be3..62cbf4c 100755 --- a/script/code_generator/test_code_generator_update_module.py +++ b/script/code_generator/test_code_generator_update_module.py @@ -6,6 +6,7 @@ import argparse import logging import os import sys + from colorama import Fore, Style logging.basicConfig(level=logging.DEBUG) diff --git a/script/code_generator/transform_python_to_code_writer.py b/script/code_generator/transform_python_to_code_writer.py index 065f884..e1a16f3 100755 --- a/script/code_generator/transform_python_to_code_writer.py +++ b/script/code_generator/transform_python_to_code_writer.py @@ -3,9 +3,9 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) import argparse -import uuid import subprocess import sys +import uuid from code_writer import CodeWriter diff --git a/script/code_generator/transform_xml_to_code_writer.py b/script/code_generator/transform_xml_to_code_writer.py index c88f16b..b9689d4 100644 --- a/script/code_generator/transform_xml_to_code_writer.py +++ b/script/code_generator/transform_xml_to_code_writer.py @@ -7,9 +7,9 @@ import logging import os import sys from xml.dom import Node, minidom -from colorama import Fore, Style from code_writer import CodeWriter +from colorama import Fore, Style from script.git.git_tool import GitTool diff --git a/script/database/db_restore.py b/script/database/db_restore.py index cb35045..503670c 100755 --- a/script/database/db_restore.py +++ b/script/database/db_restore.py @@ -41,8 +41,8 @@ SUGGESTION "--image", help=( "Image name to restore, from directory image_db, filename without" - " '.zip'. Example, use erplibre_base to use image" - " erplibre_base.zip. Default value is erplibre_base" + " '.zip'. Example, use odoo12.0_base to use image" + " odoo12.0_base.zip. Default value is odoo12.0_base" ), ) parser.add_argument( diff --git a/script/database/image_db.py b/script/database/image_db.py index 2a9f9ae..21c7800 100755 --- a/script/database/image_db.py +++ b/script/database/image_db.py @@ -3,14 +3,14 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) import argparse +import json import logging import os -from collections import defaultdict -import uuid -import time -import json -import sys import subprocess +import sys +import time +import uuid +from collections import defaultdict logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO")) @@ -34,7 +34,7 @@ DESCRIPTION Create image for database restoration to increase speed. Check file SUGGESTION - ./script/database/image_db.py --image erplibre_base --odoo_version 16.0 + ./script/database/image_db.py --image odoo16.0_base --odoo_version 16.0 """, epilog="""\ """, @@ -43,8 +43,8 @@ SUGGESTION "--image", help=( "Image name to restore, from directory image_db, filename without" - " '.zip'. Example, use erplibre_base to use image" - " erplibre_base.zip. Default value is erplibre_base" + " '.zip'. Example, use odoo12.0_base to use image" + " odoo12.0_base.zip. Default value is odoo12.0_base" ), ) parser.add_argument( diff --git a/script/fork_github_repo/__init__.py b/script/fork_github_repo/__init__.py index d581db9..1030787 100644 --- a/script/fork_github_repo/__init__.py +++ b/script/fork_github_repo/__init__.py @@ -3,10 +3,10 @@ from __future__ import print_function import argparse import os.path import shutil -from colorama import Fore, Style import yaml # pip install PyYAML from agithub.GitHub import GitHub # pip install agithub +from colorama import Fore, Style from git import Repo # pip install gitpython from giturlparse import parse # pip install giturlparse from retrying import retry # pip install retrying diff --git a/script/git/git_diff_repo_manifest.py b/script/git/git_diff_repo_manifest.py index e0cb3ec..af86aec 100755 --- a/script/git/git_diff_repo_manifest.py +++ b/script/git/git_diff_repo_manifest.py @@ -6,8 +6,8 @@ import argparse import logging import os import sys -from colorama import Fore, Style +from colorama import Fore, Style from git import Repo new_path = os.path.normpath( diff --git a/script/git/git_tool.py b/script/git/git_tool.py index ffd0c8d..eec304e 100644 --- a/script/git/git_tool.py +++ b/script/git/git_tool.py @@ -6,11 +6,11 @@ import os import webbrowser from collections import OrderedDict from typing import List -from colorama import Fore, Style import git import xmltodict from agithub.GitHub import GitHub # pip install agithub +from colorama import Fore, Style from git import Repo from giturlparse import parse # pip install giturlparse from retrying import retry # pip install retrying diff --git a/script/git/repo_revert_git_diff_date_from_code_generator.py b/script/git/repo_revert_git_diff_date_from_code_generator.py index 5071cc8..bf49529 100755 --- a/script/git/repo_revert_git_diff_date_from_code_generator.py +++ b/script/git/repo_revert_git_diff_date_from_code_generator.py @@ -22,6 +22,14 @@ logging.basicConfig( ) _logger = logging.getLogger(__name__) +FILENAME_ODOO_VERSION = ".odoo-version" +if not os.path.isfile(FILENAME_ODOO_VERSION): + _logger.error(f"Missing file {FILENAME_ODOO_VERSION}") + sys.exit(1) + +with open(".odoo-version", "r") as f: + ODOO_VERSION = f.readline() + def get_config(): """Parse command line arguments, extracting the config file name, @@ -39,7 +47,7 @@ def get_config(): ) parser.add_argument( "--repo", - default="./addons/TechnoLibre_odoo-code-generator-template;./addons/OCA_server-tools", + default=f"./addons.odoo{ODOO_VERSION}/TechnoLibre_odoo-code-generator-template;./addons.odoo{ODOO_VERSION}/OCA_server-tools", ) args = parser.parse_args() return args diff --git a/script/ide/pycharm_configuration.py b/script/ide/pycharm_configuration.py index df0938f..e1f8fea 100755 --- a/script/ide/pycharm_configuration.py +++ b/script/ide/pycharm_configuration.py @@ -4,11 +4,11 @@ import argparse import csv +import glob import logging import os import subprocess import sys -import glob import xmltodict diff --git a/script/nginx/template_nginx b/script/nginx/template_nginx_odoo_12.0.txt similarity index 70% rename from script/nginx/template_nginx rename to script/nginx/template_nginx_odoo_12.0.txt index 9f2fef9..df35507 100644 --- a/script/nginx/template_nginx +++ b/script/nginx/template_nginx_odoo_12.0.txt @@ -1,15 +1,15 @@ -# TODO replace test1 by your hostname and fix server_name and run certbot -upstream erplibretest1 { - server 127.0.0.1:10000; +# TODO replace CHANGEME by your hostname and fix server_name and run certbot +upstream erplibreCHANGEME { + server 127.0.0.1:8069; } -upstream erplibretest1chat { - server 127.0.0.1:10002; +upstream erplibreCHANGEMEchat { + server 127.0.0.1:8072; } server { listen 80; - server_name test1.ca; + server_name CHANGEME.ca; # Add Headers for erplibre proxy mode proxy_set_header X-Forwarded-Host $host; @@ -20,8 +20,8 @@ server { add_header X-XSS-Protection "1; mode=block"; # erplibre request log files - access_log /var/log/nginx/test1-access.log; - error_log /var/log/nginx/test1-error.log; + access_log /var/log/nginx/CHANGEME-access.log; + error_log /var/log/nginx/CHANGEME-error.log; # Increase proxy buffer size proxy_buffers 16 64k; @@ -51,21 +51,21 @@ server { client_max_body_size 1024M; location / { - proxy_pass http://erplibretest1; + proxy_pass http://erplibreCHANGEME; # by default, do not forward anything proxy_redirect off; } location /longpolling { - proxy_pass http://erplibretest1chat; + proxy_pass http://erplibreCHANGEMEchat; } # cache some static data in memory for 60mins. location ~ /[a-zA-Z0-9_-]*/static/ { - proxy_cache_valid 200 302 60m; - proxy_cache_valid 404 1m; - proxy_buffering on; - expires 864000; - proxy_pass http://erplibretest1; + proxy_cache_valid 200 302 60m; + proxy_cache_valid 404 1m; + proxy_buffering on; + expires 864000; + proxy_pass http://erplibreCHANGEME; } } diff --git a/script/nginx/template_nginx_odoo_14.0.txt b/script/nginx/template_nginx_odoo_14.0.txt new file mode 100644 index 0000000..a523a76 --- /dev/null +++ b/script/nginx/template_nginx_odoo_14.0.txt @@ -0,0 +1,93 @@ +# TODO replace CHANGEME by your hostname and fix server_name and run certbot +upstream erplibreCHANGEME { + server 127.0.0.1:8069; +} +upstream erplibreCHANGEMEchat { + server 127.0.0.1:8072; +} + +server { + listen 80; + + server_name CHANGEME.ca; + + # Add Headers for erplibre proxy mode + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Real-IP $remote_addr; + add_header X-Frame-Options "SAMEORIGIN"; + add_header X-XSS-Protection "1; mode=block"; + + # erplibre request log files + access_log /var/log/nginx/CHANGEME-access.log; + error_log /var/log/nginx/CHANGEME-error.log; + + # Increase proxy buffer size + proxy_buffers 16 64k; + proxy_buffer_size 128k; + + proxy_read_timeout 720s; + proxy_connect_timeout 720s; + proxy_send_timeout 720s; + + # Force timeouts if the backend dies + proxy_next_upstream error timeout invalid_header http_500 http_502 + http_503; + + types { + text/less less; + text/scss scss; + } + + # Enable data compression + gzip on; + gzip_min_length 1100; + gzip_buffers 4 32k; + gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript application/pdf image/jpeg image/png; + gzip_vary on; + client_header_buffer_size 4k; + large_client_header_buffers 4 64k; + client_max_body_size 1024M; + + location / { + proxy_pass http://erplibreCHANGEME; + # by default, do not forward anything + proxy_redirect off; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_read_timeout 720s; + proxy_connect_timeout 720s; + proxy_send_timeout 720s; + # Add Headers for odoo proxy mode + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Real-IP $remote_addr; + } + + location /websocket { + proxy_pass http://erplibreCHANGEMEchat; + proxy_read_timeout 720s; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_connect_timeout 720s; + proxy_send_timeout 720s; + # Add Headers for odoo proxy mode + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Real-IP $remote_addr; + } + + # cache some static data in memory for 60mins. + location ~ /[a-zA-Z0-9_-]*/static/ { + proxy_cache_valid 200 302 60m; + proxy_cache_valid 404 1m; + proxy_buffering on; + expires 864000; + proxy_pass http://erplibreCHANGEME; + } +} diff --git a/script/nginx/template_nginx_odoo_16.0.txt b/script/nginx/template_nginx_odoo_16.0.txt new file mode 100644 index 0000000..a523a76 --- /dev/null +++ b/script/nginx/template_nginx_odoo_16.0.txt @@ -0,0 +1,93 @@ +# TODO replace CHANGEME by your hostname and fix server_name and run certbot +upstream erplibreCHANGEME { + server 127.0.0.1:8069; +} +upstream erplibreCHANGEMEchat { + server 127.0.0.1:8072; +} + +server { + listen 80; + + server_name CHANGEME.ca; + + # Add Headers for erplibre proxy mode + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Real-IP $remote_addr; + add_header X-Frame-Options "SAMEORIGIN"; + add_header X-XSS-Protection "1; mode=block"; + + # erplibre request log files + access_log /var/log/nginx/CHANGEME-access.log; + error_log /var/log/nginx/CHANGEME-error.log; + + # Increase proxy buffer size + proxy_buffers 16 64k; + proxy_buffer_size 128k; + + proxy_read_timeout 720s; + proxy_connect_timeout 720s; + proxy_send_timeout 720s; + + # Force timeouts if the backend dies + proxy_next_upstream error timeout invalid_header http_500 http_502 + http_503; + + types { + text/less less; + text/scss scss; + } + + # Enable data compression + gzip on; + gzip_min_length 1100; + gzip_buffers 4 32k; + gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript application/pdf image/jpeg image/png; + gzip_vary on; + client_header_buffer_size 4k; + large_client_header_buffers 4 64k; + client_max_body_size 1024M; + + location / { + proxy_pass http://erplibreCHANGEME; + # by default, do not forward anything + proxy_redirect off; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_read_timeout 720s; + proxy_connect_timeout 720s; + proxy_send_timeout 720s; + # Add Headers for odoo proxy mode + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Real-IP $remote_addr; + } + + location /websocket { + proxy_pass http://erplibreCHANGEMEchat; + proxy_read_timeout 720s; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_connect_timeout 720s; + proxy_send_timeout 720s; + # Add Headers for odoo proxy mode + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Real-IP $remote_addr; + } + + # cache some static data in memory for 60mins. + location ~ /[a-zA-Z0-9_-]*/static/ { + proxy_cache_valid 200 302 60m; + proxy_cache_valid 404 1m; + proxy_buffering on; + expires 864000; + proxy_pass http://erplibreCHANGEME; + } +} diff --git a/script/open_terminal_code_generator.sh b/script/open_terminal_code_generator.sh index 471e697..195fac8 100755 --- a/script/open_terminal_code_generator.sh +++ b/script/open_terminal_code_generator.sh @@ -1,13 +1,14 @@ #!/usr/bin/env bash # Open a new gnome-terminal with different path on new tab +ODOO_VERSION=$(cat .odoo-version) working_path=$(readlink -f .) paths=( "${working_path}/" "${working_path}/" - "${working_path}/addons/ERPLibre_erplibre_addons" - "${working_path}/addons/TechnoLibre_odoo-code-generator" - "${working_path}/addons/TechnoLibre_odoo-code-generator-template" -# "${working_path}/addons/OCA_server-tools" + "${working_path}/addons.odoo${ODOO_VERSION}/ERPLibre_erplibre_addons" + "${working_path}/addons.odoo${ODOO_VERSION}/TechnoLibre_odoo-code-generator" + "${working_path}/addons.odoo${ODOO_VERSION}/TechnoLibre_odoo-code-generator-template" +# "${working_path}/addons.odoo${ODOO_VERSION}/OCA_server-tools" ) diff --git a/script/poetry/poetry_update.py b/script/poetry/poetry_update.py index 8a66c18..6f14806 100755 --- a/script/poetry/poetry_update.py +++ b/script/poetry/poetry_update.py @@ -8,10 +8,10 @@ import logging import os from collections import OrderedDict, defaultdict from pathlib import Path -from colorama import Fore, Style import iscompatible import toml +from colorama import Fore, Style _logger = logging.getLogger(__name__) diff --git a/script/statistic/show_evolution_module.py b/script/statistic/show_evolution_module.py index 3bc09f5..50897fd 100755 --- a/script/statistic/show_evolution_module.py +++ b/script/statistic/show_evolution_module.py @@ -3,12 +3,12 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) import argparse +import csv import datetime import logging import os import shutil import sys -import csv from collections import defaultdict from dateutil.relativedelta import relativedelta diff --git a/script/test/config_testcase.json b/script/test/config_testcase.odoo12.0.json similarity index 75% rename from script/test/config_testcase.json rename to script/test/config_testcase.odoo12.0.json index ece5c87..252a775 100644 --- a/script/test/config_testcase.json +++ b/script/test/config_testcase.odoo12.0.json @@ -10,28 +10,29 @@ { "run_test_exec": true, "test_name": "code_generator_theme_test", - "path_module_check": "./addons/TechnoLibre_odoo-code-generator-template", + "path_module_check": "./addons.odoo12.0/TechnoLibre_odoo-code-generator-template", "generated_module": "theme_website_demo_code_generator", "tested_module": "code_generator_demo_theme_website" }, { "run_test_exec": true, + "disable": true, "test_name": "code_generator_demo_test", - "path_module_check": "./addons/TechnoLibre_odoo-code-generator-template", + "path_module_check": "./addons.odoo12.0/TechnoLibre_odoo-code-generator-template", "generated_module": "code_generator_demo", "tested_module": "code_generator_demo" }, { "run_test_exec": true, "test_name": "code_generator_data_test", - "path_module_check": "./addons/TechnoLibre_odoo-code-generator-template", + "path_module_check": "./addons.odoo12.0/TechnoLibre_odoo-code-generator-template", "generated_module": "demo_helpdesk_data", "tested_module": "code_generator_demo_export_helpdesk" }, { "run_test_exec": true, "test_name": "code_generator_data_part_2_test", - "path_module_check": "./addons/TechnoLibre_odoo-code-generator-template", + "path_module_check": "./addons.odoo12.0/TechnoLibre_odoo-code-generator-template", "generated_module": "demo_website_data", "tested_module": "code_generator_demo_export_website", "note": "Merge to code_generator_data_test when fix double export data." @@ -39,14 +40,14 @@ { "run_test_exec": true, "test_name": "code_generator_inherit_test", - "path_module_check": "./addons/TechnoLibre_odoo-code-generator-template", + "path_module_check": "./addons.odoo12.0/TechnoLibre_odoo-code-generator-template", "generated_module": "demo_internal_inherit", "tested_module": "code_generator_demo_internal_inherit" }, { "run_test_exec": true, "test_name": "code_generator_template_demo_internal", - "path_module_check": "./addons/TechnoLibre_odoo-code-generator-template", + "path_module_check": "./addons.odoo12.0/TechnoLibre_odoo-code-generator-template", "generated_module": "code_generator_demo_internal", "tested_module": "code_generator_template_demo_internal", "search_class_module": "demo_internal", @@ -55,7 +56,7 @@ { "run_test_exec": true, "test_name": "code_generator_template_demo_portal", - "path_module_check": "./addons/TechnoLibre_odoo-code-generator-template", + "path_module_check": "./addons.odoo12.0/TechnoLibre_odoo-code-generator-template", "generated_module": "code_generator_demo_portal", "tested_module": "code_generator_template_demo_portal", "search_class_module": "demo_portal", @@ -63,8 +64,9 @@ }, { "run_test_exec": true, + "disable": true, "test_name": "mariadb_test_template", - "path_module_check": "./addons/TechnoLibre_odoo-code-generator-template", + "path_module_check": "./addons.odoo12.0/TechnoLibre_odoo-code-generator-template", "generated_module": "code_generator_demo_mariadb_sql_example_1", "tested_module": "code_generator_template_demo_mariadb_sql_example_1", "search_class_module": "demo_mariadb_sql_example_1", @@ -72,8 +74,9 @@ }, { "run_test_exec": true, + "disable": true, "test_name": "mariadb_test_migrator", - "path_module_check": "./addons/TechnoLibre_odoo-code-generator-template", + "path_module_check": "./addons.odoo12.0/TechnoLibre_odoo-code-generator-template", "generated_module": "demo_mariadb_sql_example_1", "tested_module": "code_generator_migrator_demo_mariadb_sql_example_1", "script_after_init_check": "./script/database/restore_mariadb_sql_example_1.sh", @@ -81,8 +84,9 @@ }, { "run_test_exec": true, + "disable": true, "test_name": "mariadb_test_code_generator", - "path_module_check": "./addons/TechnoLibre_odoo-code-generator-template", + "path_module_check": "./addons.odoo12.0/TechnoLibre_odoo-code-generator-template", "generated_module": "demo_mariadb_sql_example_1", "tested_module": "code_generator_demo_mariadb_sql_example_1", "init_module_name": "code_generator_portal" @@ -90,7 +94,7 @@ { "run_test_exec": true, "test_name": "code_generator_template_demo_internal_inherit", - "path_module_check": "./addons/TechnoLibre_odoo-code-generator-template", + "path_module_check": "./addons.odoo12.0/TechnoLibre_odoo-code-generator-template", "generated_module": "code_generator_demo_internal_inherit", "tested_module": "code_generator_template_demo_internal_inherit", "search_class_module": "demo_internal_inherit", @@ -98,34 +102,37 @@ }, { "run_test_exec": true, + "disable": true, "test_name": "code_generator_template_demo_sysadmin_cron", - "path_module_check": "./addons/OCA_server-tools/auto_backup", + "path_module_check": "./addons.odoo12.0/OCA_server-tools", "generated_module": "code_generator_auto_backup", - "generated_path": "./addons/OCA_server-tools/", + "generated_path": "./addons.odoo12.0/OCA_server-tools/", "tested_module": "code_generator_template_demo_sysadmin_cron", "search_class_module": "auto_backup", "init_module_name": "auto_backup", - "install_path": "./addons/TechnoLibre_odoo-code-generator-template" + "install_path": "./addons.odoo12.0/TechnoLibre_odoo-code-generator-template" }, { "run_test_exec": true, + "disable": true, "test_name": "code_generator_export_website_attachments_test", - "path_module_check": "./addons/TechnoLibre_odoo-code-generator-template", + "path_module_check": "./addons.odoo12.0/TechnoLibre_odoo-code-generator-template", "generated_module": "demo_website_attachments_data", "tested_module": "code_generator_demo_export_website_attachments", "restore_db_image_name": "test_website_attachments" }, { "run_test_exec": true, + "disable": true, "test_name": "code_generator_demo_generic_test", - "path_module_check": "./addons/TechnoLibre_odoo-code-generator-template", + "path_module_check": "./addons.odoo12.0/TechnoLibre_odoo-code-generator-template", "generated_module": "demo_internal,demo_portal", "tested_module": "code_generator_demo_internal,code_generator_demo_portal" }, { "run_test_exec": true, "test_name": "code_generator_website_snippet_test", - "path_module_check": "./addons/TechnoLibre_odoo-code-generator-template", + "path_module_check": "./addons.odoo12.0/TechnoLibre_odoo-code-generator-template", "generated_module": "demo_website_leaflet,demo_website_snippet,demo_website_multiple_snippet", "tested_module": "code_generator_demo_website_leaflet,code_generator_demo_website_snippet,code_generator_demo_website_multiple_snippet", "file_to_restore": "demo_portal/i18n/demo_portal.pot,demo_portal/i18n/fr_CA.po", @@ -135,13 +142,13 @@ { "run_test_exec": true, "test_name": "demo_test", - "path_module_check": "./addons/TechnoLibre_odoo-code-generator-template", + "path_module_check": "./addons.odoo12.0/TechnoLibre_odoo-code-generator-template", "init_module_name": "demo_helpdesk_data,demo_internal,demo_internal_inherit,demo_mariadb_sql_example_1,demo_portal,demo_website_data,demo_website_leaflet,demo_website_snippet" }, { "run_test_exec": true, "test_name": "code_generator_auto_backup_test", - "path_module_check": "./addons/OCA_server-tools/auto_backup", + "path_module_check": "./addons.odoo12.0/OCA_server-tools/auto_backup", "generated_module": "auto_backup", "tested_module": "code_generator_auto_backup" } diff --git a/script/test/run_parallel_test.py b/script/test/run_parallel_test.py index 5b0d89c..bafb579 100755 --- a/script/test/run_parallel_test.py +++ b/script/test/run_parallel_test.py @@ -6,15 +6,15 @@ import argparse import asyncio import configparser import datetime +import json import logging import os import sys import tempfile import time import uuid -import json -from typing import Tuple from collections import defaultdict +from typing import Tuple import aioshutil import git @@ -30,8 +30,16 @@ from script import lib_asyncio logging.basicConfig(level=logging.DEBUG) _logger = logging.getLogger(__name__) +FILENAME_ODOO_VERSION = ".odoo-version" +if not os.path.isfile(FILENAME_ODOO_VERSION): + _logger.error(f"Missing file {FILENAME_ODOO_VERSION}") + sys.exit(1) + +with open(".odoo-version", "r") as f: + ODOO_VERSION = f.readline() + LOG_FILE = "./.venv/make_test.log" -CONFIG_TESTCASE_JSON = "./script/test/config_testcase.json" +CONFIG_TESTCASE_JSON = f"./script/test/config_testcase.odoo{ODOO_VERSION}.json" def get_config(): @@ -136,7 +144,12 @@ def extract_result(result, test_name, lst_error, lst_warning): if not is_ignore_warning: lst_warning.append(log_line) if result[1]: - lst_error.append(f"Return status error for test {test_name}") + if len(result[0].split("\n")) == 1: + lst_error.append( + f"Return status error for test {test_name} : {result[0]}" + ) + else: + lst_error.append(f"Return status error for test {test_name}") def check_result(task_list, tpl_result): @@ -319,7 +332,7 @@ async def test_exec( test_name=None, install_path=None, run_in_sandbox=True, - restore_db_image_name="erplibre_base", + restore_db_image_name="odoo12.0_base", keep_cache=False, coverage=False, ) -> Tuple[str, int, str, float]: @@ -422,7 +435,10 @@ async def test_exec( # Update path to change new emplacement s_lst_path_tested_module = ( await lib_asyncio.run_command_get_output( - "find", "./addons/", "-name", module_name + "find", + f"./addons.odoo{ODOO_VERSION}/", + "-name", + module_name, ) ) if not s_lst_path_tested_module: @@ -437,6 +453,7 @@ async def test_exec( s_lst_path_tested_module.strip().split("\n") ) s_first_path = lst_path_tested_module[0] + # parent_dir = os.path.dirname(s_first_path).replace("addons/", f"addons.odoo{ODOO_VERSION}/") parent_dir = os.path.dirname(s_first_path) # Copy it if copy_path != parent_dir: @@ -546,7 +563,7 @@ async def test_exec( else: new_hook_line = ( hook_line[: first_index + len(f_key)] - + f'"{s_first_path}"\n' + + f'"{s_first_path}"' + hook_line[index_end_string:] ) new_hook_line = new_hook_line.replace( @@ -782,7 +799,7 @@ def check_git_change(): task_list = [ run_command( "./script/code_generator/check_git_change_code_generator.sh", - "./addons/TechnoLibre_odoo-code-generator-template", + f"./addons.odoo{ODOO_VERSION}/TechnoLibre_odoo-code-generator-template", test_name=( "Init check_git_change" " TechnoLibre_odoo-code-generator-template" @@ -790,7 +807,7 @@ def check_git_change(): ), run_command( "./script/code_generator/check_git_change_code_generator.sh", - "./addons/OCA_server-tools", + f"./addons.odoo{ODOO_VERSION}/OCA_server-tools", test_name="Init check_git_change OCA_server-tools", ), ] @@ -826,6 +843,12 @@ def run_all_test(config) -> bool: dct_task = defaultdict(list) dct_task_name = defaultdict(list) for dct_test in lst_test: + if dct_test.get("disable"): + continue + # Force change addons path + # if "path_module_check" in dct_test.keys(): + # # dct_test["path_module_check"] = dct_test["path_module_check"].replace("addons/", f"addons.odoo{ODOO_VERSION}/") + # dct_test["path_module_check"] = dct_test["path_module_check"] sequence = dct_test.get("sequence", 0) cb_coroutine = None test_name = None @@ -869,7 +892,7 @@ def run_all_test(config) -> bool: install_path = dct_test.get("install_path") run_in_sandbox = dct_test.get("run_in_sandbox", True) restore_db_image_name = dct_test.get( - "restore_db_image_name", "erplibre_base" + "restore_db_image_name", "odoo12.0_base" ) keep_cache = config.keep_cache coverage = config.coverage diff --git a/script/version/get_version.py b/script/version/get_version.py index 4bd9d6a..e4bd7f0 100755 --- a/script/version/get_version.py +++ b/script/version/get_version.py @@ -3,8 +3,8 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) import argparse -import logging import json +import logging import os import shutil import sys diff --git a/script/version/update_env_version.py b/script/version/update_env_version.py index e821540..4b1ba67 100755 --- a/script/version/update_env_version.py +++ b/script/version/update_env_version.py @@ -469,7 +469,7 @@ class Update: ADDONS_PATH, ADDONS_PATH + "_" - + time.strftime('%Yy%mm%dd-%Hh%Mm%Ss'), + + time.strftime("%Yy%mm%dd-%Hh%Mm%Ss"), ) os.symlink(addons_path_with_version, ADDONS_PATH) return status @@ -701,7 +701,11 @@ def main(): _logger.info("Validate environment") status = 0 - if update.config.install_dev or update.config.partial_install or update.config.is_in_switch: + if ( + update.config.install_dev + or update.config.partial_install + or update.config.is_in_switch + ): status = update.validate_environment() if update.config.install: status = update.install_system()