Skip to content

mtpc4s9/odoo-code-extractor

Repository files navigation

Odoo Code Extractor

A full-stack application to extract source code from Odoo 18 addons on GitHub.

Features

  • 🎨 Modern UI - Beautiful dark mode interface with vibrant gradients and smooth animations
  • 📁 Folder Extraction - Extract all files from an Odoo addon folder
  • 📄 Specific Files - Extract specific files by path (supports multiple files)
  • 🔍 Smart Filtering - Automatically filters for relevant files (.py, .csv, .xml, .js, .scss)
  • 📊 Results Table - Display extracted code in a clean, organized table
  • 💾 Export Options - Export results to CSV or JSON format
  • 📈 Statistics - View total files, characters, and lines extracted
  • Verified - Includes test scripts to ensure reliability

Tech Stack

Frontend

  • React 19 with TypeScript
  • Vite for fast development
  • Axios for API calls
  • Lucide React for icons
  • Modern CSS with custom design system

Backend

  • Python 3.9+
  • FastAPI for REST API
  • BeautifulSoup4 for web scraping
  • Requests for HTTP calls
  • Pydantic for data validation

Installation

Frontend Setup

cd odoo-code-extractor
npm install
npm run dev

The frontend will run on http://localhost:5173

Backend Setup

cd backend
pip install -r requirements.txt
uvicorn main:app --reload --port 8000

The backend will run on http://localhost:8000

API documentation available at http://localhost:8000/docs

Testing

To verify the extraction and filtering logic, you can run the included test script:

# Make sure the backend server is running first
python test_filtering.py

This script verifies that only files with allowed extensions (.py, .csv, .xml, .js, .scss) are extracted.

Usage

  1. Start both frontend and backend servers
  2. Open the frontend in your browser
  3. Enter an Odoo addon folder name (e.g., account, sale, stock)
  4. Optionally add specific file paths to extract
  5. Click "Extract Code"
  6. View results in the table
  7. Export to CSV or JSON if needed

Example

Folder Path: account

This will extract all files from the account addon.

File Paths:

  • models/account_move.py
  • __init__.py
  • __manifest__.py

This will extract only the specified files from the account addon.

API Endpoints

POST /api/extract

Extract code from Odoo repository.

Request Body:

{
  "folderPath": "account",
  "filePaths": ["models/account_move.py", "__init__.py"]
}

Response:

{
  "success": true,
  "data": [
    {
      "folderName": "account",
      "path": "/addons/account/models/account_move.py",
      "fileName": "account_move.py",
      "code": "# file content here..."
    }
  ]
}

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors