Skip to content

A modern, multi-tenant SaaS platform built with Flutter that provides a beautiful mobile interface for Odoo Community Edition

License

Notifications You must be signed in to change notification settings

Ricoamal/odoo-saas-flutter

🚀 Odoo SaaS - Flutter Application

A modern, multi-tenant SaaS platform built with Flutter that provides a beautiful mobile interface for Odoo Community Edition. This application enables businesses to offer Odoo ERP as a service with role-based access control and a polished user experience.

📋 Table of Contents

🎯 Overview

Odoo SaaS is a Flutter-based mobile application that transforms Odoo Community Edition into a modern SaaS platform. It provides:

  • Multi-tenant Architecture: Support for multiple organizations with isolated data
  • Role-based Access Control: Three distinct user roles (Owner, Provider, Tenant)
  • Modern UI/UX: Polished interface with theme customization
  • Real-time Updates: Live data synchronization
  • Cross-platform: Works on Android, iOS, and Web

✨ Features

🔐 Authentication & Authorization

  • Secure login with email/password
  • JWT token-based authentication
  • Role-based access control (Owner, Provider, Tenant)
  • Session management with auto-refresh
  • Biometric authentication support

🎨 User Interface

  • Modern Design: Clean, professional interface
  • Theme System: Customizable colors, fonts, and styling
  • Responsive Layout: Adapts to different screen sizes
  • Dark/Light Mode: Automatic theme switching
  • Quick Actions: Circular action buttons with animations

📊 Dashboard & Analytics

  • Role-specific Dashboards: Different views for each user type
  • Real-time Statistics: Live data updates
  • Interactive Charts: Visual data representation
  • Performance Metrics: Key business indicators

🏢 Multi-tenant Features

  • Tenant Isolation: Secure data separation
  • Subscription Management: Plan-based access control
  • Resource Limits: User and storage quotas
  • Billing Integration: Payment processing

📱 Mobile-First Design

  • Offline Support: Basic functionality without internet
  • Push Notifications: Real-time alerts
  • File Upload: Document and image management
  • Search & Filter: Advanced data filtering

🏗️ Architecture

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   Flutter App   │────│   Odoo Server   │────│   PostgreSQL    │
│   (Frontend)    │    │   (Backend)     │    │   (Database)    │
│                 │    │                 │    │                 │
│ • UI Components │    │ • Multi-tenancy │    │ • Data Storage  │
│ • State Mgmt    │    │ • API Endpoints │    │ • User Data     │
│ • Navigation    │    │ • Business Logic│   │ • CRM Data      │
│ • Theme System  │    │ • Auth System   │    │ • Analytics     │
└─────────────────┘    └─────────────────┘    └─────────────────┘

Technology Stack

Frontend:

  • Framework: Flutter 3.x
  • State Management: Riverpod
  • Navigation: GoRouter
  • HTTP Client: Dio
  • Storage: Flutter Secure Storage
  • UI Components: Custom widgets

Backend:

  • ERP System: Odoo Community Edition 16.0+
  • Database: PostgreSQL 12+
  • Web Server: Nginx
  • Authentication: JWT tokens
  • API: JSON-RPC

📸 Screenshots

Authentication

Login Screen Registration

Dashboards

Owner Dashboard Provider Dashboard Tenant Dashboard

Management Screens

User Management Provider Management CRM Screen

🚀 Getting Started

Prerequisites

  • Flutter SDK: 3.0.0 or higher
  • Dart SDK: 2.17.0 or higher
  • Android Studio / VS Code
  • Git
  • Odoo Server: Community Edition 16.0+

System Requirements

  • Android: API level 21+ (Android 5.0+)
  • iOS: iOS 11.0+
  • Web: Modern browsers (Chrome, Firefox, Safari, Edge)

📦 Installation

1. Clone the Repository

git clone https://github.com/your-username/odoo-saas-flutter.git
cd odoo-saas-flutter

2. Install Dependencies

flutter pub get

3. Configure Environment

Copy the example configuration file:

cp lib/core/config/app_config.example.dart lib/core/config/app_config.dart

Update the configuration with your Odoo server details:

class AppConfig {
  // Odoo Configuration
  static const String odooBaseUrl = 'https://your-odoo-domain.com';
  static const String defaultDatabase = 'odoo_main';
  
  // Feature Flags
  static const bool enableMultiTenancy = true;
  static const bool enableRealTimeUpdates = true;
}

4. Run the Application

# Development mode
flutter run

# Production build
flutter build apk --release

⚙️ Configuration

Environment Setup

Create environment-specific configuration files:

// lib/core/config/app_config.dart
class AppConfig {
  static const String environment = 'development'; // 'development', 'staging', 'production'
  
  // Development
  static const String devBaseUrl = 'http://localhost:8069';
  
  // Staging
  static const String stagingBaseUrl = 'https://staging.odoo-saas.com';
  
  // Production
  static const String prodBaseUrl = 'https://odoo-saas.com';
  
  static String get baseUrl {
    switch (environment) {
      case 'development':
        return devBaseUrl;
      case 'staging':
        return stagingBaseUrl;
      case 'production':
        return prodBaseUrl;
      default:
        return devBaseUrl;
    }
  }
}

Theme Configuration

Customize the application theme:

// lib/core/theme/app_theme.dart
class AppTheme {
  static const Color primaryColor = Color(0xFF6366F1);
  static const Color accentColor = Color(0xFFEC4899);
  static const Color successColor = Color(0xFF00D4AA);
  static const Color errorColor = Color(0xFFFF1744);
  
  // Customize border radius, elevation, etc.
  static const double defaultBorderRadius = 12.0;
  static const double defaultElevation = 4.0;
}

🛠️ Development

Project Structure

lib/
├── core/
│   ├── config/           # Configuration files
│   ├── models/           # Data models
│   ├── providers/        # Riverpod providers
│   ├── services/         # API services
│   └── theme/            # Theme configuration
├── features/
│   ├── admin/            # Admin/Owner features
│   ├── auth/             # Authentication
│   ├── customer/         # Tenant features
│   └── provider/         # Provider features
├── shared/
│   ├── presentation/
│   │   └── widgets/      # Shared UI components
│   └── utils/            # Utility functions
└── main.dart             # Application entry point

Code Style

We follow the official Dart style guide:

# Format code
dart format lib/

# Analyze code
flutter analyze

# Run tests
flutter test

State Management

We use Riverpod for state management:

// Example provider
final userProvider = StateNotifierProvider<UserNotifier, User?>((ref) {
  return UserNotifier(ref.read(apiServiceProvider));
});

class UserNotifier extends StateNotifier<User?> {
  UserNotifier(this._apiService) : super(null);
  
  final ApiService _apiService;
  
  Future<void> login(String email, String password) async {
    // Implementation
  }
}

Adding New Features

  1. Create Feature Directory:

    lib/features/new_feature/
    ├── presentation/
    │   ├── screens/
    │   └── widgets/
    ├── domain/
    │   ├── models/
    │   └── repositories/
    └── data/
        └── datasources/
    
  2. Add Routes:

    // lib/core/router/app_router.dart
    GoRoute(
      path: '/new-feature',
      builder: (context, state) => const NewFeatureScreen(),
    ),
  3. Update Navigation:

    // Add to navigation menu
    NavigationItem(
      icon: Icons.new_feature,
      label: 'New Feature',
      route: '/new-feature',
    ),

🚀 Deployment

Odoo Server Setup

  1. Install Odoo Community Edition:

    # Use our setup script
    wget https://raw.githubusercontent.com/your-repo/setup_odoo.sh
    chmod +x setup_odoo.sh
    ./setup_odoo.sh
  2. Configure Multi-tenancy:

    # Install custom modules
    # Configure database per tenant
    # Set up API endpoints

Flutter App Deployment

  1. Build for Production:

    # Android APK
    flutter build apk --release
    
    # iOS IPA
    flutter build ios --release
    
    # Web
    flutter build web --release
  2. Deploy to Stores:

    • Google Play Store: Upload APK
    • Apple App Store: Upload IPA
    • Web: Deploy to hosting service

CI/CD Pipeline

# .github/workflows/ci.yml
name: CI/CD Pipeline

on:
  push:
    branches: [main, develop]
  pull_request:
    branches: [main]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: subosito/flutter-action@v2
      - run: flutter pub get
      - run: flutter test
      - run: flutter analyze

  build:
    needs: test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: subosito/flutter-action@v2
      - run: flutter build apk --release
      - run: flutter build web --release

📚 API Documentation

Authentication Endpoints

// Login
POST /web/session/authenticate
{
  "jsonrpc": "2.0",
  "method": "call",
  "params": {
    "db": "tenant_database",
    "login": "user@email.com",
    "password": "password"
  }
}

// Response
{
  "jsonrpc": "2.0",
  "id": null,
  "result": {
    "uid": 1,
    "user_context": {...},
    "session_id": "session_token"
  }
}

Data Operations

// Search records
POST /web/dataset/search_read
{
  "jsonrpc": "2.0",
  "method": "call",
  "params": {
    "model": "crm.lead",
    "domain": [],
    "fields": ["name", "email_from", "phone"],
    "limit": 100
  }
}

// Create record
POST /web/dataset/call_kw
{
  "jsonrpc": "2.0",
  "method": "call",
  "params": {
    "model": "crm.lead",
    "method": "create",
    "args": [{"name": "New Lead", "email_from": "lead@example.com"}]
  }
}

Error Handling

try {
  final response = await apiService.createLead(leadData);
  // Handle success
} on ApiException catch (e) {
  // Handle API errors
  showErrorSnackBar(e.message);
} catch (e) {
  // Handle other errors
  showErrorSnackBar('An unexpected error occurred');
}

🤝 Contributing

We welcome contributions! Please follow these guidelines:

Development Workflow

  1. Fork the repository
  2. Create a feature branch:
    git checkout -b feature/amazing-feature
  3. Make your changes
  4. Write tests for new functionality
  5. Update documentation if needed
  6. Commit your changes:
    git commit -m 'Add amazing feature'
  7. Push to the branch:
    git push origin feature/amazing-feature
  8. Open a Pull Request

Code Standards

  • Follow Dart/Flutter style guidelines
  • Write meaningful commit messages
  • Add tests for new features
  • Update documentation
  • Use conventional commits format

Pull Request Template

## Description
Brief description of changes

## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update

## Testing
- [ ] Unit tests pass
- [ ] Integration tests pass
- [ ] Manual testing completed

## Screenshots (if applicable)
Add screenshots for UI changes

## Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] No breaking changes

📝 Changelog

[1.0.0] - 2024-01-XX

Added

  • Initial release
  • Multi-tenant authentication
  • Role-based dashboards
  • Theme customization system
  • CRM, Sales, and Accounting modules
  • Real-time data synchronization
  • Push notifications
  • Offline support

Changed

  • N/A

Fixed

  • N/A

Removed

  • N/A

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🆘 Support

Documentation

Community

Issues

Contact

🙏 Acknowledgments


Made by MICT Labs www.odoo.co.ke

This project is actively maintained and updated regularly. For the latest updates, please check our releases page.

About

A modern, multi-tenant SaaS platform built with Flutter that provides a beautiful mobile interface for Odoo Community Edition

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages