Skip to content

[17.0][ADD] hr_attendance_work_location - #265

Open
rrebollo wants to merge 17 commits into
OCA:17.0from
BinhexTeam:17.0-add-hr_attendance_work_location
Open

[17.0][ADD] hr_attendance_work_location#265
rrebollo wants to merge 17 commits into
OCA:17.0from
BinhexTeam:17.0-add-hr_attendance_work_location

Conversation

@rrebollo

@rrebollo rrebollo commented Mar 26, 2026

Copy link
Copy Markdown

This pull request introduces the hr_attendance_work_location module, which
enhances the HR Attendance app by enabling work location tracking for employee
attendance records.

Features:

  • Automatic mode (GPS): Automatically assigns work locations at check-in
    and check-out based on GPS coordinates, with configurable proximity tolerance
    (set per company in HR Settings > Attendance, default: 111 meters).

  • Manual mode (Selector): When set to manual mode, the employee selects
    their work location before each check-in and check-out. This works in two
    interfaces:

    • Kiosk mode: After employee identification (barcode scan, manual
      selection, or PIN), an intermediate screen appears where the employee
      selects their work location. The location is shown read-only on the
      greeting screen after the operation.
    • Backend systray: The work location dropdown is always visible in
      the attendance popup and editable before both check-in and check-out.
      The selected location is stored in the Check-in Work Location or
      Check-out Work Location field on the attendance record accordingly.
  • Configurable per company: Choose between automatic and manual modes,
    set a default work location, and optionally require location selection.

  • Exclude from attendance: Work locations marked as excluded are never
    assigned automatically but remain available for manual selection.

@rrebollo
rrebollo marked this pull request as ready for review March 26, 2026 22:05
@hitrosol

Copy link
Copy Markdown

Nice module @rrebollo,
Would it be acceptable to have configurable of the GEO_TOLERANCE_DEGREES ? To my knowledge different companies have different geo tolerance degrees,

@rrebollo

rrebollo commented Mar 27, 2026

Copy link
Copy Markdown
Author

Nice module @rrebollo, Would it be acceptable to have configurable of the GEO_TOLERANCE_DEGREES ? To my knowledge different companies have different geo tolerance degrees,

Do you mean configurable through the web UI—perhaps as a system parameter that applies to all companies in the same instance—or at the individual company level?

I would prefer the system parameter implementation; I think it's more practical. Do you have any use cases that would require the company-level approach?

@rrebollo
rrebollo force-pushed the 17.0-add-hr_attendance_work_location branch 2 times, most recently from 984663c to ebb62d9 Compare March 27, 2026 03:26
@hitrosol

Copy link
Copy Markdown

Currently, there’s no specific use case for it, but I suggested it to anticipate future needs and more flexible.
By the way, will this implementation be compatible with the Required Geolocation module? Or it can be as one module to make sure the geolocation is filled correctly.

@rrebollo
rrebollo force-pushed the 17.0-add-hr_attendance_work_location branch from ebb62d9 to d9a81ae Compare March 27, 2026 12:21
@rrebollo

Copy link
Copy Markdown
Author

By the way, will this implementation be compatible with the Required Geolocation module? Or it can be as one module to make sure the geolocation is filled correctly.

We designed it without any coupling. It is the implementer's responsibility to ensure geolocation data is provided, but how that is done falls outside the scope of this addon.

In fact, right now we are using the addon you mentioned.

@rrebollo
rrebollo force-pushed the 17.0-add-hr_attendance_work_location branch 2 times, most recently from 326f6dc to 85ad48c Compare April 6, 2026 12:10
@rrebollo

rrebollo commented Apr 6, 2026

Copy link
Copy Markdown
Author

Some hr_attendance_autoclose test was failing. No it's fixed and this PR now depends on it #251.

@rrebollo
rrebollo force-pushed the 17.0-add-hr_attendance_work_location branch from 85ad48c to 51528ad Compare April 6, 2026 15:30
@rrebollo
rrebollo force-pushed the 17.0-add-hr_attendance_work_location branch from 51528ad to 7b6461f Compare April 15, 2026 18:05
@OCA-git-bot OCA-git-bot added series:17.0 mod:hr_attendance_autoclose Module hr_attendance_autoclose mod:hr_attendance_work_location Module hr_attendance_work_location labels Apr 15, 2026
@rrebollo
rrebollo force-pushed the 17.0-add-hr_attendance_work_location branch 2 times, most recently from 542da7b to c3c4f93 Compare May 19, 2026 00:32
@rrebollo

Copy link
Copy Markdown
Author

@hitrosol, the geotolerance feature is now configurable at the company level — a value of zero will disable it. Can you give me your review?

@rrebollo
rrebollo force-pushed the 17.0-add-hr_attendance_work_location branch 2 times, most recently from 2496017 to 135b15e Compare May 22, 2026 11:12
@rrebollo
rrebollo force-pushed the 17.0-add-hr_attendance_work_location branch from 135b15e to 2a93cc2 Compare June 15, 2026 17:27
@rrebollo

Copy link
Copy Markdown
Author

Update: After a team member raised a question about how to configure the tolerance for 50 meters, we realized the field was expressed in decimal degrees — not intuitive for end users. We've updated the module so the tolerance is now configured in meters (default: 111m). Internally, the algorithm converts to degrees at runtime.

Changes included:

  • Renamed geo_tolerance_degreesgeo_tolerance_meters on res.company
  • Added meter-to-degree conversion in _compute_work_locations()
  • Updated documentation (CONFIGURE.md) with a reference table for common values and device accuracy guidance
  • Updated all tests and Spanish translations

@rrebollo
rrebollo force-pushed the 17.0-add-hr_attendance_work_location branch from 2a93cc2 to ad9e3cb Compare July 29, 2026 11:37
@OCA-git-bot OCA-git-bot removed the mod:hr_attendance_autoclose Module hr_attendance_autoclose label Jul 29, 2026
@rrebollo
rrebollo marked this pull request as draft August 1, 2026 17:29
… mode

- Add intermediate kiosk screen (KioskWorkLocation) after identification
- Add agnostic preflight endpoint for any identification method
- Add barcode_with_location endpoint for barcode + work location flow
- Add kiosk_location_settings endpoint for kiosk config data
- Extend manual_selection and systray with work_location_id parameter
- Display work location in read-only on greeting screen
- Add systray dropdown for work location selection
- Add post_init_hook for existing companies
- Add configurable work_location_mode, manual_work_location_id,
  work_location_required

@BinhexTeam T20661
@rrebollo
rrebollo force-pushed the 17.0-add-hr_attendance_work_location branch from 3ac9ea2 to 75ed102 Compare August 1, 2026 19:01
- Fix kiosk_work_location_component import: remove spurious static/src/ prefix
  (@MODULE/ already maps to MODULE/static/src/)
- Replace wildcard in web.assets_backend with explicit systray-only files
- Prevents module_loader error on kiosk page
t-att-value on <select> sets the HTML attribute, not the DOM property.
Select selection is controlled by the property, so use t-att-selected
on each <option> instead.
OWL2 in Odoo 17 does not call patched lifecycle hooks like mounted().
The override was silently never invoked, so kiosk_location_settings
RPC never fired, workLocationMode stayed 'automatic', and the work
location selector never appeared — causing a work_location_required
error on check-in.

Also add error notification branch in onWorkLocationConfirm for
backend errors (e.g. work_location_required).
…eck-out in kiosk

When an employee is checked_in (needs to check-out) and work_location_mode
is 'manual', the patched kioskConfirm was calling onManualSelection directly
without work_location_id. The backend then returned 'work_location_required'
error.

Fix by always showing the work_location screen in kioskConfirm when in manual
mode, regardless of attendance state. The onWorkLocationConfirm method already
passes work_location_id to the backend.

Also remove the checked_in early-return in onBarcodeScanned for the same reason.
@rrebollo
rrebollo force-pushed the 17.0-add-hr_attendance_work_location branch from 334cc24 to 847696a Compare August 6, 2026 17:32
@rrebollo
rrebollo marked this pull request as ready for review August 17, 2026 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:hr_attendance_work_location Module hr_attendance_work_location series:17.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants