Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
38c920a
WIP: use copier
thomaspaulb Jan 26, 2026
56af10d
[UPD] ref
thomaspaulb Jan 26, 2026
c92d559
fixup! [UPD] ref
thomaspaulb Jan 26, 2026
1cdc639
[UPD] bootstrap.jinja
thomaspaulb Jan 26, 2026
4ac1440
[UPD] readme
thomaspaulb Jan 26, 2026
09ac5e8
[UPD] choices as str
thomaspaulb Jan 27, 2026
31f34ed
[ADD] migration script to detect waftlib and Odoo version that was ch…
thomaspaulb Jan 27, 2026
181d700
[ADD] context hook for defaults
thomaspaulb Jan 28, 2026
11514e1
fixup! [ADD] context hook for defaults
thomaspaulb Jan 28, 2026
3094d19
fixup! fixup! [ADD] context hook for defaults
thomaspaulb Jan 28, 2026
7631dc2
fixup! fixup! fixup! [ADD] context hook for defaults
thomaspaulb Jan 28, 2026
905c1ee
fixup! fixup! fixup! fixup! [ADD] context hook for defaults
thomaspaulb Jan 28, 2026
0b41482
fixup! fixup! fixup! fixup! fixup! [ADD] context hook for defaults
thomaspaulb Jan 28, 2026
397d0dc
fixup! fixup! fixup! fixup! fixup! fixup! [ADD] context hook for defa…
thomaspaulb Jan 28, 2026
da9afec
fixup! fixup! fixup! fixup! fixup! fixup! fixup! [ADD] context hook f…
thomaspaulb Jan 28, 2026
6d97922
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! [ADD] context…
thomaspaulb Jan 28, 2026
8b70d76
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! [ADD] …
thomaspaulb Jan 28, 2026
2c5145c
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
thomaspaulb Jan 28, 2026
0f84cb0
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
thomaspaulb Jan 28, 2026
6de35e7
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
thomaspaulb Jan 28, 2026
2a2bca2
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
thomaspaulb Jan 28, 2026
5b1572c
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
thomaspaulb Jan 28, 2026
502e9fa
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
thomaspaulb Jan 28, 2026
c2b8368
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
thomaspaulb Jan 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env-secret.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ODOO_VERSION={{odoo_version}}
66 changes: 63 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,65 @@
# Waft Odoo installation method
# Waft project template

Waft is a wrapper for installing [Odoo](https://github.com/odoo/odoo).
This repository is the template project for Waft.

For documentation, please see the accompanying [waftlib](https://github.com/sunflowerit/waftlib)
## Installing copier

You can start a new Waft/Odoo project based on this template by using [copier](https://copier.readthedocs.io).

Copier and a plugin first need to be installed as a tool on your system.

```
pipx install copier
pipx inject copier copier-template-extensions
```

or

```
uv tool install copier --with copier-template-extensions
```

## Creating a new project

You can now use copier to clone this template Waft project into your own:

copier copy https://github.com/sunflowerit/waft --trust --vcs-ref use-copier myproject

This will ask you for the Odoo and waftlib versions to use, then set up the project.

Select an Odoo version that you want to use, for example 18.0.

When you are happy, push the project somewhere you like:

```
git init
git remote add git@org:repo.git
git add .
git commit -m "[ADD] initial project set up"
git push
```

## Updating to a newer project template version

If you want to update a project to the newest version of the template, you can use:

```
cd myproject
copier update [--vcs-ref use-copier] --trust
```

Copier will then check back in with `github.com/sunflowerit/waft` and update any files to its newest template, and run migration scripts if they exist.

If any project files have be edited locally, copier will not replace the files but show a conflict that you can solve.

Once happy you can push the updates to your project repository:

```
git add .
git commit -m "[UPD] waft to newer version"
git push
```

## Using waft features

Please see the [main waftlib README](https://github.com/sunflowerit/waftlib).
5 changes: 5 additions & 0 deletions README.md.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Your project

Information about your project

## more info
42 changes: 42 additions & 0 deletions _copier/context.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import re

from copier_template_extensions import ContextHook


class ContextUpdater(ContextHook):

detection_run = False
waftlib_version = None
odoo_version = None

def _detect_waftlib_version(self):
with open("bootstrap", "r") as file:
for line in file:
if line.startswith("export LIBRARIES_VERSION_BRANCH"):
pattern = r':-(.+?)}'
_match = re.search(pattern, line)
if _match:
return _match.group(1)

def _detect_odoo_version(self):
with open(".env-shared", "r") as file:
for line in file:
if line.startswith("ODOO_VERSION="):
pattern = r'=\"(.+?)\"'
_match = re.search(pattern, line)
if _match:
return _match.group(1)

def hook(self, context):
context_updates = {}

if context.get("_copier_phase") == "prompt":
if not self.detection_run:
print("Trying to detect waftlib version from bootstrap file...")
self.waftlib_version = self._detect_waftlib_version()
print("Trying to detect Odoo version from .env-shared file...")
self.odoo_version = self._detect_odoo_version()
context_updates["default_waftlib_version"] = self.waftlib_version
context_updates["default_odoo_version"] = self.odoo_version
self.detection_run = True
return context_updates
2 changes: 1 addition & 1 deletion bootstrap → bootstrap.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

export LIBRARIES_REPOSITORIES='https://github.com/sunflowerit/waftlib.git'
export LIBRARIES_VERSION_BRANCH=${LIBRARIES_VERSION_BRANCH:-v.22.05.30} #versions: v.21.05.10, v.21.09.22, v.22.05.30
export LIBRARIES_VERSION_BRANCH=${LIBRARIES_VERSION_BRANCH:-{{waftlib_version}}}

################################################################
###### ######
Expand Down
65 changes: 65 additions & 0 deletions copier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# min version: 9.6, for supporting context phases
_min_copier_version: '9.6'

_skip_if_exists:
- README.md # people need to fill this for themselves

# use contextupdater plugin (requires --trust)
_jinja_extensions:
- copier_templates_extensions.TemplateExtensionLoader
- _copier/context.py:ContextUpdater

# migrations (requires --trust)
#_migrations:
# - version: "v1.0.0"
# when: "{{ _stage == 'before' }}"
# command: ["{{ _copier_python }}", _copier/detect-versions.py]

#_tasks:
# - when: "{{ _copier_operation == 'copy' }}"
# command: ["{{ _copier_python }}", _copier/detect-versions.py]

# questions
odoo_version:
type: str
help: What Odoo version should this project have?
default: '{{ default_odoo_version }}'
choices:
- '19.0'
- '18.0'
- '17.0'
- '16.0'
- '15.0'
- '14.0'
- '13.0'
- '12.0'
- '11.0'
- '10.0'
- '9.0'
- '8.0'

waftlib_version:
type: str
help: Which version of Waftlib should this project use?
default: '{{ default_waftlib_version }}'
choices:
- 'v.22.05.30'
- 'v.21.09.22'
- 'v.21.05.10'
- 'master'

_message_after_copy: |

Your Waft project with Odoo {{ odoo_version }} has been created successfully!

Next steps:

1. Change directory to the project root:

$ cd {{ _copier_conf.dst_path }}

2. Run bootstrap:

$ ./bootstrap

3. Read the documentation on how to build Odoo
2 changes: 2 additions & 0 deletions {{_copier_conf.answers_file}}.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Changes here will be overwritten by Copier
{{ _copier_answers|to_nice_yaml -}}