Skip to main content
Version: 1.2.9

Timesheets Module Technical Reference

The Timesheets Module governs work hour registration, running task timers, background timer persistence, and Odoo timesheet entry syncing.

Codebase Mapโ€‹

LayerPathPurpose
Frontend UIqml/features/timesheets/Logs list, manual entry forms, and timer overlays
State & Logicmodels/timesheet.jsJS timesheet database bindings and manual logging logic
Timer Servicemodels/timer_service.jsJS timer worker coordinating state, notifications, and ticks
Backend Servicesrc/sync_to_odoo.pySync worker pushing timesheet entries
D-Bus Interfacesrc/backend.pyD-Bus methods exposing timesheet logging and active timer state

Database Schemaโ€‹

Timesheet entries are stored locally in the following SQLite table:

account_analytic_line_appโ€‹

  • id (INTEGER, Primary Key): Unique analytic line ID.
  • name (TEXT): Description/Notes logged by the user.
  • date (TEXT): Date of work registration (YYYY-MM-DD).
  • unit_amount (REAL): Hours spent (represented as decimal, e.g. 1.5 hours = 1h 30m).
  • project_id (INTEGER): References the parent project.
  • task_id (INTEGER): References the parent task.
  • user_id (INTEGER): References the user entering the timesheet.
  • eisenhower_priority (TEXT): Priority scale (Urgent/Important matrix).
  • sync_dirty (INTEGER): Flag for pending remote synchronization (0 = Clean, 1 = Dirty).

Sync Mechanism & Network Protocolโ€‹

Odoo XML-RPC Model Mappingโ€‹

  • Remote Model: account.analytic.line (Odoo Timesheets)
  • Sync Direction: Bidirectional.

Timer Service & Persistenceโ€‹

The active timer state is governed by models/timer_service.js and persists across app closures.

  • When a timer starts, the timestamp start_time is written to local storage.
  • Even if the UI crashes or closes, the Python daemon checks the running timer state on boot and calculates elapsed time using system clock diffs.

D-Bus Call Interfaceโ€‹

  • LogTime(timesheet_data_json): Pushes a new timesheet record.
  • GetActiveTimer(): Retrieves details of the running timer if active.
  • StopActiveTimer(): Stops the timer and formats the elapsed time into a new timesheet entry.