Skip to content

rejamen/odoo_field_trigger_tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Odoo Field Trigger Tree Visualizer

A FastAPI-based web application that visualizes Odoo field dependency trees in a hierarchical graph format. This tool helps Odoo developers understand which fields depend on a given field based on its TriggerTree.

Odoo Field Trigger Tree Visualization D3.js Bootstrap

🏗️ Architecture

The project consists of two main components:

1. FastAPI Backend (main.py)

  • RESTful API endpoints for receiving and serving trigger tree data
  • Static file serving for CSS and frontend assets
  • Jinja2 template rendering for the web interface
  • HTML Template: Single-page application structure
  • D3.js Visualizatio: Interactive graph rendering with zoom/pan capabilities

2. Odoo Integration

  • field_trigger_tree Odoo addon to gather field information and send tree data to FastAPI endpoint.

📋 Prerequisites

  • Python 3.8+
  • Running Odoo system (tested on Odoo version 18.0 and 19.0)

🚀 Installation

1. Clone the Repository

git clone [email protected]:rejamen/odoo_field_trigger_tree.git
cd odoo_field_trigger_tree

2. Create Virtual Environment

python -m venv venv
source venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Install the Odoo addons

Copy the addon form the route odoo_addon/field_trigger_tree, paste it in your Odoo addons path and install it

5. Configure the FastApi path in your Odoo instance

Once the addons is installed, activate the debug mode and search for System Parameters to set the correct IP Address of your PC where FastApi will run.

Change only the IP address, keep the port and the rest of the URL as it is

Odoo System Parameter Configuration

🏃‍♂️ Usage

Start the FastApi Server

uvicorn main:app --reload --host 0.0.0.0 --port 8000

The application will be available at: http://localhost:8000

Sending Data from Odoo

Activate the Debug mode and type fields to access Settings / Technical / Database Structure / Fields.

Select any field, for example the field Name on the res.partner model and click on the button Send Trigger Tree in the header.

Odoo Field Form View

You should received a success message like this one:

Odoo Field Form View

Then open you FastApi app in another Tab in the URL shown in the message and you should see a Graph like this one:

Odoo Field Form View

🎨 Visualization Features

Interactive Elements

  • Zoom & Pan: Navigate large dependency trees
  • Responsive Layout: Adapts to different screen sizes

Visual Encoding

  • 🔴 Red Circles: Source fields (triggers)
  • 🔵 Blue Circles: Relationship fields (intermediates)
  • 🟢 Green Circles: Target fields (affected)
  • Curved Lines: Dependency connections
  • Column Layout: Hierarchical organization

Graph Structure

  1. Source Field: The original field that triggers changes
  2. Direct Dependencies: Fields directly affected by the source
  3. Relationships: Intermediate relationship fields (like partner_id)
  4. Related Fields: Fields affected through relationships

🔧 API Endpoints

Method Endpoint Description
GET / Main visualization interface
POST /receive-trigger-tree Receive trigger tree data from Odoo
GET /api/trigger-tree Get stored trigger tree data

📁 Project Structure

odoo_field_trigger_tree/
├── main.py                 # FastAPI application
├── requirements.txt        # Python dependencies
├── .env                   # Environment variables (optional)
├── .gitignore            # Git ignore rules
├── templates/
│   ├── graph.html        # Main visualization template
│   └── styles.css        # Custom CSS styles
├── odoo_addon/
│   ├── field_trigger_tree  # addon to be installed in Odoo v18 or v19
└── docs             # Images for the README
└── README.md             # This file

🔍 Troubleshooting

Common Issues

1. Connection Refused

  • Ensure FastAPI server is running on port 8000
  • Check firewall settings

2. No Data Displayed

  • Verify trigger tree data was sent from Odoo
  • Check browser console for JavaScript errors
  • Confirm API endpoint returns data

3. Styling Issues

  • Clear browser cache
  • Ensure CSS file is loading correctly
  • Check for Bootstrap conflicts

4. Odoo Integration Issues

  • Verify Odoo dependencies (requests library)
  • Check network connectivity between Odoo and FastAPI
  • Review Odoo logs for error messages

📜 License

This project is open source. Feel free to modify and distribute according to your needs.

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

Final words

This repository is part of my work in aidooit, the space I have created to learn by doing, create and share.

You can see the content I have created on my YouTube channel. If you like it, and want to support my work, please consider subscribing to my channel and sharing the content with others who might find it useful.

You can also Buy me coffee ☕ 🙏

Built with ❤️ for the Odoo developer community

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published