Skip to content

Commit

Permalink
Merge pull request #492 from Tecnativa/add-v18
Browse files Browse the repository at this point in the history
[ADD] Option for Odoo 18.0
  • Loading branch information
pedrobaeza authored Oct 11, 2024
2 parents acda9a8 + 6124021 commit 0649302
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.yml.jinja
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{%- include "vendor/oca-addons-repo-template/src/{% if odoo_version > 12 %}.eslintrc.yml{% endif %}" -%}
{%- include "vendor/oca-addons-repo-template/src/{% if odoo_version > 12 %}.eslintrc.yml{% endif %}.jinja" -%}
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ jobs:
- 14.0
- 15.0
- 16.0
- 17.0
include:
- python-version: "3.10"
odoo-version: 17.0
odoo-version: 18.0
- python-version: 3.11
odoo-version: 17.0
odoo-version: 18.0
traefik_version:
- 1
- 2
Expand Down
17 changes: 12 additions & 5 deletions .pre-commit-config.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@

{#- This namespace holds repo versions #}
{%- set proj_rev = namespace() %}

{%- set proj_rev.ruff = "v0.1.3" %}
{%- set proj_rev.pre_commit_hooks = "v4.5.0" %}
{%- set proj_rev.odoo_pre_commit_hooks = "v0.0.29" %}
{%- if odoo_version < 16 %}
{%- set proj_rev.pylint_odoo = "v8.0.0" %}
{%- elif odoo_version < 17 %}
{%- set proj_rev.pylint_odoo = "v8.0.20" %}
{%- else %}
{%- elif odoo_version < 18 %}
{%- set proj_rev.pylint_odoo = "v9.0.4" %}
{%- else %}
{%- set proj_rev.pylint_odoo = "v9.1.3" %}
{%- set proj_rev.ruff = "v0.6.8" %}
{%- set proj_rev.pre_commit_hooks = "v4.6.0" %}
{%- set proj_rev.odoo_pre_commit_hooks = "v0.0.33" %}
{%- endif -%}

exclude: |
Expand Down Expand Up @@ -47,15 +54,15 @@ repos:
- odoo/custom/src/private
{% if odoo_version >= 14 -%}
- repo: https://github.com/OCA/odoo-pre-commit-hooks
rev: v0.0.29
rev: {{ proj_rev.odoo_pre_commit_hooks }}
hooks:
- id: oca-checks-odoo-module
- id: oca-checks-po
args: ["--fix"]
{% endif -%}
{% if odoo_version >= 13 -%}
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
rev: {{ proj_rev.ruff }}
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down Expand Up @@ -104,7 +111,7 @@ repos:
- [email protected]
- "@prettier/[email protected]"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: {{ proj_rev.pre_commit_hooks }}
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand Down
6 changes: 4 additions & 2 deletions copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ _migrations:
odoo_version:
help: On which odoo version is it based?
type: float
default: 17.0
default: 18.0
choices:
- 7.0
- 8.0
Expand All @@ -112,6 +112,7 @@ odoo_version:
- 15.0
- 16.0
- 17.0
- 18.0

odoo_proxy:
default: traefik
Expand Down Expand Up @@ -360,7 +361,7 @@ cidr_whitelist:
⚠️ It must be a list. And this is only supported if you deploy with Traefik 2+.
postgres_version:
default: "15"
default: "16"
help: >-
Which PostgreSQL version do you want to deploy? (Recommended: for new instances
always use the latest version. Version 9.6 has no backup support.)
Expand All @@ -373,6 +374,7 @@ postgres_version:
"13": "13"
"14": "14"
"15": "15"
"16": "16"
validator: >-
{% if postgres_version|int > 0 %} {% if (odoo_version >= 16.0 and
postgres_version|int < 12) or (odoo_version >= 14.0 and postgres_version|int < 10)
Expand Down
6 changes: 5 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
frozenset(map(float, os.environ.get("SELECTED_ODOO_VERSIONS", "").split()))
or ALL_ODOO_VERSIONS
)
PRERELEASE_ODOO_VERSIONS = {17.0}
PRERELEASE_ODOO_VERSIONS = {18.0}

# Postgres versions
ALL_PSQL_VERSIONS = tuple(COPIER_SETTINGS["postgres_version"]["choices"])
Expand Down Expand Up @@ -67,6 +67,10 @@
"oldest": "12",
"latest": LATEST_PSQL_VER,
},
18.0: {
"oldest": "12",
"latest": LATEST_PSQL_VER,
},
}


Expand Down
46 changes: 28 additions & 18 deletions tests/test_tasks_downstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ def test_test_tasks(
invoke("resetdb", "-m", module_name, "--dependencies")
assert _install_status("mail") == "installed"
# Test module simple call in init mode (default)
if supported_odoo_version >= 17:
# Uninstall module
invoke("uninstall", "-m", module_name)
assert _install_status(module_name) == "uninstalled"
stdout = invoke("test", "-m", module_name, retcode=None)
# Ensure module was installed and tests ran
Expand Down Expand Up @@ -378,25 +381,32 @@ def test_test_tasks(
}
)
invoke("git-aggregate")
invoke("resetdb", "--extra", "--private", "--dependencies")
assert (
_install_status("mail") == "installed"
) # dependency of test_module
assert (
_install_status("account") == "installed"
) # dependency of account_invoice_refund_link
# Test "account_invoice_refund_link"
assert _install_status("test_module") == "uninstalled"
assert _install_status("account_invoice_refund_link") == "uninstalled"
stdout = invoke("test", "--private", "--extra", retcode=None)
# Ensure "test_module" and "account_invoice_refund_link" were installed
assert _install_status("test_module") == "installed"
assert _install_status("account_invoice_refund_link") == "installed"
_tests_ran(
stdout, supported_odoo_version, "account_invoice_refund_link"
)
if supported_odoo_version < 18.0:
# TODO: Put 19.0 once 'account_invoice_refund_link' is migrated to Odoo 18.0
# Skip the tests for 'account_invoice_refund_link' as it's not available yet
invoke("resetdb", "--extra", "--private", "--dependencies")
assert (
_install_status("mail") == "installed"
) # dependency of test_module
assert (
_install_status("account") == "installed"
) # dependency of account_invoice_refund_link
# Test "account_invoice_refund_link"
assert _install_status("test_module") == "uninstalled"
assert (
_install_status("account_invoice_refund_link") == "uninstalled"
)
stdout = invoke("test", "--private", "--extra", retcode=None)
# Ensure "test_module" and "account_invoice_refund_link" were installed
assert _install_status("test_module") == "installed"
assert _install_status("account_invoice_refund_link") == "installed"
_tests_ran(
stdout, supported_odoo_version, "account_invoice_refund_link"
)
# Test --test-tags
if supported_odoo_version >= 12:
if supported_odoo_version >= 12 and supported_odoo_version < 18.0:
# TODO: Put 19.0 once 'account_invoice_refund_link' is migrated to Odoo 18.0
# Skip the tests for 'account_invoice_refund_link' as it's not available yet
with local.cwd(tmp_path / "odoo" / "custom" / "src" / "private"):
generate_test_addon(
"test_module",
Expand Down

0 comments on commit 0649302

Please sign in to comment.