Skip to Content
Home Human Resources HR Attendance GPS Geofence
HR Attendance GPS Geofence

HR Attendance GPS Geofence

GPS-based geofence validation for employee attendance check-ins

v19.0.1.0.0 AlShayeb Partners Development Team Human Resources

GPS geofence attendance validation with justification and auto-checkout

Overview

GPS-based location validation for employee attendance. Employees outside the company's geofence must provide justification. Includes auto-checkout and attendance approval workflows.

Workflow

Attendance

Pending
Approved
Rejected

Key Features

  • Company/Branch-level GPS coordinates configuration
  • Configurable radius threshold (default: 50 meters)
  • Server-side distance validation using Haversine formula
  • Inline justification form for outside-location check-ins
  • Full audit trail with stored distance calculations
  • Multi-branch support (each branch has its own geofence)
  • Mobile PWA compatible

Extends Existing Models

hr.attendance

Adds 4 fields:

Approval Status (Selection) Outside Company (Boolean) Distance (Float) Justification Note (Text)

Adds actions: action_approve_attendance, action_reject_attendance


res.company

Adds 3 fields:

Geofence Enabled (Boolean) Latitude/Longitude (Float) Radius (Float)

Documentation

HR Attendance GPS Geofence

GPS-based geofence validation for employee attendance check-ins in Odoo 19 Enterprise.

Overview

This module extends Odoo's HR Attendance functionality to enforce location-based check-in validation. Employees checking in from outside the company's defined geofence must provide justification (Contact, Project, or Note) before attendance is recorded.

Features

  • **Company/Branch-level GPS coordinates configuration** - Each company or branch can have its own geofence
  • **Configurable radius threshold** - Default 50 meters, adjustable per company
  • **Server-side distance validation** - Uses Haversine formula for accurate Earth-surface distance calculations
  • **Wizard-based justification** - Employees provide Contact, Project, or Note when outside geofence
  • **Full audit trail** - Distance and justification stored on attendance records
  • **Multi-branch support** - Each branch has its own geofence based on its company settings
  • **Mobile PWA compatible** - Works with Odoo's mobile web interface
  • **Graceful fallbacks** - If GPS unavailable or geofence not configured, check-in proceeds normally

Installation

1. Copy the `hr_attendance_gps_geofence` folder to your Odoo addons directory

2. Update the apps list: Settings → Apps → Update Apps List

3. Search for "HR Attendance GPS Geofence" and install

Configuration

Setting Up Company Geofence

1. Go to Settings → Companies → Select your company

2. Navigate to the "Attendance Geofence" tab

3. Enable "GPS Geofence"

4. Enter your office coordinates:

  • **Latitude**: e.g., 31.7167 for Beit Jala
  • **Longitude**: e.g., 35.1667 for Beit Jala

5. Set the **Radius** in meters (default: 50m)

6. Save

Finding Coordinates

1. Open Google Maps

2. Right-click on your company location

3. Click the coordinates to copy them

4. First number is Latitude, second is Longitude

Usage

Check-in Inside Geofence

When an employee checks in within the configured radius, attendance is recorded normally with the distance stored.

Check-in Outside Geofence

When checking in from outside the radius:

1. A wizard appears showing the distance from office

2. Employee must provide at least one justification:

  • **Contact**: Select a contact they are visiting
  • **Project**: Select a project they are working on
  • **Note**: Free-text explanation

3. On confirmation, attendance is recorded with justification details

Check-out

Check-out is always allowed regardless of location (no validation).

Technical Details

Models Extended

  • `res.company` - Added geofence configuration fields
  • `hr.attendance` - Added justification fields
  • `hr.employee` - Override `_attendance_action_change()` method

New Model

  • `attendance.outside.wizard` - Transient model for justification wizard

Distance Calculation

Uses the Haversine formula for calculating great-circle distance between two GPS coordinates on Earth's surface. Accurate to within a few meters at typical office distances.

Dependencies

  • `hr_attendance` (Odoo Community/Enterprise)
  • `project` (for project-based justification)

License

LGPL-3

Author

AlShayeb Partners Development Team

Support

For issues or feature requests, contact the development team.

Technical Details

Technical Name hr_attendance_gps_geofence
Version 19.0.1.0.0
License LGPL-3

Security

HR attendance with manager approval

Dependencies

hr_attendance hr_holidays_attendance project auth_totp