3.8 KiB
Tada to Odoo 19 Migration Portal
A lightweight, modern web application built with Python (Flask) that streamlines the process of migrating member/customer data from a PostgreSQL database (tada_member) directly into an Odoo 19 instance via XML-RPC.
🚀 Features
- Direct Odoo Integration: Seamlessly creates
res.partnerandloyalty.cardrecords in Odoo 19. - Data Mapping Automation: Automatically maps database fields (including custom fields like
gender,birth_date, andtotal_spend) and dynamically links the appropriateloyalty.programbased on the user's membership level. - High-Performance DataTables: Uses Server-Side Processing for pagination, sorting, and debounced searching. This ensures the UI remains lightning-fast, even with hundreds of thousands of records.
- Beautiful & Modern UI: Features a clean, responsive "Glassmorphism" light theme optimized for both Desktop and Mobile environments.
- Secure Sessions: Employee logins are secured with an 8-hour session lifetime mechanism.
- Interactive Prompts: Integrated with SweetAlert2 to prevent accidental migrations and to provide clean success/error feedback.
🛠️ Tech Stack
- Backend: Python 3, Flask, Flask-Session
- Database Connection:
psycopg2-binary(PostgreSQL) - Odoo Integration:
xmlrpc.client(Odoo XML-RPC API) - Frontend: HTML5, CSS3, Vanilla JavaScript, jQuery, DataTables, SweetAlert2
📦 Installation & Setup
-
Clone or Extract the Repository Ensure you are in the project root directory.
-
Create a Virtual Environment (Optional but Recommended)
python -m venv venv # On Windows: venv\Scripts\activate # On macOS/Linux: source venv/bin/activate -
Install Dependencies Install the required Python packages using pip:
pip install -r requirements.txt -
Configure Credentials Open
app.pyin your text editor and locate the Configurations section at the top of the file. Update the placeholders with your actual PostgreSQL and Odoo 19 credentials:# PostgreSQL DB_HOST = "localhost" DB_PORT = "5432" DB_NAME = "your_postgres_db" DB_USER = "your_postgres_user" DB_PASS = "your_postgres_password" # Odoo 19 ODOO_URL = "localhost" ODOO_DB = "odoo19" ODOO_USER = "admin" ODOO_PASS = "admin" -
Run the Application
python app.pyThe application will start a local development server. Open your web browser and navigate to:
http://localhost:5000
🔄 Data Mapping Reference
When a migration is triggered, the following mapping occurs:
1. res.partner (Customer Profile)
PostgreSQL (tada_member) |
Odoo 19 (res.partner) |
Notes |
|---|---|---|
name |
name |
|
phone_number |
phone |
|
email |
email |
|
gender |
gender |
Capitalized automatically (e.g., female -> Female) |
birthday |
birth_date |
Converted to string format |
city |
city |
|
total_spending |
total_spend |
Converted to Float |
level |
membership_level_id |
Linked via loyalty.program search (Many2one) |
2. loyalty.card (Membership Card)
PostgreSQL (tada_member) |
Odoo 19 (loyalty.card) |
Notes |
|---|---|---|
point_amount |
points |
Converted to Float |
| (Generated) | partner_id |
Linked to the newly created res.partner ID |
| (Generated) | program_id |
Linked to the matched loyalty.program ID |
🛡️ Important Notes
- Data Validation: The script automatically handles
NULL/Nonevalues from PostgreSQL, safely converting them toFalseto prevent XML-RPC marshal errors when writing to Odoo. - Debounce Optimization: The search bar waits 400ms after you stop typing and requires a minimum of 3 characters before querying the database, drastically reducing server load.