# 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** ```bash git clone https://github.com/yourusername/odoo-fti-be.git cd odoo-fti-be ``` 2. **Install dependencies** ```bash npm install ``` 3. **Configure Odoo Connection** Update `config/odooConfig.js` with your Odoo server's URL, database, username, and password. ```js 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: ```json { "employee_id": 5 } ``` ## ๐Ÿ› ๏ธ Technologies Used - **Node.js** with **Express.js** - **odoo-xmlrpc** for Odoo integration - Modular code structure for scalability and maintainability --- ## ๐Ÿงพ License