Skip to content

ABDO-ADELL/Mini-Erp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Mini ERP System

A Django-based Enterprise Resource Planning (ERP) system for managing products, customers, sales orders, and inventory tracking.

Developer: Abdelrahman Adel
GitHub: github.com/ABDO-ADELL


πŸ“‹ Features

Core Modules

  • Product Management - Create, view, update, and delete products with stock tracking
  • Customer Management - Maintain customer database with contact information
  • Sales Orders - Process orders with automatic stock reduction
  • Inventory Tracking - Comprehensive stock movement logging
  • Dashboard - Real-time metrics and low stock alerts

Additional Features

  • Role-Based Access Control - Admin and Sales User roles with different permissions
  • Excel Export - Export orders to Excel spreadsheets
  • Stock Movement Audit Trail - Track every inventory change
  • Responsive UI - Bootstrap 5 interface that works on all devices
  • Search & Filters - Find records quickly across all modules

πŸ› οΈ Technology Stack

  • Backend: Django 5.0
  • Database: SQLite
  • Frontend: Bootstrap 5.3, HTML5, CSS3
  • Additional: Django REST Framework, Pillow (image handling), openpyxl (Excel export)

πŸ“¦ Installation

Prerequisites

  • Python 3.10 or higher
  • pip (Python package manager)
  • Virtual environment (recommended)

Setup Steps

  1. Clone the repository

    git clone https://github.com/ABDO-ADELL/mini-erp-system.git
    cd mini-erp-system
  2. Create and activate virtual environment

    # Windows
    python -m venv venv
    venv\Scripts\activate
    
    # Mac/Linux
    python3 -m venv venv
    source venv/bin/activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Run migrations

    python manage.py migrate
  5. Setup initial data and user accounts

    python manage.py setup_erp
  6. Start the development server

    python manage.py runserver
  7. Access the application

    • Open your browser and go to: http://127.0.0.1:8000

πŸ‘₯ Default User Accounts

After running setup_erp, use these credentials to login:

Role Username Password Permissions
Admin admin admin123 Full system access
Sales User sales sales123 Create orders & customers, view products

🎯 User Roles & Permissions

Admin Role

  • βœ… Full CRUD access to all modules
  • βœ… Manage products (create, edit, delete)
  • βœ… Edit customer information
  • βœ… View stock movement logs
  • βœ… Access admin panel

Sales User Role

  • βœ… Create sales orders
  • βœ… Add new customers (cannot edit after creation)
  • βœ… View products (read-only)
  • ❌ Cannot modify product inventory
  • ❌ Cannot edit customers
  • ❌ Cannot access admin panel

πŸ“‚ Project Structure

mini_erp/
β”œβ”€β”€ core/               # Authentication & user management
β”œβ”€β”€ products/           # Product catalog & inventory
β”œβ”€β”€ customers/          # Customer database
β”œβ”€β”€ orders/             # Sales order processing
β”œβ”€β”€ inventory/          # Stock movement tracking
β”œβ”€β”€ dashboard/          # Dashboard & metrics
β”œβ”€β”€ templates/          # HTML templates
β”œβ”€β”€ static/             # CSS, JS, images
β”œβ”€β”€ media/              # Uploaded files (product images)
β”œβ”€β”€ manage.py           # Django management script
└── requirements.txt    # Python dependencies

πŸ”„ Business Logic

Order Workflow

  1. Create Order - Sales user selects customer and products
  2. Validation - System checks stock availability
  3. Confirmation - Admin confirms order
    • Stock quantities automatically reduced
    • Stock movement record created
  4. Cancellation - If needed, order can be cancelled
    • Stock automatically returned
    • Return movement logged

Stock Management

  • Every stock change is logged with:
    • Product details
    • Quantity changed
    • Movement type (sale, return, adjustment)
    • User who performed action
    • Timestamp
    • Related order (if applicable)

πŸ“Š Sample Data

The setup_erp command creates sample data:

  • 5 Products - Electronics and furniture items
  • 3 Customers - Demo business accounts
  • User Groups - Admin and Sales User with proper permissions

πŸ§ͺ Testing the System

Test Scenario 1: Create an Order (Sales User)

  1. Login as sales / sales123
  2. Navigate to Orders β†’ Create New Order
  3. Select customer and add products
  4. Submit order (status: Pending)
  5. Verify stock validation works

Test Scenario 2: Confirm Order (Admin)

  1. Login as admin / admin123
  2. View the pending order
  3. Click "Confirm Order"
  4. Verify stock quantity decreased
  5. Check Stock Movements for audit trail

Test Scenario 3: Export to Excel

  1. Login as admin
  2. Go to Orders list
  3. Click "Export Excel" button
  4. Verify Excel file downloads with order data

Test Scenario 4: Sales User Restrictions

  1. Login as sales / sales123
  2. Try to edit a customer β†’ Should see error message
  3. Try to edit a product β†’ Should not see edit option
  4. Try to access stock movements β†’ Should be blocked

πŸš€ Production Deployment

Important: Before deploying to production:

  1. Update settings.py:

    DEBUG = False
    SECRET_KEY = os.environ.get('SECRET_KEY')
    ALLOWED_HOSTS = ['yourdomain.com']
  2. Configure static files:

    python manage.py collectstatic
  3. Use a production database (PostgreSQL recommended)

  4. Remove test credentials from templates

  5. Set up proper logging


πŸ› Troubleshooting

Issue: "No module named openpyxl"

Solution:

pip install openpyxl==3.1.2

Issue: Migrations error

Solution:

python manage.py migrate --run-syncdb

Issue: Static files not loading

Solution:

python manage.py collectstatic --noinput

Issue: Permission denied errors

Solution:

# Reset database and permissions
rm db.sqlite3
python manage.py migrate
python manage.py setup_erp

πŸ“ API Endpoints

Endpoint Method Description
/admin/ GET Django admin panel
/ GET Dashboard home
/products/ GET Product list
/customers/ GET Customer list
/orders/ GET Orders list
/orders/create/ POST Create new order
/orders/export-excel/ GET Export orders to Excel
/inventory/movements/ GET Stock movement log

πŸ” Security Notes

  • This is a learning project with basic security measures
  • Default credentials are for development only
  • Change all passwords before production use
  • Keep SECRET_KEY in environment variables
  • Use HTTPS in production
  • Implement rate limiting for production APIs

🀝 Contributing

This is a learning project, but suggestions and feedback are welcome!

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

πŸ“§ Contact

Abdelrahman Adel
GitHub: @ABDO-ADELL

πŸ™ Acknowledgments

  • Built with Django framework
  • UI components from Bootstrap 5
  • Icons from Bootstrap Icons

Last Updated: December 2025
Version: 1.0.0

About

Mini erp system using django

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published