odoo-fti-be/README.md
2025-06-17 14:11:45 +08:00

2.5 KiB

Odoo FTI Backend Integration

This project is an Express.js backend API service designed to interface with an Odoo ERP system. It provides endpoints for managing and syncing employee and attendance data through XML-RPC.

🚀 Features

  • Connects to Odoo using JSON-RPC (via axios)
  • Environment-based configuration (supports .env.development / .env.production)
  • RESTful API endpoints for:
    • Fetching employee records
    • Logging attendance (check-in/check-out)
  • Modular architecture for scalability and clarityecture: separation of concerns for config, routes, controllers, and models

📁 Project Structure

odoo-fti-be/
│
├── app.js                     # Main entry point
├── package.json              # Project metadata and dependencies
├── config/
│   └── odooConfig.js         # XML-RPC connection configuration
├── controllers/
│   ├── attendanceController.js
│   └── employeeController.js
├── models/
│   ├── odooService.js        # Central Odoo client logic
│   └── odoo/
│       ├── attendance.js     # Attendance-related logic
│       ├── employee.js       # Employee-related logic
│       └── index.js
├── routes/
│   ├── attendanceRoutes.js   # Attendance endpoints
│   └── employeeRoutes.js     # Employee endpoints
└── utils/
    └── date.js               # Date utility for formatting

⚙️ Installation

  1. Clone the repository

    git clone https://github.com/yourusername/odoo-fti-be.git
    cd odoo-fti-be
    
  2. Install dependencies

    npm install
    
  3. Configure Odoo Connection Update config/odooConfig.js with your Odoo server's URL, database, username, and password.

    module.exports = {
        url: "http://your-odoo-host",
        db: "your-db-name",
        username: "your-username",
        password: "your-password",
    };
    

🧪 API Endpoints

👥 Employee

  • GET /employees
    • List all employees from Odoo

⏱️ Attendance

  • POST /attendance/check
    • Check in or checkout employee
    • Body:
      {
          "employee_id": 5
      }
      

🛠️ Technologies Used

  • Node.js with Express.js
  • odoo-xmlrpc for Odoo integration
  • Modular code structure for scalability and maintainability

🧾 License