Skip to main content

A tool to automate Odoo module creation

Project description

Odoo Module Generator (OMG)

Project Overview

The Odoo Module Generator (OMG) is a command-line interface (CLI) tool designed to streamline the initial setup of new Odoo modules. It automates the creation of essential boilerplate files, including Python models, XML views, and security access rules, based on simple command-line arguments. This tool significantly reduces the manual effort and potential for errors when starting new Odoo development projects, allowing developers to focus on core business logic faster.

Features

  • Automated Module Structure: Generates the standard Odoo module directory structure.
  • Python Model Generation: Creates models.py with defined models and fields (Char, Integer, Float, Text, etc.).
  • XML View Generation: Produces views.xml for form, tree, and action views, ready for customization.
  • Security Access Rules: Sets up ir.model.access.csv for basic user permissions.
  • Customizable Metadata: Allows specifying module name, summary, and author.
  • CamelCase Class Names: Automatically converts model names to Odoo-standard CamelCase for Python classes.
  • Clean __init__.py Management: Ensures correct __init__.py files are placed for proper module and package recognition.

Technologies Used

  • Python: The core programming language for the CLI tool.
  • Jinja2: A powerful templating engine used to generate the Odoo module files (Python, XML, CSV).
  • argparse: Python's standard library for parsing command-line arguments.

Installation

You can install OMG directly from PyPI using pip:

pip install omg-cli==0.1.3

Usage

To generate a new Odoo module, run the omg command followed by your desired module name and model definitions.

omg <module_name> --model <ModelName> --fields <field1:Type,field2:Type> [--summary "Module Summary"] [--author "Author Name"]

Arguments:

  • <module_name>: The technical name of your Odoo module (e.g., my_custom_module). This will also be the name of the generated directory.
  • --model <ModelName>: (Required, can be repeated) Defines an Odoo model. The ModelName will be converted to CamelCase for the Python class and snake_case for the _name attribute.
    • Example: --model "Product Item"
  • --fields <field1:Type,field2:Type>: (Optional, applies to the last --model defined) Defines fields for the model.
    • field1: The technical name of the field (e.g., product_code).
    • Type: The Odoo field type (e.g., Char, Integer, Float, Text, Boolean, Date, Datetime).
    • Example: --fields "code:Char,quantity:Integer,notes:Text"
  • --summary "Module Summary": (Optional) A brief description of your module. Defaults to "My Odoo Module".
  • --author "Author Name": (Optional) The author's name for the module manifest. Defaults to "Me".

Examples:

1. Basic Module with One Model and Fields

Generate a module named my_crm with a model Customer and fields name (Char) and email (Char):

omg my_crm --model "Customer" --fields "name:Char,email:Char" --summary "Custom CRM module" --author "John Doe"

2. Module with Multiple Models

Generate a module named project_management with two models: Project and Task.

omg project_management \
    --model "Project" --fields "name:Char,start_date:Date,end_date:Date" \
    --model "Task" --fields "name:Char,description:Text,is_done:Boolean" \
    --summary "Project Management Module"

Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues on the GitHub repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

omg_cli-0.1.3.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

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

omg_cli-0.1.3-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file omg_cli-0.1.3.tar.gz.

File metadata

  • Download URL: omg_cli-0.1.3.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.16

File hashes

Hashes for omg_cli-0.1.3.tar.gz
Algorithm Hash digest
SHA256 27a04cfabaf8ff0ddbf7e0743226f3c58feb95fc88560f177c844d50ddf1def1
MD5 8bca1e9d8f1fb2f65a7379cffce84c7f
BLAKE2b-256 3a1646be64c71f0c8350b6ec520e379b2ea5e3d0e21b5ba2f65828ed88c3371a

See more details on using hashes here.

File details

Details for the file omg_cli-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: omg_cli-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.16

File hashes

Hashes for omg_cli-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cfbd3ea6bdcf3d5f0fb8046d8501e9b68aa00931da4ebfbac4c1fb4bcf077980
MD5 e1b7f3a671e9bdadaeadbd70cfe2c7d0
BLAKE2b-256 8e4538109373b7a7e9e866ecf6fce0471202209acfdeb297b34ba7980dac4332

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