Skip to content

Commit 8ddc938

Browse files
committed
Merge branch 'dev'
2 parents 7ddfbd3 + 3016b73 commit 8ddc938

File tree

11 files changed

+169
-33
lines changed

11 files changed

+169
-33
lines changed

CHANGELOG.md

+19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# Release Notes
22

3+
## Release 0.15.0
4+
5+
### Added
6+
7+
- Added new options to `fetch` command:
8+
- `--git-single-branch` could be used to clone repos with single branch options
9+
- `--git-depth-1` could be used to clone repos with option `--depth=1`
10+
- Experimental support of Odoo 16.0
11+
12+
13+
### Fixes
14+
15+
- `flake8-colors` not needed anymore, as flake8 support color output byt default.
16+
- Limit version of `pylint-odoo` to less then 8.0 for backward compatibility.
17+
This is done because OCA remove a large part of functionality in 8.0.
18+
See merge request: https://github.com/OCA/pylint-odoo/pull/396
19+
20+
---
21+
322
## Release 0.14.1 (2022-09-09)
423

524
### Fixes

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ The canonical source of odoo-helper-scripts is hosted on [GitLab](https://gitlab
8787
- *13.0*
8888
- *14.0*
8989
- *15.0*
90+
- *16.0* (**experimental**)
9091
- OS support:
9192
- On *Ubuntu* should work nice (auto tested on *Ubuntu 18.04, 20.04*)
9293
- Also should work on *Debian* based systems, but some troubles may happen with installation of system dependencies.

docs/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ If you have any routine operation that you would like to automate with odoo-help
9090
- *13.0*
9191
- *14.0*
9292
- *15.0*
93+
- *16.0* (**experimental**)
9394
- OS support:
9495
- On *Ubuntu* should work nice
9596
- Also should work on *Debian* based systems, but some troubles may happen with installation of system dependencies.

lib/ci.bash

+5
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,11 @@ function ci_do_forwardport {
749749
local migration_dst_prefix="$addon_path/migrations/$dst_branch.";
750750
for migration_src in "$migration_src_prefix"*; do
751751
local migration_name=${migration_src#"$migration_src_prefix"};
752+
if [[ "$migration_name" == "0.0.0" ]]; then
753+
# We do not need to forward port odoo serie specific
754+
# migrations.
755+
continue;
756+
fi
752757

753758
local migration_dst=${migration_dst_prefix}${migration_name};
754759
if [ -d "$migration_src" ] && [ ! -d "${migration_dst}" ]; then

lib/default_config/flake8.cfg

-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ exclude =
1313
statistics = True
1414
show_source = True
1515
count = True
16-
format = ${cyan}%(path)s${reset}:${yellow_bold}%(row)d${reset}:${green_bold}%(col)d${reset}: ${red_bold}%(code)s${reset} %(text)s

lib/fetch.bash

+31-9
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ function fetch_clone_repo_git {
274274
fi
275275

276276
# TODO: Add support for cloning repos with depth=1
277+
if [ -n "$ODOO_HELPER_FETCH_GIT_DEPTH_1" ]; then
278+
git_clone_opt="$git_clone_opt --depth=1";
279+
fi
277280

278281
[ -z "$VERBOSE" ] && git_clone_opt="$git_clone_opt -q "
279282
git_cmd="git $extra_git_opt clone --recurse-submodules $git_clone_opt $repo_url $repo_dest";
@@ -401,22 +404,35 @@ function fetch_module {
401404
$SCRIPT_NAME fetch --requirements <requirements file>
402405
403406
Options:
404-
-r|--repo <repo> - git repository to get module from
405-
--github <user/repo> - allows to specify repository located on github in short format
406-
--oca <repo name> - allows to specify Odoo Comunity Association module in simpler format
407-
--odoo-app <app_name> - [experimental] fetch module from Odoo Apps Market.
407+
-r|--repo <repo> - Git repository to get module from
408+
--github <user/repo> - Allows to specify repository located on github in short format
409+
--oca <repo name> - Allows to specify Odoo Comunity Association module in simpler format
410+
--git-single-branch - Clone git repositories with '--single-branch' options.
411+
This could make clonning faster and use less space.
412+
Suitable for server installations.
413+
--git-depth-1 - Clone git repositories with '--depth=1' option.
414+
This option could signifiantly reduce size of large git
415+
repositories and download speed. But as drawback, it
416+
does not suit well for development, because it could be difficult
417+
to push changes back to repository.
418+
But, it should be helpful in case of using docker to reduce
419+
size of resulting docker image and faster build.
420+
--odoo-app <app_name> - [experimental] Fetch module from Odoo Apps Market.
408421
Works only for free modules.
409-
-m|--module <module> - module name to be fetched from repository
410-
-n|--name <repo name> - repository name. this name is used for directory to clone repository in.
422+
-m|--module <module> - Module name to be fetched from repository
423+
-n|--name <repo name> - Repository name. this name is used for directory to clone repository in.
411424
Usualy not required
412-
-b|--branch <branch> - name fo repository branch to clone
413-
--requirements <file> - path to requirements file to fetch required modules
425+
-b|--branch <branch> - Name fo repository branch to clone
426+
--requirements <file> - Path to requirements file to fetch required modules
414427
NOTE: requirements file must end with newline.
415428
416429
Configuration via environment variables:
417430
- ODOO_HELPER_FETCH_GIT_SINGLE_BRANCH - if set then odoo-helper
418431
will use --single-branch
419-
option to clone repo
432+
option to clone repositories
433+
- ODOO_HELPER_FETCH_GIT_DEPTH_1 - if set, the odoo-helper
434+
will user --depth=1 option
435+
to clone repositories
420436
- ODOO_HELPER_FETCH_PIP_AUTO_REQUIREMENTS - if set, then odoo-helper
421437
will process requirements.auto.txt
422438
file in repositories/modules
@@ -490,6 +506,12 @@ function fetch_module {
490506
REPO_BRANCH=${REPO_BRANCH:-${ODOO_VERSION:-$ODOO_BRANCH}};
491507
shift;
492508
;;
509+
--git-single-branch)
510+
ODOO_HELPER_FETCH_GIT_SINGLE_BRANCH=1;
511+
;;
512+
--git-depth-1)
513+
ODOO_HELPER_FETCH_GIT_DEPTH_1=1;
514+
;;
493515
--odoo-app)
494516
fetch_download_odoo_app "$2";
495517
return;

lib/install.bash

+20-7
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,11 @@ function install_odoo_py_requirements_for_version {
557557
# We have to use recent version of pyopenssl, because default version (19.0.0)
558558
# is not compatible with openssl in recent versions of ubuntu.
559559
echo "pyopenssl>=21.0.0";
560+
elif [[ "$dependency_stripped" =~ cryptography* ]]; then
561+
# Version of cryptography have to be chooses by pyopenssl,
562+
# thus we have to remove version specification for this module.
563+
# Actual for Odoo 16.0
564+
echo "cryptography"
560565
else
561566
# Echo dependency line unchanged to rmp file
562567
echo "$dependency";
@@ -699,6 +704,8 @@ function install_build_python_guess_version {
699704
echo "3.8.13";
700705
elif [ -n "$ODOO_VERSION" ] && [ "$(odoo_get_major_version)" -eq 15 ]; then
701706
echo "3.8.13";
707+
elif [ -n "$ODOO_VERSION" ] && [ "$(odoo_get_major_version)" -eq 16 ]; then
708+
echo "3.8.13";
702709
else
703710
echoe -e "${REDC}ERROR${NC}: Automatic detection of python version for odoo ${ODOO_VERSION} is not supported!";
704711
return 1;
@@ -921,7 +928,6 @@ function install_python_tools {
921928
- pylint-odoo
922929
- coverage
923930
- flake8
924-
- flake8-colors
925931
- websocket-client (required for tests in Odoo 12.0)
926932
- jingtrang
927933
@@ -960,8 +966,8 @@ function install_python_tools {
960966
shift
961967
done
962968
exec_pip "${pip_options[@]}" install "${pip_install_opts[@]}" \
963-
setproctitle watchdog pylint-odoo coverage \
964-
flake8 flake8-colors websocket-client jingtrang;
969+
setproctitle watchdog "pylint-odoo<8.0" coverage \
970+
flake8 websocket-client jingtrang;
965971
}
966972

967973
# Install extra javascript tools
@@ -1247,6 +1253,7 @@ function install_reinstall_venv {
12471253
--build-python-sqlite3 - Apply --enable-loadable-sqlite-extensions
12481254
when building python.
12491255
";
1256+
local odoo_build_py_if_needed;
12501257
while [[ $# -gt 0 ]]
12511258
do
12521259
local key="$1";
@@ -1267,9 +1274,7 @@ function install_reinstall_venv {
12671274
shift;
12681275
;;
12691276
--build-python-if-needed)
1270-
if odoo_ensure_python_version; then
1271-
ODOO_BUILD_PYTHON_VERSION=auto;
1272-
fi
1277+
odoo_build_py_if_needed=1;
12731278
;;
12741279
--build-python-optimize)
12751280
ODOO_BUILD_PYTHON_OPTIMIZE=1;
@@ -1311,11 +1316,19 @@ function install_reinstall_venv {
13111316
echoe -e "${YELLOWC}Removing virualenv...${NC}";
13121317
rm -r "$VENV_DIR";
13131318
if [ -d "$PROJECT_ROOT_DIR/python" ]; then
1314-
rm -r "$PROJECT_ROOT_DIR/python";
1319+
rm -rf "$PROJECT_ROOT_DIR/python";
13151320
fi
13161321
echoe -e "${YELLOWC}Virtualenv removed!${NC}";
13171322
fi
13181323

1324+
# Decide if we need to build python if requested
1325+
# This code is placed here, because before checking python version
1326+
# we have to remove virtual env first to avoid detection of previously
1327+
# installed version.
1328+
if [ -n "$odoo_build_py_if_needed" ] && ! odoo_ensure_python_version; then
1329+
ODOO_BUILD_PYTHON_VERSION=auto;
1330+
fi
1331+
13191332
# Install odoo
13201333
install_odoo_install;
13211334

lib/odoo.bash

+7-3
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,11 @@ function odoo_update_sources_archive {
146146
echoe -e "${REDC}ERROR${NC}: Cannot download Odoo. Retry this operation with --verbose option.";
147147
return 1
148148
fi
149-
150-
echoe -e "${LBLUEC}Removing old odoo sources...${NC}";
151-
rm -r "$ODOO_PATH";
149+
150+
if [ -d "$ODOO_PATH" ]; then
151+
echoe -e "${LBLUEC}Removing old odoo sources...${NC}";
152+
rm -r "$ODOO_PATH";
153+
fi
152154

153155
echoe -e "${LBLUEC}Unpacking new source archive ...${NC}";
154156
(cd "$DOWNLOADS_DIR" && \
@@ -285,6 +287,8 @@ function odoo_ensure_python_version {
285287
${python_interpreter} -c "import sys; assert (3, 6) <= sys.version_info < (3, 10);" > /dev/null 2>&1;
286288
elif [ -n "$ODOO_VERSION" ] && [ "$(odoo_get_major_version)" -eq 15 ]; then
287289
${python_interpreter} -c "import sys; assert (3, 7) <= sys.version_info < (3, 11);";
290+
elif [ -n "$ODOO_VERSION" ] && [ "$(odoo_get_major_version)" -eq 16 ]; then
291+
${python_interpreter} -c "import sys; assert (3, 7) <= sys.version_info < (3, 11);";
288292
else
289293
echoe -e "${REDC}ERROR${NC}: Automatic detection of python version for odoo ${ODOO_VERSION} is not supported!";
290294
return 1;

lib/pylib/lodoo.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,12 @@ def odoo(self):
295295
@property
296296
def dispatch(self):
297297
if self._dispatch is None:
298-
self._dispatch = functools.partial(
299-
self.odoo.http.dispatch_rpc, 'db')
298+
if odoo.release.version_info < (16,):
299+
self._dispatch = functools.partial(
300+
self.odoo.http.dispatch_rpc, 'db')
301+
else:
302+
self._dispatch = functools.partial(
303+
self.odoo.service.dispatch_rpc, 'db')
300304
return self._dispatch
301305

302306
def create_database(self, *args, **kwargs):

lib/version.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
# Odoo Helper Scripts: Version
1010

1111
# Define version number
12-
ODOO_HELPER_VERSION="0.14.1";
12+
ODOO_HELPER_VERSION="0.15.0";
1313
ODOO_HELPER_CONFIG_VERSION="1";

tests/test.bash

+78-10
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ odoo-helper install js-tools;
360360

361361

362362
# Install oca/partner-contact addons
363-
odoo-helper fetch --oca partner-contact;
363+
odoo-helper fetch --git-single-branch --oca partner-contact;
364364

365365
# Regenerate Ukrainian translations for partner_firstname addons
366366
odoo-helper tr regenerate --lang uk_UA --file uk_UA partner_firstname;
@@ -397,7 +397,7 @@ odoo-helper-addons-update base
397397

398398
# Fetch OCA account-financial-reporting, which seems to have
399399
# complicated enough dependencies for this test
400-
odoo-helper fetch --oca account-financial-reporting
400+
odoo-helper fetch --git-single-branch --oca account-financial-reporting
401401

402402
# Clone repository explicitly and link it
403403
(cd repositories && \
@@ -412,7 +412,7 @@ odoo-helper addons update-list
412412

413413
# Generate requirements and fetch them again
414414
odoo-helper addons generate-requirements > /tmp/odoo-requirements.txt
415-
odoo-helper fetch --requirements /tmp/odoo-requirements.txt
415+
odoo-helper fetch --git-single-branch --requirements /tmp/odoo-requirements.txt
416416

417417
# Try to reinstall virtualenv and run server
418418
odoo-helper install reinstall-venv;
@@ -524,7 +524,7 @@ Fetch OCA/web repo
524524
==================
525525
${NC}"
526526
# Fetch oca/web passing only repo url and branch to fetch command
527-
odoo-helper fetch https://github.com/oca/web --branch 11.0;
527+
odoo-helper fetch https://github.com/oca/web --branch 11.0 --git-single-branch --git-depth-1;
528528

529529
echo -e "${YELLOWC}
530530
============================================
@@ -881,14 +881,81 @@ odoo-helper addons update-list --tdb;
881881
odoo-helper addons install --tdb --module crm;
882882
odoo-helper addons test-installed crm;
883883

884-
## Reinstall venv without backup and build for python 3.9.7
885-
# Python compiling does not work because conflict with bashcov test coverage util
886-
#odoo-helper install reinstall-venv --no-backup --build-python 3.9.7;
884+
odoo-helper lsd; # List databases
885+
886+
## Install addon website via 'odoo-helper install'
887+
odoo-helper install website;
888+
889+
## Fetch oca/contract
890+
odoo-helper fetch --github crnd-inc/generic-addons
891+
892+
## Install addons from OCA contract
893+
odoo-helper addons install --ual --dir ./repositories/crnd-inc/generic-addons;
894+
895+
## Fetch bureaucrat_helpdesk_lite from Odoo market and try to install it
896+
odoo-helper fetch --odoo-app bureaucrat_helpdesk_lite;
897+
odoo-helper addons install --ual bureaucrat_helpdesk_lite;
887898

888-
#odoo-helper lsd; # List databases
899+
## Print list of installed addons
900+
odoo-helper addons find-installed;
901+
902+
## Run tests for helpdesk lite
903+
odoo-helper test generic_request crnd_wsd
904+
905+
# Drop created databases
906+
odoo-helper db drop odoo15-odoo-test;
907+
908+
echo -e "${YELLOWC}
909+
=================================
910+
Install and check Odoo 16.0 (Py3)
911+
=================================
912+
${NC}"
913+
914+
cd ../;
915+
916+
# Remove odoo 15
917+
# this is needed to bypass gitlab.com limitation of disk space for CI jobs
918+
rm -rf ./odoo-15.0
919+
920+
# Install odoo 16
921+
odoo-helper install sys-deps -y 16.0;
922+
923+
odoo-install --install-dir odoo-16.0 --odoo-version 16.0 \
924+
--http-port 8569 --http-host local-odoo-16 \
925+
--db-user odoo16 --db-pass odoo --create-db-user \
926+
--build-python-if-needed
927+
928+
cd odoo-16.0;
929+
930+
# Install py-tools and js-tools
931+
odoo-helper install py-tools;
932+
odoo-helper install js-tools;
933+
934+
odoo-helper server run --stop-after-init; # test that it runs
935+
936+
# Show project status
937+
odoo-helper status;
938+
odoo-helper server status;
939+
odoo-helper start;
940+
odoo-helper ps;
941+
odoo-helper status;
942+
odoo-helper server status;
943+
odoo-helper stop;
944+
945+
# Show complete odoo-helper status
946+
odoo-helper status --tools-versions --ci-tools-versions;
947+
948+
# Database management
949+
odoo-helper db create --tdb --lang en_US;
950+
951+
odoo-helper addons update-list --tdb;
952+
odoo-helper addons install --tdb --module crm;
953+
odoo-helper addons test-installed crm;
954+
955+
odoo-helper lsd; # List databases
889956

890957
## Install addon website via 'odoo-helper install'
891-
#odoo-helper install website;
958+
odoo-helper install website;
892959

893960
## Fetch oca/contract
894961
#odoo-helper fetch --github crnd-inc/generic-addons
@@ -907,7 +974,8 @@ odoo-helper addons test-installed crm;
907974
#odoo-helper test generic_request crnd_wsd
908975

909976
# Drop created databases
910-
odoo-helper db drop odoo15-odoo-test;
977+
odoo-helper db drop odoo16-odoo-test;
978+
911979

912980
echo -e "${YELLOWC}
913981
=============================================================

0 commit comments

Comments
 (0)