Skip to main content

Small CLI tool for Odoo

Project description

odoo-tools-grap

License: AGPL v3

PyPI - Python Version PyPI - Downloads GitLab last commit GitLab stars

This tools provide extra cli commands to simplify recurring operations for Odoo developers.

  • To develop and contribute to the library, refer to the DEVELOP.md file.
  • Refer to the ROADMAP.md file to see the current limitation, bugs, and task to do.
  • See authors in the CONTRIBUTORS.md file.

Table of Contents

Installation

The library is available on PyPI.

To install it simply run :

pipx install odoo-tools-grap

(See alternative installation in DEVELOP.md file.)

Usage

Note:

The term odoo-tools-grap can be replaced by otg in all the command lines below.

Command: diff (View repositories status)

Based on a repos config file (repos.yml file, used by gitaggregate by exemple), this script will display the result of the git diff for each repository.

odoo-tools-grap diff --config repos.yml

Result Sample

2024-03-27 16:37:24.725 | WARNING  | odoo_tools_grap.cli.cli_diff:diff:31 - [BAD BRANCH] ./src/OCA/product-attribute is on 16.0-product_pricelist_simulation-various-fixes.(Should be on 16.0-current)
2024-03-27 16:37:25.395 | WARNING  | odoo_tools_grap.cli.cli_diff:diff:38 - [LOCAL CHANGES] ./src/OCA/sale-workflow has 1 local changes.
2024-03-27 16:37:25.444 | WARNING  | odoo_tools_grap.cli.cli_diff:diff:43 - [UNTRACKED] ./src/OCA/sale-workflow has 2 untracked files.

Command: generate (Generate Odoo config File)

Base on a repos config file, (repos.yml file, used by gitaggregate by exemple), and template(s) of odoo config file, this script will generate a complete config file for Odoo with addons_path depending on the repos config file.

odoo-tools-grap generate\
    --config repos.yml\
    --input-files ./template.config.cfg\
    --output-file ./odoo.cfg

Command: create-branch (Create new Orphan Branch)

This command will:

  • create a new orphan target version
  • add a copier-answers.yml file base on the previous copier answers in the initial version and commit it
  • Adapt copier answers to new GRAP conventions
  • Ask for copier answers. (At this step, answer default value to all questions)
  • Run pre-commit
  • Push the new branch on github

Before using this command, clone your repo in the previous existing branch. for exemple:

git clone git@github.com:grap/grap-odoo-custom --origin=grap --branch 12.0
cd grap-odoo-custom

Example:

odoo-tools-grap create-branch\
    --initial-version 12.0\
    --target-version 16.0\
    --remote grap\
    --copier-url https://github.com/grap/oca-addons-repo-template-v16

Command: migrate (Migrate module from a version to another)

This command will:

  • Pull the last commits of the initial version
  • Pull the last commits of the target version
  • Create a new branch named for the module to migrate
  • Cherry pick commits of the module to migrate. See OCA Documentation
  • Eventually merge neighboring commits. (if the commit contains --fixup, or have the same name)
  • Run pre-commit and commit changes
  • Call odoo-module-migrate
  • (At this step, please note warning and error that should be fixed in a second step)
  • Commit changes
  • Push the new branch on github
  • Create a new draft Pull Request

Before using this command:

  • you should be in the folder of the repository. (created with create-branch command.)
  • having added your personal remote with git remote add YOUR-GITHUB-ACCOUNT git@github.com:YOUR-GITHUB-ACCOUNT/grap-odoo-custom
odoo-tools-grap migrate\
    --initial-version 12.0\
    --target-version 16.0\
    --modules grap_cooperative\
    --distant-remote grap\
    --local-remote YOUR-GITHUB-ACCOUNT\
    --github-token-file ABSOLUTE-PATH-TO-A-FILE-THAT-CONTAINS-GITHUB-TOKEN

Command: rebase (Rebase all branches of a repos.yml file)

This command will:

  • rebase each branch defined in the repos.yml file.
  • push the rebased branch on github.
odoo-tools-grap rebase\
    --config-repo-file ./repos.yml\
    --version 16.0\
    --remotes grap --remotes legalsylvain\
    --github-token-file ABSOLUTE-PATH-TO-A-FILE-THAT-CONTAINS-GITHUB-TOKEN

Prerequites

To understand this tool:

Credits

Authors

Contributors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

odoo_tools_grap-1.3.7.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

odoo_tools_grap-1.3.7-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file odoo_tools_grap-1.3.7.tar.gz.

File metadata

  • Download URL: odoo_tools_grap-1.3.7.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.14.0-33-generic

File hashes

Hashes for odoo_tools_grap-1.3.7.tar.gz
Algorithm Hash digest
SHA256 4c487d144c33c9f20f5b45beb28f436149e60ae30a556bff7bb000667dc6ada4
MD5 27d860a5466cf910b3c9019fecc4293c
BLAKE2b-256 a497ae5e31e2470eb0e0f60dc89227b6d0de3d5055aeb7a025cbe85bdba373f3

See more details on using hashes here.

File details

Details for the file odoo_tools_grap-1.3.7-py3-none-any.whl.

File metadata

  • Download URL: odoo_tools_grap-1.3.7-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.14.0-33-generic

File hashes

Hashes for odoo_tools_grap-1.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 0e42eac325ba544bfdf3bfc18fe55115bb97a527ba47a0032c111e06fa300de3
MD5 543162885267e05d8310900f3312f9e0
BLAKE2b-256 2fc3c64202b008df58bf23dd9ce2af952d06df09dd386f8fc4d55a0327a54bb6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page