erplibre/doc/DEVELOPMENT.md
Mathieu Benoit b4ca616104 [ADD] script: tag push all
- git can push all tags with different organization from manifest
- Add documentation git repo before clean all repo manifest
2021-07-16 00:56:30 -04:00

4.8 KiB

Development guide

Setup your environment to develop modules and debug the platform.

Local installation procedure

1. Clone the project:

git clone https://github.com/ERPLibre/ERPLibre.git

2. Execute the script:

cd ERPLibre
./script/install_dev.sh
./script/install_locally_dev.sh

3. Run ERPLibre

./run.sh

Develop in Odoo repository

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

Fork project to create a new project independent from ERPLibre (deprecated)

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.

./script/fork_project.py --github_token GITHUB_KEY --organization NAME

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.

This command will fork all repos and ERPLibre to your own organization. It keeps track to ERPLibre.

./script/fork_project_ERPLibre.py --github_token GITHUB_KEY --organization NAME

Generate manifest from csv repo

Add repo in file ./source_repo_addons.csv

Execute to generate Repo manifest

./script/fork_project_ERPLibre.py --skip_fork

Move database prod to dev

When moving database prod to your dev environment, you want to remove email servers and install user test in order to test the database. Run:

./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:

./script/git_change_remote_https_to_git.py

Showing repo differences between projects

Tools to display the differences between the repo and another project.

./script/git_change_remote.py --sync_to /path/to/project/erplibre --dry_sync

Showing repo differences with manifest develop

To understand the divergence with the dev manifest.

./script/git_show_code_diff_repo_manifest.py -m ./manifest/default.dev.xml

Sync repo with another project

Tools to synchronise the repo with another project. This will show differences and try to checkout on the same commit in all repos.

./script/git_change_remote.py --sync_to /path/to/project/erplibre

Compare two files manifests

To show differences between commits in different manifests

./script/git_diff_repo_manifest.py --input1 ./manifest/MANIFEST1.xml --input2 ./manifest/MANIFEST2.xml

Differences between code and manifest

To show differences between actual code and manifest

./script/git_show_code_diff_repo_manifest.py --manifest ./manifest/MANIFEST1.xml

Add repo

To access a new repo, add your URL to file source_repo_addons.csv

Fork the repo to be able to push new code:

./script/fork_project_ERPLibre.py

To regenerate only manifest.xml.

./script/fork_project_ERPLibre.py --skip_fork

Check if manifest contains "auto_install" and change the value to False.

./script/repo_remove_auto_install.py

Filter repo by group

Only keep repo tagged by group 'base' and 'code_generator'

./script/update_manifest_local_dev_code_generator.sh

Execution

Config file

You can limit your addons in ERPlibre config file depending on a group of your actual manifest.

./script/git_repo_update_group.py --group base,code_generator
./script/install_locally.sh

Or go back to normal

./script/git_repo_update_group.py
./script/install_locally.sh

Coding

Create module scaffold

source ./.venv/bin/activate
python odoo/odoo-bin scaffold MODULE_NAME addons/REPO_NAME/

Pull request

Show all pull requests from organization

/script/pull_request_ERPLibre.py --github_token ### --organization ERPLibre

Commit

Use this commit format:

git commit -am "[#ticket] subject: short sentence"

Format code

Python

Use black

./script/maintenance/black.sh ./addons/TechnoLibre_odoo-code-generator

Or if you prefer oca-autopep8

./script/maintenance/autopep8.sh ./addons/TechnoLibre_odoo-code-generator

HTML and css

Use prettier

./script/maintenance/prettier.sh ./addons/TechnoLibre_odoo-code-generator

Javascript

Use prettier

./script/maintenance/prettier.sh --tab-width 4 ./addons/TechnoLibre_odoo-code-generator