diff --git a/.env.template b/.env.template index d86453e3..04436377 100644 --- a/.env.template +++ b/.env.template @@ -1,3 +1,4 @@ ODOO_ADDONS_PATH=thirdparty/odoo-apps-partner-contact,../odoo-cd/untracked-odoo-apps DOCKER_REGISTRY=mint-system/ -ODOO_REVISION=16.0.2024.XXXX \ No newline at end of file +DOCKER_TAG=odoo:16.0.2024.0405 +ODOO_REVISION=16.0.2024.0405 \ No newline at end of file diff --git a/README.md b/README.md index 347a0bc9..25cc6b84 100644 --- a/README.md +++ b/README.md @@ -7,17 +7,19 @@ Odoo Build This is the [Mint System](https://www.mint-system.ch/) Odoo development environment. -This projects provides a highly opinionated way to develop Odoo and Odoo modules. It supports the following scenarios: +This projects provides a highly opinionated way to develop Odoo modules. It features: +* **Odoo Source**: Checkout the Odoo Community and Enterprise Edition and start editing the source code. * **Docker Compose**: Spin up a Odoo, Postgres and pgAdmin Docker container and experiment locally. -* **Import and Export Database**: Use Odoo scripts to copy and restore a remote customer database to the local environment. Investigate issues and deploy the database at ease. -* **Community Edition**: Checkout the Odoo Community Edition and start editing the source code. -* **Enterprise Modules**: Checkout the Odoo enterprise modules and deploy them into the Odoo Docker container or the Odoo source. -* **Develop Modules**: Scaffold a new module, develop new Odoo features locally and [much more](./task.md). +* **Native**: Start an Odoo server directly from the source. +* **Import and Export Database**: Use Odoo scripts to copy and restore a customer database to the local environment. Investigate issues and deploy the database at ease. +* **Community Modules**: The most common community modules are checked out when setting up the project. * **Customizing Snippets**: Create [snippets](./snippets.md) and push them to an Odoo database. * **Odoo Scripts**: Develope scripts to patch Odoo code. -* **Odoo Image**: Build and publish an custom Odoo Docker image. See [README](./build/README.md) for details. -* **Kubernetes**: Deploy Odoo and Postgres to Kubernetes cluster. +* **Odoo Revisions**: Snapshot the Odoo source at a specific date. +* **Odoo Image**: Build and publish a custom Odoo Docker image. See [README](./build/README.md) for details. +* **Kubernetes**: Deploy Odoo and Postgres to a Kubernetes cluster. +* **Develop Modules**: Scaffold a new module, develop new Odoo features locally and [much more](./task.md). ## Requirements @@ -31,7 +33,7 @@ You can also use [Nix](https://nixos.org/) to setup the development requirements ## Usage -The usage section is a set of workflows. Pick the one required by your scenario. See `task help` or [task](./task.md) for details about the project commands. +The usage section is a set of workflows. See `task help` or [task](./task.md) for details about the project commands. Clone this repository. @@ -46,7 +48,7 @@ When working with Nix, run the nix-shell. nix-shell ``` -Checkout branch. +Checkout the Odoo version. ```bash task checkout 13.0 @@ -60,7 +62,7 @@ task checkout 16.0 task checkout 17.0 ``` -Install [Odoo scripts](https://ansible.build/roles/odoo_scripts/) +Install [Odoo scripts](https://ansible.build/roles/odoo_scripts/). ```bash task install-odoo-scripts @@ -111,6 +113,8 @@ task create-module addons/project_report **Load modules from thirdpary folder** +Clone thirdparty repos into the `thirdparty` folder. + To load modules from a thirdparty folder, set this env var in your `.env` file ```bash @@ -161,10 +165,10 @@ Open database manager [http://localhost:8000/](http://localhost:8000/) and login **Remove Docker conainers** -Kill docker containers and volumes. +Remove Docker containers and volumes. ```bash -task kill +task down ``` **Stop all Docker containers** @@ -184,8 +188,15 @@ task drop-db To build the Docker image setup these `.env` vars: ```bash -ODOO_REVISION=16.0 +ODOO_REVISION=16.0.2024.0405 DOCKER_REGISTRY=mint-system/ +DOCKER_TAG=odoo:16.0.2024.0405 +``` + +Checkout the Odoo revision. + +```bash +task checkout-revision ``` Build the Odoo image. diff --git a/scripts/odoo_revision_13.0.2022.0228 b/scripts/odoo_revision_13.0.2022.0228 new file mode 100755 index 00000000..56807c7c --- /dev/null +++ b/scripts/odoo_revision_13.0.2022.0228 @@ -0,0 +1,32 @@ +#!/bin/bash + +ODOO_REVISION=13.0.2022.0228 + +# Checkout enterprise repo +cd enterprise && git checkout 5f89ea34af741d159d30e41a12fa94db95234d2a + +# Create tag on the enterprise repo +git tag -a $ODOO_REVISION -m "$ODOO_REVISION" +cd .. + +# Checkout odoo repo +cd odoo && git checkout b84d9597df1be89ba418c7969a2cf8c632eb8316 + +# Create tag on the odoo repo +git tag -a $ODOO_REVISION -m "$ODOO_REVISION" +cd .. + +# Checkout theme repo +cd themes && git checkout 17a711b1040eb0df7ffafcdf93e20484501dd9d1 + +# Create tag on the odoo repo +git tag -a $ODOO_REVISION -m "$ODOO_REVISION" +cd .. + +# Pull docker image +DIGEST=odoo@sha256:9ea449cce3bbbb92bb8ec3568ecd501822d470ace07a264d4f68918256f4e6c3 +docker pull "$DIGEST" +IMAGE_ID=$(docker image inspect "$DIGEST" --format "{{ .ID }}") + +# Tag the docker image +docker tag ${IMAGE_ID:7:12} odoo:$ODOO_REVISION \ No newline at end of file diff --git a/scripts/odoo_revision_16.0.2024.0405 b/scripts/odoo_revision_16.0.2024.0405 new file mode 100755 index 00000000..0de3f077 --- /dev/null +++ b/scripts/odoo_revision_16.0.2024.0405 @@ -0,0 +1,32 @@ +#!/bin/bash + +ODOO_REVISION=16.0.2024.0405 + +# Checkout odoo repo +cd odoo && git checkout 391a427620b6aec690481fe7c7d0b0326b95ee8c + +# Create tag on the odoo repo +git tag -a $ODOO_REVISION -m "$ODOO_REVISION" +cd .. + +# Checkout enterprise repo +cd enterprise && git checkout 47cc8bbed4f326d2eff14f072f62259a82a12d08 + +# Create tag on the enterprise repo +git tag -a $ODOO_REVISION -m "$ODOO_REVISION" +cd .. + +# Checkout theme repo +cd themes && git checkout 1d0f0fc2caacd7f69b303fea6f5f0630db377f4b + +# Create tag on the odoo repo +git tag -a $ODOO_REVISION -m "$ODOO_REVISION" +cd .. + +# Pull docker image +DIGEST=odoo@sha256:cf82ec54966a737c870c59ed935659242588322c080e7e30dd13184b31043db6 +docker pull "$DIGEST" +IMAGE_ID=$(docker image inspect "$DIGEST" --format "{{ .ID }}") + +# Tag the docker image +docker tag ${IMAGE_ID:7:12} odoo:$ODOO_REVISION \ No newline at end of file diff --git a/scripts/odoo_revision_17.0.2024.0405 b/scripts/odoo_revision_17.0.2024.0405 new file mode 100755 index 00000000..aa736c03 --- /dev/null +++ b/scripts/odoo_revision_17.0.2024.0405 @@ -0,0 +1,32 @@ +#!/bin/bash + +ODOO_REVISION=17.0.2024.0405 + +# Checkout odoo repo +cd odoo && git checkout ccfd48f3b445d269069c97c431c0c66e60157957 + +# Create tag on the odoo repo +git tag -a $ODOO_REVISION -m "$ODOO_REVISION" +cd .. + +# Checkout enterprise repo +cd enterprise && git checkout 3ec74fd2189dc431e3ea55a3c2142a422fffd0d5 + +# Create tag on the enterprise repo +git tag -a $ODOO_REVISION -m "$ODOO_REVISION" +cd .. + +# Checkout theme repo +cd themes && git checkout 09832134ae20c74bbab5f5959f4678fc5e3188dd + +# Create tag on the odoo repo +git tag -a $ODOO_REVISION -m "$ODOO_REVISION" +cd .. + +# Pull docker image +DIGEST=odoo@sha256:d13febe57e6e3761497c27be3d208856d91159578bc10a8547cc350848e20c05 +docker pull "$DIGEST" +IMAGE_ID=$(docker image inspect "$DIGEST" --format "{{ .ID }}") + +# Tag the docker image +docker tag ${IMAGE_ID:7:12} odoo:$ODOO_REVISION \ No newline at end of file diff --git a/task b/task index 6eb91d5d..a1718747 100755 --- a/task +++ b/task @@ -649,16 +649,8 @@ function checkout() { } function checkout-revision() { - if test -z "$1"; then echo "\$1 is empty."; exit; fi - - cd odoo || exit - git checkout "$1" - cd .. || exit - cd enterprise || exit - git checkout "$1" - cd .. || exit - cd themes || exit - git checkout "$1" + echo "Execute snapt script for revision: $ODOO_REVISION" + ./scripts/odoo_revision_${ODOO_REVISION} } function git-submodule-pull() {