A custom app for ERPNext that provides an advanced calendar view for managing timesheet details (Time Sheet Detail) with complete CRUD functionality, export and reporting capabilities.
ERPNext, while being an excellent open-source ERP system, has some significant limitations in timesheet management that motivated the development of this custom app:
-
Limited Calendar View: ERPNext provides a calendar view only for main Timesheets, but not for Timesheet Details, which can only be managed through tabular interface, making it difficult to visualize and edit individual activities temporally
-
Unintuitive Interface: Timesheet Detail management occurs through traditional forms, without drag & drop or visual editing
-
Limited Filters: The base system doesn't offer advanced filters for Employee, Project, Activity Type and Task in a single view
-
Limited Export: Lack of custom CSV export functionality with detailed statistics
-
Complex Break Management: Difficulty in managing breaks and lunch breaks within activities
-
Missing Task-Employee-Project Validation: ERPNext allows creating tasks for a project and assigning them to employees who are not associated with that project, causing confusion in management and access control issues
-
No Weekly Timesheet Management: The standard system does not automatically group activities into weekly timesheets, making reporting and data consistency more difficult
- Modern Calendar View: Interface based on FullCalendar.js with intuitive temporal visualization
- Drag & Drop: Visual activity modification with dragging and resizing
- Advanced Filters: Integrated filter system in the sidebar for efficient navigation
- Smart Export: CSV export functionality
- Advanced Break Management: Native support for breaks with automatic creation of separate activities
- Task-Employee-Project Validation: Control system that prevents assignment of tasks to employees not associated with the project
- Weekly Timesheet Management: Automatic grouping of activities into weekly timesheets via dedicated backend and frontend logic
- Complete Integration: Maintains full compatibility with the existing ERPNext system
- Why AdvancedTC?
- Key Features
- Prerequisites
- Installation
- Accessing the Application
- Configuration Verification
- Project Access Control
- Troubleshooting
- Usage
- Technical Architecture
- Detailed Features
- Customization
- Configuration
- Troubleshooting
- Additional Features
- Additional Resources
- Contributing
- License
- Support
- Changelog
- Project Information
- Interactive Calendar View: Modern visualization with FullCalendar.js
- Advanced Filters: Employee, Project, Activity Type and Task with role-based visibility
- Complete CRUD Management: Create, edit, delete activities
- Drag & Drop: Move and resize activities
- ERPNext Integration: Complete with Timesheet and Timesheet Detail
- Project Assignment System: Uses ERPNext's "Assign To" functionality for project access control
- Role-Based Access: Managers see all projects, employees only see assigned projects
- Export and Reporting: CSV export with detailed statistics
- Break Management: Complete support for breaks and lunch breaks
- Customization: Dynamic colors and advanced configurations
- Automatic Workspace Creation: Dedicated workspace created during installation
- Apps Screen Integration: Direct access from ERPNext apps section
- ERPNext: v15+ or Frappe Framework v15+
- Python: 3.10+ (as specified in pyproject.toml)
- Modules: Access to ERPNext Timesheet modules
- Permissions: Timesheet and Timesheet Detail management
- Browser: Modern with ES6+ support
- Bench: Properly configured for ERPNext site
# Navigate to the main bench directory
cd /path/to/frappe-bench
# Download the app from repository
bench get-app https://github.com/CupoMeridio/advanced_tc.git# Verify the structure is correct
ls /path/to/frappe-bench/apps/advanced_tc/
# You should see: advanced_tc/, setup.py, pyproject.toml, README.md, license.txt
# Verify essential files
ls /path/to/frappe-bench/apps/advanced_tc/advanced_tc/
# You should see: __init__.py, hooks.py, modules.txt, install.py, api/, public/, config/# Start the bench
bench startOpen a new terminal, navigate to the bench folder and run:
# Install the app on specific site
bench --site [site-name] install-app advanced_tc# Run migration to apply database changes
bench --site [site-name] migratebench restartAfter successful installation, you can access Advanced Timesheet Calendar in three ways:
- Navigate to your ERPNext desktop
- Click on the "Apps" section
- Look for the "Advanced Timesheet Calendar" icon with a calendar symbol
- Click the icon to launch the application
- Navigate to the "Advanced Timesheet Calendar" workspace
- This workspace is automatically created during installation
- Contains shortcuts and links to the application
- Navigate directly to:
https://your-site.com/app/advanced_tc - Or use the relative path:
/app/advanced_tc
For Managers:
- You will immediately see all open projects in the calendar
- Use ERPNext's "Assign To" feature to assign projects to employees
For Employees:
- If no projects are assigned, you'll see a message to contact HR
- Once projects are assigned, you'll see only your assigned projects
The app must have this structure to work correctly:
advanced_tc/
βββ advanced_tc/
β βββ __init__.py # App version (0.0.1)
β βββ hooks.py # App configuration
β βββ modules.txt # Modules (advanced_tc)
β βββ patches.txt # Database patches
β βββ install.py # Installation script
β βββ pyproject.toml # Python project config
β βββ api/
β β βββ __init__.py
β β βββ timesheet_details.py # Backend API
β βββ public/
β β βββ .gitkeep
β β βββ css/
β β β βββ timesheet_calendar.css # CSS styles
β β βββ images/ # Image assets
β β βββ js/
β β βββ timesheet_calendar.js # JS utilities
β βββ config/ # Configuration files (empty)
β βββ templates/
β β βββ __init__.py
β β βββ pages/ # Template pages
β βββ advanced_tc/
β βββ .frappe # Frappe metadata
β βββ __init__.py
β βββ page/
β βββ advanced_tc/
β βββ __init__.py
β βββ advanced_tc.json # Page configuration
β βββ advanced_tc.js # Frontend logic
βββ .gitignore # Git ignore rules
βββ .pre-commit-config.yaml # Pre-commit hooks
βββ setup.py # Python setup
βββ pyproject.toml # Project configuration
βββ README.md # Documentation (English)
βββ README.it.md # Documentation (Italian)
βββ license.txt # License
- hooks.py: Configures app_name="advanced_tc", CSS, JS and workspace with automatic app screen integration
- install.py: Installation script with workspace creation and informative messages
- advanced_tc.json: Defines the main page configuration
- advanced_tc.js: Frontend logic for interactive calendar
- timesheet_details.py: Backend API endpoints for timesheet management
- timesheet_calendar.css/js: Styling and utility functions for the calendar
- logo.svg/logo.png: Application logos for the apps screen
AdvancedTC implements a sophisticated project access control system using ERPNext's native "Assign To" functionality:
- Full Access: Can view and create activities for all open projects
- No Restrictions: Complete project visibility in filters and dialogs
- Assignment Control: Can assign projects to employees using ERPNext's "Assign To" feature
- Restricted Access: Can only view projects assigned to them via "Assign To"
- Automatic Filtering: Project filters and activity creation dialogs show only assigned projects
- No Assignment Access: If no projects are assigned, they see an empty list with instructions to contact HR
- Navigate to Project: Go to any Project document in ERPNext
- Use Assign To: Click the "Assign To" button in the sidebar
- Select Employee: Choose the employee(s) to assign to the project
- Automatic Access: The employee will immediately see the project in AdvancedTC
- No Fallback Access: Employees without assignments cannot see any projects
- Clear Messaging: Users are informed when they need HR assistance for project assignment
- Consistent Filtering: Same access rules apply to sidebar filters and activity creation dialogs
- ERPNext Integration: Uses native ERPNext ToDo system for assignments
Cause: The app was not copied correctly to the apps/ directory
Solution:
# Verify the app is in the correct directory
ls /path/to/frappe-bench/apps/advanced_tc
# If not there, copy the app
cp -r /path/to/advanced_tc /path/to/frappe-bench/apps/
# Verify essential files exist
ls /path/to/frappe-bench/apps/advanced_tc/advanced_tc/hooks.py
ls /path/to/frappe-bench/apps/advanced_tc/advanced_tc/__init__.py
# Just restart bench
# Sometime restarting bench resolve the issue
bench restart
# or stop and restart manually with Ctrl+C and then
bench startCause: The folder is not a valid Git repository
Solution:
# Option 1: Initialize as Git repository
cd /path/to/advanced_tc
git init
git add .
git commit -m "Initial commit"
# Option 2: Manual copy (simpler)
cp -r /path/to/advanced_tc /path/to/frappe-bench/apps/
cd /path/to/frappe-bench
bench --site [site-name] install-app advanced_tcVerify:
- Python Version: Make sure to use Python 3.10+
- Permissions: Verify ERPNext base permissions on Timesheet doctypes
- Dependencies: Check that ERPNext v15+ is installed
- Logs: Check logs for specific errors
# Check logs
tail -f /path/to/frappe-bench/logs/web.log
tail -f /path/to/frappe-bench/logs/worker.logVerify:
- Migration: Make sure migration is completed
- User permissions: Verify user has necessary ERPNext base roles
- Cache: Clear browser cache
- Restart: Completely restart the bench
# Force migration
bench --site [site-name] migrate
# Clear cache
bench --site [site-name] clear-cache
# Restart everything
bench restart- Login to ERPNext
- Go to AdvancedTC module or search "Advanced Timesheet Calendar"
- View the calendar view with all activities
- Employee: Filter by specific employee (managers see all, employees see only themselves)
- Project: Filter by project (based on "Assign To" assignments)
- Activity Type: Filter by activity type
- Task: Filter by specific task
- Click "Add Activity" or select a time range in the calendar
- Fill the form with:
- Employee (required)
- From Time / To Time (required)
- Project (optional)
- Task (optional)
- Activity Type (optional)
- Description (optional)
- Break Start/End (optional)
- Click "Create" to save
- Drag & Drop: Drag the activity to change date/time
- Resize: Drag the borders to modify duration
- Edit Dialog: Click on the activity to open the edit dialog
- Click on the activity to open the dialog
- Click "Delete"
- Confirm deletion
Accessing the Feature: The export functionality is accessible through the "Generate Report" button in the sidebar.
How to use:
- Navigate in the calendar to select the desired period
- Apply any filters (employee, project) if needed
- Click the "Generate Report" button in the sidebar
- View the summary dialog with:
- Total hours for the displayed period
- Detailed breakdown by employee
- Breakdown by project
- Breakdown by activity type
- Click "Export CSV" to download data in CSV format
- Click "Settings" in the sidebar
- Configure preferences:
- Default work shift time
- Default break time
- Save settings
- Month: Complete monthly view
- Week: Weekly view (default)
- Day: Detailed daily view
File: api/timesheet_details.py
@frappe.whitelist()
def get_timesheet_details(start_date=None, end_date=None, filters=None):
"""Retrieve timesheet activities for the calendar"""
@frappe.whitelist()
def create_timesheet_detail(data):
"""Create a new timesheet activity"""
@frappe.whitelist()
def update_timesheet_detail(name, data):
"""Update existing activity"""
@frappe.whitelist()
def delete_timesheet_detail(name):
"""Delete timesheet activity"""-
Weekly Timesheet Management:
- Automatic creation if non-existent
- Automatic calculation of week start (Monday)
- Automatic deletion of empty timesheets
-
Data Validation:
- Time overlap control
- Time range validation
- User permission verification
-
Hours Calculation:
- Automatic duration calculation
- Break and pause management
- Configurable rounding
File: public/js/advanced_tc.js
class AdvancedTimesheetCalendar {
constructor() {
this.init_calendar();
this.setup_filters();
this.setup_event_handlers();
}
init_calendar() {
// FullCalendar initialization
}
setup_filters() {
// Filter configuration
}
handle_time_selection(info) {
// Time selection handling
}
}File: public/js/timesheet_calendar.js
window.TimesheetCalendarUtils = {
showSummaryDialog: function(events, startDate, endDate) {
// Summary dialog and export
},
exportToCSV: function(activities, filename) {
// CSV export functionality
}
};- FullCalendar.js: Main calendar component
- Frappe Framework: ERPNext integration
- jQuery: DOM manipulation and AJAX
- Timesheet: Weekly activity container
- Timesheet Detail: Single activity/timesheet entry
- Employee: Employee information
- Project: Project connection
- Task: Task connection
- Activity Type: Activity categorization
The app implements intelligent timesheet management:
- Automatic Creation: Creates weekly timesheets automatically when needed
- Work Week Management: Automatically calculates week start (Monday)
- Smart Deletion: Removes empty timesheets automatically
Each project automatically receives a consistent color:
- Consistent Colors: Same project = same color always
- Uniform Distribution: Algorithm distributes colors evenly
- No Configuration: Works automatically without setup
The app includes automatic controls to ensure data quality:
- Overlap Control: Prevents time overlaps between activities
- Time Validation: Verifies that times are logical and valid
- Permission Control: Verifies user can modify the data
- Duration Validation: Checks that activities have reasonable duration
Intuitive drag functionality:
- Move Activities: Drag to change date and time
- Resize: Modify duration by dragging borders
- Visual Feedback: Notifications and loading states
- Automatic Rollback: Cancels changes on error
Advanced filters for efficient navigation:
- Employee: Filter by employee (with permission control)
- Project: Filter by project (based on assignments)
- Activity Type: Filter by activity type
- Task: Filter by specific task
- Combinations: Use multiple filters simultaneously
Complete export and analysis functionality:
- CSV Export: Export data in CSV format with all details
- Summary Dialog: Display statistics for selected period
- Detailed Breakdown: Analysis by employee, project and activity type
- Export Filters: Export only filtered data
Complete support for break management:
- Break Start/End: Define break times within activity
- Automatic Calculation: Break hours are subtracted from total
- Validation: Automatic checks for valid break times
- Actual Hours: Precise calculation of worked hours
The app offers various customization options:
- Automatic Colors: Dynamic color assignment for projects
- Responsive Interface: Adapts to different screen sizes
- Theme Support: Compatible with ERPNext themes
- Custom Styling: Modify CSS for personalized appearance
- Modular Architecture: Easy to extend with new features
- API Integration: Add custom endpoints as needed
- Event Hooks: Integrate with ERPNext workflows
- Custom Fields: Support for additional data fields
The app uses ERPNext standard roles and permissions:
Required ERPNext Roles:
Employee: Basic timesheet access for own recordsHR User: Extended HR functionalityHR Manager: Full HR management capabilitiesSystem Manager: Complete system access
Required DocType Access:
- Timesheet, Timesheet Detail, Employee, Project, Task, Activity Type
For optimal performance with large datasets:
- Period Filters: Use date range filters to limit data
- Database Optimization: Automatic indexing for faster queries
- Caching: Intelligent caching of frequently accessed data
- Pagination: Efficient data loading for large result sets
The app includes sensible defaults:
- CSS and JavaScript: Automatically loaded assets
- Activity Types: Pre-configured common activity types
- Calendar Settings: Optimized for business use
- Performance: Efficient caching and indexing
Solutions:
- Rebuild and restart:
bench build && bench restart - Verify user has appropriate ERPNext roles
- Clear browser cache (Ctrl+Shift+R)
- Check browser console for JavaScript errors
Solutions:
- Check ERPNext error logs
- Verify user permissions for Timesheet DocType
- Ensure proper site configuration
Solutions:
- Recompile assets:
bench build --app advanced_tc - Hard refresh browser (Ctrl+F5)
- Check CSS file paths
Common causes:
- Insufficient permissions
- Time overlaps with existing activities
- Validation errors
Solutions:
- Check user permissions
- Verify no time conflicts
- Review activity validation rules
For advanced debugging and development, the app includes:
- Backend Logging: Detailed error tracking and debugging
- Frontend Logging: Browser console debugging tools
- Testing Framework: Unit and integration tests
- Development Tools: Code quality and testing utilities
- Automatic Break Rules: Configurable break policies
- Net Hours Calculation: Precise work time calculation
- Break Validation: Ensures breaks are within activity time
- Ctrl+N: Create new activity
- Ctrl+R: Refresh calendar
- Esc: Close dialogs
- π Technical Documentation - Detailed technical architecture, API reference, and development guide
- ERPNext Documentation
- Frappe Framework Documentation
- FullCalendar.js Documentation
Contributions are welcome! Please follow these steps:
- Fork the project
- Create a feature branch
- Commit your changes with clear messages
- Test your changes thoroughly
- Submit a Pull Request
- Follow ERPNext coding standards
- Include appropriate documentation
- Test all functionality before submitting
- Ensure compatibility with latest ERPNext version
This project is released under GPL-3.0 license. See the license.txt file for complete details.
- β Allowed: Commercial use
- β Allowed: Modification and distribution
- β Allowed: Private use
- β Required: Maintain GPL-3.0 license
- β Required: Make source code available
When reporting an issue, include:
# ERPNext version
bench version
# Error logs
bench logs
# Browser configuration
# - Browser version
# - Console errors (F12)
# - Network tab for API errorsQ: How to add new Activity Types? A: Go to ERPNext > Setup > Activity Type and create new types.
Q: Can I customize colors?
A: Yes, modify the get_event_color() function in api/timesheet_details.py.
Q: How to export data for long periods? A: Use filters to limit the dataset, then export to CSV.
This project was developed as an internship activity at Youbiquo company by two Computer Engineering students from the University of Salerno:
Developed with β€οΈ for the ERPNext community