Welcome to Set Invoice, a comprehensive Django-based invoice management system. This guide will help you set up, configure, and use the platform effectively.
- Quick Start
- Installation
- Initial Setup
- User Roles & Permissions
- Core Features
- Common Workflows
- Troubleshooting
- Security Best Practices
- Python 3.10 or higher
- Node.js (for TailwindCSS)
- pip and virtualenv
- Git (optional)
# 1. Clone or download the project
git clone https://github.com/Systemsetco/SetInvoice-InvoiceManagementSystem.git
cd invoice_management_system
# 2. Create virtual environment
python -m venv venv
# Windows
venv\Scripts\activate
# Linux/Mac
source venv/bin/activate
# 3. Install dependencies
pip install -r requirements.txt
npm install -D tailwindcss
# 4. Configure environment
cp .env.example .env
# Edit .env with your settings (see Configuration section)
# 5. Setup database
python manage.py migrate
# 6. Create admin user
python manage.py createsuperuser
# 7. Build TailwindCSS (in a separate terminal)
npx tailwindcss -i ./static/css/input.css -o ./static/css/output.css --watch
# 8. Run the server
python manage.py runserverVisit: http://127.0.0.1:8000
Create and activate a virtual environment:
python -m venv venv
# Windows
venv\Scripts\activate
# Linux/Mac
source venv/bin/activatepip install -r requirements.txtRequired packages:
- Django 5.2.8
- django-jinja
- python-dotenv
- xhtml2pdf (for PDF generation)
- argon2-cffi (optional, for enhanced password security)
npm install -D tailwindcssCopy the example environment file:
cp .env.example .envEdit .env with your configuration:
# Security Settings
SECRET_KEY=your-unique-secret-key-here
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1
# Email Configuration (for password reset and notifications)
EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend
# For production with Gmail:
# EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
# EMAIL_HOST=smtp.gmail.com
# EMAIL_PORT=587
# EMAIL_USE_TLS=True
# EMAIL_HOST_USER=your-email@gmail.com
# EMAIL_HOST_PASSWORD=your-app-password
# DEFAULT_FROM_EMAIL=Set Invoice <your-email@gmail.com>
⚠️ Important: Never commit your.envfile to version control!
Run migrations to create database tables:
python manage.py makemigrations
python manage.py migrateOption 1: Using Django's built-in command (Recommended)
python manage.py createsuperuserFollow the prompts to enter:
- Email address
- Password (minimum 8 characters)
Option 2: Using the template script
-
Copy the template:
cp create_admin_template.py create_admin_user.py
-
Edit
create_admin_user.pyand update:admin_email = 'your-email@example.com' # Your email admin_password = 'YourSecurePassword123!' # Your password
-
Run the script:
python manage.py shell < create_admin_user.py
To quickly populate the system with sample data for testing:
python manage.py shell < setup_test_data.pyThis creates:
- User roles (Admin, Manager, User)
- Sample customers
- Item categories (Electronics, Furniture, Office Supplies)
- Sample inventory items
For development (with auto-rebuild):
npx tailwindcss -i ./static/css/input.css -o ./static/css/output.css --watchKeep this running in a separate terminal while developing.
For production (one-time build):
npx tailwindcss -i ./static/css/input.css -o ./static/css/output.css --minifypython manage.py runserverAccess the application at: http://127.0.0.1:8000
The system supports role-based access control (RBAC):
| Role | Permissions |
|---|---|
| Admin | Full system access, user management, all CRUD operations |
| Manager | Create/edit invoices, customers, items, view reports |
| User | Create invoices, view own data, limited editing |
| Viewer | Read-only access to invoices and reports |
- Login as Admin
- Navigate to Users → Add User
- Fill in user details:
- Email address
- Password
- Assign role
- Set status (Active/Inactive)
- Click Save
The dashboard provides an overview of your business:
- Total Invoices: Count of all invoices
- Pending Payments: Invoices awaiting payment
- Total Customers: Active customer count
- Revenue Statistics: Total and monthly revenue
- Recent Activities: Latest invoices and payments
- Low Stock Alerts: Items with quantity < 10
Adding a Customer:
- Navigate to Customers → Add Customer
- Fill in required fields:
- Customer Name
- Contact Number
- Address
- City
- Click Save
Managing Customers:
- Search: Use the search bar to find customers by name or email
- Edit: Click the edit icon to modify customer details
- Delete: Remove customers (only if no invoices exist)
- View History: See all invoices for a specific customer
Creating Categories:
- Go to Inventory → Categories
- Click Add Category
- Enter category name (e.g., "Electronics", "Furniture")
- Save
Adding Items:
- Navigate to Inventory → Items
- Click Add Item
- Fill in details:
- Item Name
- Category
- Price
- Available Quantity
- Description (optional)
- Save
Stock Management:
- Items with available quantity < 10 trigger low stock alerts
- Quantity automatically reduces when invoices are finalized
- Edit items to update stock levels
Creating an Invoice:
- Go to Invoices → Create Invoice
- Select customer from dropdown
- Set issue date and due date
- Add items:
- Click Add Item
- Select item from dropdown
- Enter quantity (validated against available stock)
- Price auto-fills, can be adjusted
- Subtotal calculates automatically
- Apply discount (optional)
- Tax is calculated automatically (configurable)
- Choose action:
- Save as Draft: Invoice can be edited later
- Finalize: Invoice is locked, inventory reduced
Invoice Statuses:
- Draft: Editable, no inventory impact
- Pending: Finalized, awaiting payment
- Paid: Payment received
- Cancelled: Invoice voided
Editing Invoices:
- Only Draft invoices can be edited
- Navigate to Invoices → Click edit icon
- Make changes and save
Generating PDF:
- Open invoice details
- Click Download PDF
- Professional PDF invoice is generated
Recording a Payment:
- Go to Payments → Record Payment
- Select invoice from dropdown
- Enter payment details:
- Amount (supports partial payments)
- Payment method (Cash, Card, Bank Transfer, Online)
- Transaction ID (optional)
- Payment date
- Click Save
Payment Tracking:
- View all payments for an invoice
- Invoice status updates automatically:
- Fully paid → Status: Paid
- Partially paid → Status: Pending
- Payment history maintained for auditing
1. Add Customer (if new)
↓
2. Add Items to Inventory
↓
3. Create Invoice
- Select customer
- Add items with quantities
- Apply discount if needed
- Finalize invoice
↓
4. Generate PDF Invoice
↓
5. Send to Customer
↓
6. Record Payment when received
↓
7. Invoice marked as Paid
1. Check Dashboard for low stock alerts
↓
2. Navigate to Inventory → Items
↓
3. Find items with low quantity
↓
4. Edit item and update available quantity
↓
5. Alert clears from dashboard
1. Go to Dashboard
↓
2. View monthly revenue statistics
↓
3. Navigate to Invoices
↓
4. Filter by date range
↓
5. Export or review invoice list
↓
6. Check Payments for reconciliation
Solution:
- Verify email and password are correct
- Check if user account is active (Admin can verify)
- Ensure email verification is complete (if enabled)
- Try password reset functionality
Solution:
# Rebuild TailwindCSS
npx tailwindcss -i ./static/css/input.css -o ./static/css/output.css
# Clear browser cache
# Restart Django server
python manage.py runserverSolution:
- Check
.envfile for correct email configuration - For Gmail, enable "App Passwords":
- Go to Google Account → Security
- Enable 2-Factor Authentication
- Generate App Password
- Use App Password in
.env
- Test email configuration:
python check_env.py
Solution:
# Reset database (WARNING: Deletes all data)
rm db.sqlite3
python manage.py migrate
python manage.py createsuperuserSolution:
- Check available quantity in Inventory → Items
- Update stock levels before creating invoice
- Reduce quantity in invoice to match available stock
Solution:
- Only Draft invoices can be edited
- Finalized invoices are locked for data integrity
- Create a new invoice or cancel existing one
-
Keep
.envsecure:- Never commit to version control
- Use
.env.exampleas template - Rotate secrets regularly
-
Use strong passwords:
- Minimum 8 characters
- Mix of uppercase, lowercase, numbers, symbols
- Avoid common passwords
-
Regular backups:
# Backup database cp db.sqlite3 backups/db_backup_$(date +%Y%m%d).sqlite3
-
Update
.envsettings:DEBUG=False SECRET_KEY=<generate-new-secure-key> ALLOWED_HOSTS=yourdomain.com,www.yourdomain.com
-
Use PostgreSQL instead of SQLite:
- Install:
pip install psycopg2-binary - Update
config/settings.pydatabase configuration
- Install:
-
Enable HTTPS:
- Use SSL certificate
- Configure reverse proxy (Nginx/Apache)
-
Collect static files:
python manage.py collectstatic
-
Use production WSGI server:
pip install gunicorn gunicorn config.wsgi:application
-
Regular updates:
- Keep Django and dependencies updated
- Monitor security advisories
- Apply patches promptly
For testing, emails print to console:
EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend-
Enable 2-Factor Authentication on Google Account
-
Generate App Password:
- Google Account → Security → App Passwords
- Select "Mail" and your device
- Copy generated password
-
Update
.env:EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend EMAIL_HOST=smtp.gmail.com EMAIL_PORT=587 EMAIL_USE_TLS=True EMAIL_HOST_USER=your-email@gmail.com EMAIL_HOST_PASSWORD=your-app-password DEFAULT_FROM_EMAIL=Set Invoice <your-email@gmail.com>
- Create SendGrid account
- Generate API key
- Update
.env:EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend EMAIL_HOST=smtp.sendgrid.net EMAIL_PORT=587 EMAIL_USE_TLS=True EMAIL_HOST_USER=apikey EMAIL_HOST_PASSWORD=your-sendgrid-api-key DEFAULT_FROM_EMAIL=Set Invoice <noreply@yourdomain.com>
# Create migrations
python manage.py makemigrations
# Apply migrations
python manage.py migrate
# Create superuser
python manage.py createsuperuser
# Collect static files (production)
python manage.py collectstatic
# Run development server
python manage.py runserver
# Run on specific port
python manage.py runserver 8080
# Access from network
python manage.py runserver 0.0.0.0:8000invoice_management_system/
├── apps/
│ ├── accounts/ # User authentication
│ ├── customers/ # Customer management
│ ├── inventory/ # Items and categories
│ ├── invoices/ # Invoice processing
│ ├── payments/ # Payment tracking
│ └── core/ # Dashboard and common views
├── config/ # Django settings
├── templates/ # HTML templates
├── static/ # CSS, JS, images
├── media/ # User uploads (PDFs)
└── manage.py # Django management script
- Documentation: Check README.md for technical details
- Issues: Report bugs on GitHub repository
- Email: Contact system administrator
Q: Can I use this for multiple businesses? A: Yes, each user can manage their own customers, items, and invoices independently.
Q: Is there a mobile app? A: Currently web-based only, but responsive design works on mobile browsers.
Q: Can I customize invoice templates?
A: Yes, edit templates in templates/invoices/ directory.
Q: How do I backup my data?
A: Copy db.sqlite3 file regularly. For production, use PostgreSQL with automated backups.
Q: Can I export data to Excel? A: Currently supports PDF export. Excel export can be added as a custom feature.
Q: What payment methods are supported? A: Cash, Card, Bank Transfer, and Online payments are tracked. Actual payment processing requires integration with payment gateways.
- Django: 5.2.8
- Python: 3.10+
- TailwindCSS: Latest
- Database: SQLite (dev), PostgreSQL (production)
MIT License - See LICENSE file for details
Happy Invoicing! 🧾
For technical support or feature requests, please contact your system administrator or open an issue on the project repository.