2020-07-05 22:38:14 -04:00
# Development guide
Setup your environment to develop modules and debug the platform.
2020-09-30 20:49:35 -04:00
## Local installation procedure
2020-07-05 22:38:14 -04:00
### 1. Clone the project:
```bash
git clone https://github.com/ERPLibre/ERPLibre.git
```
### 2. Execute the script:
```bash
cd ERPLibre
./script/install_dev.sh
./script/install_locally_dev.sh
```
### 3. Run ERPLibre
```bash
./run.sh
```
2020-07-06 23:08:05 -04:00
## Develop in Odoo repository
2020-09-30 20:49:35 -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 temporary commit and regenerate with `./script/install_locally_dev.sh`
2020-07-06 23:08:05 -04:00
2020-09-30 20:49:35 -04:00
## Fork project to create a new project independent from ERPLibre (deprecated)
2020-07-05 22:38:14 -04:00
ERPLibre was created by 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.
```bash
2020-07-11 05:12:47 -04:00
./script/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
Go to your github account and generate a token to access fork option with your user. Create an organization or use your personal account can choose your user name.
2020-07-05 22:38:14 -04:00
This command will fork all repos and ERPLibre to your own organization. It keeps track to ERPLibre.
```bash
2020-07-11 05:12:47 -04:00
./script/fork_project_ERPLibre.py --github_token GITHUB_KEY --organization NAME
2020-07-05 22:38:14 -04:00
```
## Generate manifest from csv repo
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
2020-07-05 22:38:14 -04:00
```bash
2020-07-11 05:12:47 -04:00
./script/fork_project_ERPLibre.py --skip_fork
2020-07-05 22:38:14 -04:00
```
## Move database prod to dev
2020-09-30 20:49:35 -04:00
When moving database prod to your dev environment, you want to remove email servers and install user test in order to test the database.
2020-07-05 22:38:14 -04:00
Run:
```bash
./run.sh --stop-after-init -i user_test,disable_mail_server --dev all -d DATABASE
```
## Change git url https to git
This will update all urls in git format:
```bash
2020-07-11 05:12:47 -04:00
./script/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
2020-07-05 22:38:14 -04:00
Tools to display the differences between the repo and another project.
```bash
2020-07-11 05:12:47 -04:00
./script/git_change_remote.py --sync_to /path/to/project/erplibre --dry_sync
2020-07-05 22:38:14 -04:00
```
## Sync repo with another project
2020-09-30 20:49:35 -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
2020-07-11 05:12:47 -04:00
./script/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
To show differences between commits in different manifests
2020-07-11 21:13:44 -04:00
```bash
./script/git_diff_repo_manifest.py --input1 ./manifest/MANIFEST1.xml --input2 ./manifest/MANIFEST2.xml
```
2020-09-30 20:49:35 -04:00
## Differences between code and manifest
To show differences between actual code and manifest
2020-09-03 04:28:43 -04:00
```bash
2020-09-30 20:49:35 -04:00
./script/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
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:
```bash
2020-07-11 05:12:47 -04:00
./script/fork_project_ERPLibre.py
2020-07-05 22:38:14 -04:00
```
To regenerate only manifest.xml.
```bash
2020-07-11 05:12:47 -04:00
./script/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.
2020-09-03 04:28:43 -04:00
```bash
./script/repo_remove_auto_install.py
```
2021-01-14 23:28:31 -05:00
## Filter repo by group
Only keep repo tagged by group 'base' and 'code_generator'
```bash
./script/update_manifest_local_dev_code_generator.sh
```
2021-01-14 16:26:36 -05:00
# Execution
## Config file
You can limit your addons in ERPlibre config file depending on a group of your actual manifest.
```bash
./script/git_repo_update_group.py --group base,code_generator
./script/install_locally.sh
```
Or go back to normal
```bash
./script/git_repo_update_group.py
./script/install_locally.sh
```
2020-07-12 15:01:57 -04:00
# Coding
2020-09-30 20:49:35 -04:00
## Create module scaffold
2020-07-12 15:01:57 -04:00
```bash
2020-07-24 02:20:30 -04:00
source ./.venv/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
# Pull request
2020-09-30 20:49:35 -04:00
## Show all pull requests from organization
2020-09-06 17:30:17 -04:00
```bash
/script/pull_request_ERPLibre.py --github_token ### --organization ERPLibre
```
2020-12-11 03:46:56 -05:00
# Commit
Use this commit format:
```bash
git commit -am "[#ticket] subject: short sentence"
```