|
|
||
|---|---|---|
| .. | ||
| data | ||
| i18n | ||
| models | ||
| security | ||
| static/src | ||
| views | ||
| wizard | ||
| README.md | ||
| __init__.py | ||
| __manifest__.py | ||
README.md
HR Attendance Excel Report
Overview
This Odoo module provides comprehensive Excel attendance reports with customizable status codes, colors, and advanced filtering options. It integrates seamlessly with the existing HR attendance system to generate professional reports that match the format shown in the provided sample.
Features
📊 Report Generation
- Excel Output: Professional Excel reports with cell formatting and colors
- Configurable Layouts: Choose which columns to include/exclude
- Date Range Selection: Flexible date filtering with quick month selections
- Employee Filtering: Filter by departments, branches, or specific employees
- Summary Columns: Automatic calculation of attendance totals, leaves, and absences
🎨 Customizable Status Codes
- Flexible Status System: Configure unlimited status codes for different attendance situations
- Color Coding: Assign background and text colors to each status
- Condition Mapping: Link status codes to leave types, mission types, or custom conditions
- Multi-language Support: Arabic and English descriptions for each status
📋 Default Status Codes
| Code | Arabic | English | Color | Condition |
|---|---|---|---|---|
| PH | عطلة رسمية | Public Holiday | Gray | public_holiday = True |
| AB | غياب | Absent | Light Red | is_absent = True |
| AL | إجازة سنوية | Annual Leave | Light Blue | Leave type match |
| SL | إجازة مرضية | Sick Leave | Light Orange | Sick leave types |
| ML | إجازة زواج | Marriage Leave | Light Purple | Marriage leave |
| BL | إجازة وفاة | Bereavement Leave | Light Gray | Bereavement leave |
| OD | دوام ميداني | On Duty (Outside) | Light Yellow | Official mission |
| TR | تدريب | Training | Light Green | Training missions |
| UL | إجازة بدون راتب | Unpaid Leave | Light Salmon | Unpaid leave types |
| ML/PL | إجازة أمومة/أبوة | Maternity/Paternity | Light Beige | Maternity/Paternity leave |
🔧 Advanced Configuration
- Multiple Configurations: Create different report templates for different needs
- Custom Conditions: Write Python expressions for complex status matching
- Column Customization: Show/hide employee information columns
- Working Hours Format: Display as time ranges (8:00-3:30) or decimal hours (7.5)
Installation
Prerequisites
- Odoo 14.0+
- Python xlsxwriter library:
pip install xlsxwriter
Steps
- Copy the module to your Odoo addons directory
- Update the app list: Settings → Apps → Update Apps List
- Search for "HR Attendance Excel Report"
- Click Install
Configuration
1. Report Configuration
Navigate to: HR → Attendance Reports → Configuration → Report Configurations
- Create a new configuration
- Set default colors for normal attendance
- Choose which employee information columns to include
- Configure working hours display format
2. Status Configuration
Navigate to: HR → Attendance Reports → Configuration → Status Configurations
For each status code:
- Set the code (e.g., "PH", "AB", "AL")
- Add Arabic and English descriptions
- Choose background and text colors
- Configure matching conditions:
- Leave Types: Link to specific hr.holidays.status records
- Mission Types: Link to hr.official.mission.type records
- Custom Conditions: Write Python expressions
3. Custom Condition Examples
# Late arrival (more than 30 minutes)
transaction.lateness > 0.5
# Early exit
transaction.early_exit > 0
# Absent without approved leave
transaction.is_absent and not transaction.leave_id
# Working on weekend
transaction.date.weekday() >= 5 and transaction.sign_in > 0
# Overtime (more than 8 hours)
transaction.office_hours > 8.0
Usage
Generating Reports
- Navigate to:
HR → Attendance Reports → Reports → Excel Attendance Report - Select date range (quick buttons available for current/previous month)
- Choose report configuration
- Apply filters (employees, departments, branches)
- Configure options:
- Group by Department
- Include Summary Columns
- Include Status Legend
- Click "Generate Excel Report"
Report Structure
The generated Excel file contains:
Main Columns:
- Employee Number (optional)
- Employee Name
- National ID (optional)
- Department (optional)
- Job Position (optional)
- Branch/Location (optional)
Daily Columns:
- One column per day in the selected date range
- Color-coded cells based on attendance status
- Time ranges for normal attendance (e.g., "8:00 - 3:30")
- Status codes for special situations (e.g., "PH", "AL", "AB")
Summary Columns (optional):
- Attendance Days
- Leave Days
- Emergency Leave Days
- Absence Days
- Actual Working Hours
- Additional Hours
- Late Hours
- Early Exit Hours
Legend (optional):
- Color-coded explanation of all status codes
- Arabic and English descriptions
Technical Details
Database Integration
The module integrates with these existing Odoo models:
hr.attendance.transaction- Main attendance datahr.employee- Employee informationhr.holidays- Leave requestshr.holidays.status- Leave typeshr.official.mission- Official missionshr.personal.permission- Personal permissionshr.department- Departments and branches
File Structure
hr_attendance_excel_report/
├── __manifest__.py
├── models/
│ ├── attendance_report_config.py
│ └── attendance_status_config.py
├── wizard/
│ └── attendance_report_wizard.py
├── views/
│ ├── attendance_report_config_views.xml
│ ├── attendance_status_config_views.xml
│ ├── attendance_report_wizard_views.xml
│ └── menu_views.xml
├── data/
│ └── default_status_config.xml
├── security/
│ ├── ir.model.access.csv
│ └── security.xml
└── static/
├── src/css/report_wizard.css
└── src/js/color_picker_widget.js
Security
- HR User: Can generate reports
- HR Manager: Can configure report settings and status codes
- Multi-company: Automatic filtering by company
Troubleshooting
Common Issues
1. xlsxwriter not found
pip install xlsxwriter
# Restart Odoo server
2. No employees found
- Check employee filters (department, branch, employee selection)
- Ensure employees are active
- Verify company assignment
3. Empty cells in report
- Check if attendance transactions exist for the date range
- Verify status configuration conditions
- Review employee working calendar
4. Status codes not appearing
- Ensure status configurations are active
- Check condition type and mapping
- Verify sequence order (lower numbers have priority)
Performance Considerations
- Limit date ranges to 3 months maximum
- Use employee/department filters for large organizations
- The module is optimized for up to 500 employees per report
Support
For issues, bugs, or feature requests, please contact the development team or create an issue in the project repository.
License
LGPL-3
Note: This module requires the base hr, hr_holidays, and attendance-related modules to be installed and properly configured.