Skip to content

Commit 90b973d

Browse files
committed
Release 0.16.0 (2022-11-18)
Added ----- - Automatic replace of `@t-raw` to `@t-out` in `.xml` files during forwardport - Added separate command for automatic module migrate `odoo-helper ci auto-migrate-modules` that will try to automatically migrate module code to current odoo version. Currently it can do only simple *find-and-replace* via regex. - Added ability to run migration tests with single command, by adding new options to `odoo-helper test` command: - `--migration` - run migration tests - `--migration-repo` - specify repo to test Fixes ----- - support for Odoo 16.0
2 parents 8ddc938 + 26b4c45 commit 90b973d

File tree

9 files changed

+225
-71
lines changed

9 files changed

+225
-71
lines changed

.gitlab-ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ flake8:
9090

9191
tests:ubuntu:18.04:
9292
image: ubuntu:18.04
93+
variables:
94+
ODOO_INSTALL_NODE_VERSION: "16.15.1"
9395
<<: *tests-definition
9496

9597
tests:ubuntu:20.04:

CHANGELOG.md

+21-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
# Release Notes
22

3-
## Release 0.15.0
3+
## Release 0.16.0 (2022-11-18)
4+
5+
### Added
6+
7+
- Automatic replace of `@t-raw` to `@t-out` in `.xml` files during forwardport
8+
- Added separate command for automatic module migrate `odoo-helper ci auto-migrate-modules`
9+
that will try to automatically migrate module code to current odoo version.
10+
Currently it can do only simple *find-and-replace* via regex.
11+
- Added ability to run migration tests with single command, by adding new
12+
options to `odoo-helper test` command:
13+
- `--migration` - run migration tests
14+
- `--migration-repo` - specify repo to test
15+
16+
### Fixes
17+
18+
- support for Odoo 16.0
19+
20+
21+
---
22+
23+
## Release 0.15.0 (2022-10-25)
424

525
### Added
626

lib/ci.bash

+71-10
Original file line numberDiff line numberDiff line change
@@ -899,23 +899,79 @@ function ci_ensure_addons_have_changelog {
899899
return $res;
900900
}
901901

902+
function ci_auto_migrate_modules {
903+
local usage="
904+
Try to automatically migrate modules to current odoo version.
905+
It is not full migration, but just some predefined actions, that
906+
could simplify migrations. The changes made by this command does not
907+
change or update logic. Currently it is only set of find-and-replace rules
908+
applied to module.
909+
910+
Usage:
911+
912+
$SCRIPT_NAME ci auto-migrate-modules [options] [args]
913+
914+
Options:
915+
--help - print this help message
916+
917+
Args:
918+
Same arguments as passed to odoo-helper addons list
919+
920+
Example:
921+
922+
# Command below will try to migrate all installable modules in
923+
# current directory
924+
$SCRIPT_NAME ci auto-migrate-modules --installable .
925+
";
926+
# Parse options
927+
if [[ $# -lt 1 ]]; then
928+
echo "$usage";
929+
return 0;
930+
fi
931+
while [[ $# -gt 0 ]]
932+
do
933+
local key="$1";
934+
case $key in
935+
-h|--help|help)
936+
echo "$usage";
937+
return 0;
938+
;;
939+
*)
940+
break;
941+
;;
942+
esac
943+
shift
944+
done
945+
946+
local addons_to_migrate
947+
mapfile -t addons_to_migrate < <(addons_list_in_directory --by-path "$@");
948+
for addon_path in "${addons_to_migrate[@]}"; do
949+
local addon_name;
950+
addon_name=$(addons_get_addon_name "$addon_path");
951+
echoe -e "${BLUEC}Migrating addon ${YELLOWC}${addon_name}${BLUEC} ...${NC}";
952+
exec_py "${ODOO_HELPER_LIB}/pylib/ci_fw_postfixes.py" --version="$ODOO_VERSION" --path="$addon_path";
953+
echoe -e "${BLUEC}Migrated addon ${YELLOWC}${addon_name}${BLUEC}: ${GREENC}OK${NC}";
954+
done
955+
}
956+
902957
function ci_command {
903958
local usage="
904959
This command provides subcommands useful in CI (Continious Integration) process
905960
906961
NOTE: This command is experimental and everything may be changed.
907962
908963
Usage:
909-
$SCRIPT_NAME ci check-versions-git [--help] - ensure versions of changed addons were updated
910-
$SCRIPT_NAME ci fix-versions [--help] - fix versions of changed addons
911-
$SCRIPT_NAME ci ensure-icons [--help] - ensure all addons in specified directory have icons
912-
$SCRIPT_NAME ci ensure-changelog [--help] - ensure that changes described in changelog
913-
$SCRIPT_NAME ci push-changes [--help] - push changes to same branch
914-
$SCRIPT_NAME ci do-forward-port [--help] - do forwardport
915-
$SCRIPT_NAME ci do-fwp [--help] - alias to 'do-forward-port'
916-
$SCRIPT_NAME ci do-fp [--help] - alias to 'do-forward-port'
917-
$SCRIPT_NAME ci do-fw [--help] - alias to 'do-forward-port'
918-
$SCRIPT_NAME ci -h|--help|help - show this help message
964+
$SCRIPT_NAME ci check-versions-git [--help] - ensure versions of changed addons were updated
965+
$SCRIPT_NAME ci fix-versions [--help] - fix versions of changed addons
966+
$SCRIPT_NAME ci ensure-icons [--help] - ensure all addons in specified directory have icons
967+
$SCRIPT_NAME ci ensure-changelog [--help] - ensure that changes described in changelog
968+
$SCRIPT_NAME ci push-changes [--help] - push changes to same branch
969+
$SCRIPT_NAME ci do-forward-port [--help] - do forwardport
970+
$SCRIPT_NAME ci do-fwp [--help] - alias to 'do-forward-port'
971+
$SCRIPT_NAME ci do-fp [--help] - alias to 'do-forward-port'
972+
$SCRIPT_NAME ci do-fw [--help] - alias to 'do-forward-port'
973+
$SCRIPT_NAME ci auto-migrate-modules [--help] - automatically try to migrate modules to current version
974+
$SCRIPT_NAME ci -h|--help|help - show this help message
919975
";
920976

921977
if [[ $# -lt 1 ]]; then
@@ -957,6 +1013,11 @@ function ci_command {
9571013
ci_do_forwardport "$@";
9581014
return;
9591015
;;
1016+
auto-migrate-modules)
1017+
shift;
1018+
ci_auto_migrate_modules "$@";
1019+
return;
1020+
;;
9601021
-h|--help|help)
9611022
echo "$usage";
9621023
return 0;

lib/install.bash

+7
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,10 @@ function install_reinstall_odoo {
13521352
13531353
Options:
13541354
--no-backup - do not backup old version of odoo
1355+
--single-branch - in case of reinstallting from git,
1356+
clone only single branch of odoo.
1357+
This could increase speed of clonning and
1358+
reduce disk size needed to store odoo code
13551359
-h|--help|help - show this help message
13561360
";
13571361

@@ -1370,6 +1374,9 @@ function install_reinstall_odoo {
13701374
--no-backup)
13711375
do_not_backup_old_odoo=1;
13721376
;;
1377+
--single-branch)
1378+
CLONE_SINGLE_BRANCH=on;
1379+
;;
13731380
-h|--help|help)
13741381
echo "$usage";
13751382
return 0;

lib/pylib/ci_fw_postfixes.py

+20
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,26 @@
7575
],
7676
}
7777

78+
# Auto checks for 15.0
79+
CHECKS['15.0'] = {
80+
'.xml': [
81+
("replace",
82+
r"t-raw=(?P<q>['\"])",
83+
"t-out=\g<q>",
84+
"Replace '@t-raw=...' with '@t-out=...' attribute in xml."),
85+
],
86+
}
87+
88+
# Auto checks for 16.0
89+
CHECKS['16.0'] = {
90+
'.xml': [
91+
("replace",
92+
r"t-raw=(?P<q>['\"])",
93+
"t-out=\g<q>",
94+
"Replace '@t-raw=...' with '@t-out=...' attribute in xml."),
95+
],
96+
}
97+
7898

7999
def run_command_replace(fpath, fcontent, expr, subst, msg):
80100
""" Replace all occurences of <expr> in <fcontent> by <subst>

lib/pylib/lodoo.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,8 @@ def odoo(self):
295295
@property
296296
def dispatch(self):
297297
if self._dispatch is None:
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')
298+
self._dispatch = functools.partial(
299+
self.odoo.http.dispatch_rpc, 'db')
304300
return self._dispatch
305301

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

0 commit comments

Comments
 (0)