2026-02-15 01:07:25 -05:00
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
# Development guide
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
Setup your environment to develop modules and debug the platform.
|
|
|
|
|
|
2020-09-30 20:49:35 -04:00
|
|
|
## Local installation procedure
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
### 1. Clone the project:
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
```bash
|
|
|
|
|
git clone https://github.com/ERPLibre/ERPLibre.git
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 2. Execute the script:
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
```bash
|
|
|
|
|
cd ERPLibre
|
2023-01-02 20:33:57 -05:00
|
|
|
./script/install/install_dev.sh
|
|
|
|
|
./script/install/install_locally_dev.sh
|
2020-07-05 22:38:14 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 3. Run ERPLibre
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
```bash
|
|
|
|
|
./run.sh
|
|
|
|
|
```
|
|
|
|
|
|
2020-07-06 23:08:05 -04:00
|
|
|
## Develop in Odoo repository
|
2021-07-20 20:14:24 -04:00
|
|
|
|
|
|
|
|
You need to remove `clone-depth="10"` from `./manifest/default.dev.xml` in order to be able to commit and push. Make a
|
2023-01-02 20:33:57 -05:00
|
|
|
temporary commit and regenerate with `./script/install/install_locally_dev.sh`
|
2020-07-06 23:08:05 -04:00
|
|
|
|
2023-01-02 20:33:57 -05:00
|
|
|
## Fork project to create a new project independent of ERPLibre (deprecated)
|
2021-07-20 20:14:24 -04:00
|
|
|
|
|
|
|
|
ERPLibre was created with this script. It's now deprecated. Use this script when you need to fork directly from the
|
|
|
|
|
original source. Don't use this script if you want to update from ERPLibre and follow mainstream development.
|
|
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
```bash
|
2023-01-02 20:33:57 -05:00
|
|
|
./script/git/fork_project.py --github_token GITHUB_KEY --organization NAME
|
2020-07-05 22:38:14 -04:00
|
|
|
```
|
|
|
|
|
|
2020-09-30 20:49:35 -04:00
|
|
|
# Fork all repos for you own organization
|
2021-07-20 20:14:24 -04:00
|
|
|
|
|
|
|
|
Go to your Github account and generate a token to access fork option with your user. Create an organization or use your
|
|
|
|
|
personal account and choose your user name.
|
2020-07-05 22:38:14 -04:00
|
|
|
|
2021-07-20 16:19:01 -04:00
|
|
|
This command will fork all repos and ERPLibre to your own organization. It keeps track of ERPLibre.
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
```bash
|
2023-01-02 20:33:57 -05:00
|
|
|
./script/git/fork_project_ERPLibre.py --github_token GITHUB_KEY --organization NAME
|
2020-07-05 22:38:14 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Generate manifest from csv repo
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
Add repo in file [./source_repo_addons.csv](./source_repo_addons.csv)
|
|
|
|
|
|
2020-09-30 20:49:35 -04:00
|
|
|
Execute to generate Repo manifest
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
```bash
|
2023-01-02 20:33:57 -05:00
|
|
|
./script/git/fork_project_ERPLibre.py --skip_fork
|
2020-07-05 22:38:14 -04:00
|
|
|
```
|
|
|
|
|
|
2021-07-20 16:19:01 -04:00
|
|
|
## Move database from prod to dev
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2024-08-25 00:45:41 -04:00
|
|
|
Copy the database image into `./image_db/prod_client.zip` and run `make db_restore_prod_client`. This will create a
|
|
|
|
|
database
|
2022-02-04 14:12:53 -05:00
|
|
|
named `prod_client` ready to test.
|
|
|
|
|
|
|
|
|
|
When moving database from prod to your dev environment, you want to remove email servers, backups and install user test
|
|
|
|
|
in order to test the database. Run:
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
```bash
|
2023-01-02 20:33:57 -05:00
|
|
|
./script/database/migrate_prod_to_test.sh DATABASE
|
2020-07-05 22:38:14 -04:00
|
|
|
```
|
|
|
|
|
|
2021-07-20 16:19:01 -04:00
|
|
|
## Change git url https to Git
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-07-20 16:19:01 -04:00
|
|
|
This will update all urls in Git format:
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
```bash
|
2023-01-02 20:33:57 -05:00
|
|
|
./script/git/git_change_remote_https_to_git.py
|
2020-07-05 22:38:14 -04:00
|
|
|
```
|
|
|
|
|
|
2020-09-30 20:49:35 -04:00
|
|
|
## Showing repo differences between projects
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
Tools to display the differences between the repo and another project.
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
```bash
|
2023-01-02 20:33:57 -05:00
|
|
|
./script/git/git_change_remote.py --sync_to /path/to/project/erplibre --dry_sync
|
2020-07-05 22:38:14 -04:00
|
|
|
```
|
|
|
|
|
|
2021-07-16 00:56:30 -04:00
|
|
|
## Showing repo differences with manifest develop
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-07-20 16:19:01 -04:00
|
|
|
To understand the divergences with the dev manifest.
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-07-16 00:56:30 -04:00
|
|
|
```bash
|
2023-01-02 20:33:57 -05:00
|
|
|
./script/git/git_show_code_diff_repo_manifest.py -m ./manifest/default.dev.xml
|
2021-07-16 00:56:30 -04:00
|
|
|
```
|
|
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
## Sync repo with another project
|
2021-07-20 20:14:24 -04:00
|
|
|
|
|
|
|
|
Tools to synchronise the repo with another project. This will show differences and try to checkout on the same commit in
|
|
|
|
|
all repos.
|
|
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
```bash
|
2023-01-02 20:33:57 -05:00
|
|
|
./script/git/git_change_remote.py --sync_to /path/to/project/erplibre
|
2020-07-05 22:38:14 -04:00
|
|
|
```
|
|
|
|
|
|
2020-09-30 20:49:35 -04:00
|
|
|
## Compare two files manifests
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-09-30 20:49:35 -04:00
|
|
|
To show differences between commits in different manifests
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-07-11 21:13:44 -04:00
|
|
|
```bash
|
2023-01-02 20:33:57 -05:00
|
|
|
./script/git/git_diff_repo_manifest.py --input1 ./manifest/MANIFEST1.xml --input2 ./manifest/MANIFEST2.xml
|
2020-07-11 21:13:44 -04:00
|
|
|
```
|
|
|
|
|
|
2020-09-30 20:49:35 -04:00
|
|
|
## Differences between code and manifest
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-09-30 20:49:35 -04:00
|
|
|
To show differences between actual code and manifest
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-09-03 04:28:43 -04:00
|
|
|
```bash
|
2023-01-02 20:33:57 -05:00
|
|
|
./script/git/git_show_code_diff_repo_manifest.py --manifest ./manifest/MANIFEST1.xml
|
2020-09-03 04:28:43 -04:00
|
|
|
```
|
|
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
## Add repo
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-09-30 20:49:35 -04:00
|
|
|
To access a new repo, add your URL to file [source_repo_addons.csv](../source_repo_addons.csv)
|
2020-07-05 22:38:14 -04:00
|
|
|
|
|
|
|
|
Fork the repo to be able to push new code:
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
```bash
|
2023-01-02 20:33:57 -05:00
|
|
|
./script/git/fork_project_ERPLibre.py
|
2020-07-05 22:38:14 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
To regenerate only manifest.xml.
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-07-05 22:38:14 -04:00
|
|
|
```bash
|
2023-01-02 20:33:57 -05:00
|
|
|
./script/git/fork_project_ERPLibre.py --skip_fork
|
2020-07-05 22:38:14 -04:00
|
|
|
```
|
2020-07-12 15:01:57 -04:00
|
|
|
|
2020-10-05 01:07:37 -04:00
|
|
|
Check if manifest contains "auto_install" and change the value to False.
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-09-03 04:28:43 -04:00
|
|
|
```bash
|
2023-01-02 20:33:57 -05:00
|
|
|
./script/git/repo_remove_auto_install.py
|
2020-09-03 04:28:43 -04:00
|
|
|
```
|
|
|
|
|
|
2021-01-14 23:28:31 -05:00
|
|
|
## Filter repo by group
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-01-14 23:28:31 -05:00
|
|
|
Only keep repo tagged by group 'base' and 'code_generator'
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-01-14 23:28:31 -05:00
|
|
|
```bash
|
2023-01-02 20:33:57 -05:00
|
|
|
./script/manifest/update_manifest_local_dev_code_generator.sh
|
2021-01-14 23:28:31 -05:00
|
|
|
```
|
|
|
|
|
|
2021-01-14 16:26:36 -05:00
|
|
|
# Execution
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-01-14 16:26:36 -05:00
|
|
|
## Config file
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-01-14 16:26:36 -05:00
|
|
|
You can limit your addons in ERPlibre config file depending on a group of your actual manifest.
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-01-14 16:26:36 -05:00
|
|
|
```bash
|
2023-01-02 20:33:57 -05:00
|
|
|
./script/git/git_repo_update_group.py --group base,code_generator
|
2021-07-21 16:20:25 -04:00
|
|
|
./script/generate_config.sh
|
2021-01-14 16:26:36 -05:00
|
|
|
```
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-01-14 16:26:36 -05:00
|
|
|
Or go back to normal
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-01-14 16:26:36 -05:00
|
|
|
```bash
|
2023-01-02 20:33:57 -05:00
|
|
|
./script/git/git_repo_update_group.py
|
2021-07-21 16:20:25 -04:00
|
|
|
./script/generate_config.sh
|
2021-01-14 16:26:36 -05:00
|
|
|
```
|
|
|
|
|
|
2021-08-07 15:51:22 -04:00
|
|
|
# Database
|
|
|
|
|
|
|
|
|
|
## Clean database PostgreSQL
|
|
|
|
|
|
2022-03-03 14:35:23 -05:00
|
|
|
Sometime, it's not possible to delete a database from the database manager `http://127.0.0.1:8069/web/database/manager`,
|
|
|
|
|
so you can do it manually. Replace `database_name` by your database name:
|
2021-08-07 15:51:22 -04:00
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
sudo -iu postgres
|
|
|
|
|
psql
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
And run:
|
|
|
|
|
|
|
|
|
|
```postgres-sql
|
|
|
|
|
DROP DATABASE database_name;
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Exit and delete filestore:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
rm -r ~/.local/share/Odoo/filestore/database_name
|
|
|
|
|
```
|
|
|
|
|
|
2020-07-12 15:01:57 -04:00
|
|
|
# Coding
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-09-30 20:49:35 -04:00
|
|
|
## Create module scaffold
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-07-12 15:01:57 -04:00
|
|
|
```bash
|
2025-05-05 04:43:13 -04:00
|
|
|
source ./.venv.erplibre/bin/activate
|
2020-07-12 15:01:57 -04:00
|
|
|
python odoo/odoo-bin scaffold MODULE_NAME addons/REPO_NAME/
|
|
|
|
|
```
|
2020-09-06 17:30:17 -04:00
|
|
|
|
2022-01-24 14:03:38 -05:00
|
|
|
## Use Code generator
|
|
|
|
|
|
|
|
|
|
Read CODE_GENERATOR.md.
|
|
|
|
|
|
|
|
|
|
# Version
|
|
|
|
|
|
|
|
|
|
Read GIT_REPO.md to understand how changer version.
|
|
|
|
|
|
2022-01-21 02:37:37 -05:00
|
|
|
## Python version
|
|
|
|
|
|
2025-05-05 04:43:13 -04:00
|
|
|
Your actual version is in file .python-odoo-version. Use script `./script/version/change_python_version.sh 3.7.16` to change
|
2022-12-21 02:52:32 -05:00
|
|
|
to version 3.7.16 .
|
2022-01-21 02:37:37 -05:00
|
|
|
|
|
|
|
|
Run the installation, `make install_dev`.
|
|
|
|
|
|
2023-01-02 20:33:57 -05:00
|
|
|
Update poetry, `./script/poetry/poetry_update.py`.
|
2022-01-21 02:37:37 -05:00
|
|
|
|
|
|
|
|
Create docker, `make docker_build`.
|
|
|
|
|
|
2024-08-25 00:45:41 -04:00
|
|
|
### Python version major change
|
|
|
|
|
|
|
|
|
|
When you need to change python 3.7.17 to 3.8.10, do :
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
rm -r .venv
|
|
|
|
|
make install_dev
|
2025-05-05 04:43:13 -04:00
|
|
|
./.venv.$(cat ".erplibre-version" | xargs)/bin/poetry lock --no-update
|
2024-08-25 00:45:41 -04:00
|
|
|
```
|
|
|
|
|
|
2020-09-06 17:30:17 -04:00
|
|
|
# Pull request
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-09-30 20:49:35 -04:00
|
|
|
## Show all pull requests from organization
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-09-06 17:30:17 -04:00
|
|
|
```bash
|
2023-01-02 20:33:57 -05:00
|
|
|
/script/git/pull_request_ERPLibre.py --github_token ### --organization ERPLibre
|
2020-09-06 17:30:17 -04:00
|
|
|
```
|
2020-12-11 03:46:56 -05:00
|
|
|
|
|
|
|
|
# Commit
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-12-11 03:46:56 -05:00
|
|
|
Use this commit format:
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2020-12-11 03:46:56 -05:00
|
|
|
```bash
|
|
|
|
|
git commit -am "[#ticket] subject: short sentence"
|
|
|
|
|
```
|
2021-03-22 04:22:50 -04:00
|
|
|
|
|
|
|
|
# Format code
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-03-22 04:22:50 -04:00
|
|
|
## Python
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-03-22 04:22:50 -04:00
|
|
|
Use [black](https://github.com/psf/black)
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-03-22 04:22:50 -04:00
|
|
|
```bash
|
|
|
|
|
./script/maintenance/black.sh ./addons/TechnoLibre_odoo-code-generator
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Or if you prefer [oca-autopep8](https://github.com/psf/black)
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-03-22 04:22:50 -04:00
|
|
|
```bash
|
|
|
|
|
./script/maintenance/autopep8.sh ./addons/TechnoLibre_odoo-code-generator
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## HTML and css
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-03-22 04:22:50 -04:00
|
|
|
Use [prettier](https://github.com/prettier/prettier)
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-03-22 04:22:50 -04:00
|
|
|
```bash
|
|
|
|
|
./script/maintenance/prettier.sh ./addons/TechnoLibre_odoo-code-generator
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Javascript
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-03-22 04:22:50 -04:00
|
|
|
Use [prettier](https://github.com/prettier/prettier)
|
2021-07-20 20:14:24 -04:00
|
|
|
|
2021-03-22 04:22:50 -04:00
|
|
|
```bash
|
|
|
|
|
./script/maintenance/prettier.sh --tab-width 4 ./addons/TechnoLibre_odoo-code-generator
|
|
|
|
|
```
|
2024-11-25 01:10:01 -05:00
|
|
|
|
|
|
|
|
# Pre-commit
|
|
|
|
|
|
|
|
|
|
You can install pre-commit to auto-format and check lint with OCA configuration. This
|
|
|
|
|
will run before commit with git.
|
|
|
|
|
|
|
|
|
|
Check https://github.com/OCA/maintainer-tools/wiki/Install-pre-commit
|