This commit is contained in:
gsinghpal
2026-03-16 08:14:56 -04:00
parent fdca9518ab
commit e56974d46f
196 changed files with 19739 additions and 3471 deletions

View File

@@ -8,7 +8,7 @@ from odoo import models, fields, api
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
# -- Work Schedule --
# ── Work Schedule ──────────────────────────────────────────────────
fclk_default_clock_in_time = fields.Float(
string='Default Clock-In Time',
config_parameter='fusion_clock.default_clock_in_time',
@@ -21,20 +21,18 @@ class ResConfigSettings(models.TransientModel):
default=17.0,
help="Default scheduled clock-out time (24h format, e.g. 17.0 = 5:00 PM).",
)
# -- Break --
fclk_default_break_minutes = fields.Float(
string='Default Break Duration (min)',
config_parameter='fusion_clock.default_break_minutes',
default=30.0,
help="Default unpaid break duration in minutes.",
)
fclk_auto_deduct_break = fields.Boolean(
string='Auto-Deduct Break',
config_parameter='fusion_clock.auto_deduct_break',
default=True,
help="Automatically deduct break from worked hours on clock-out.",
)
fclk_default_break_minutes = fields.Float(
string='Default Break Duration (min)',
config_parameter='fusion_clock.default_break_minutes',
default=30.0,
help="Default unpaid break duration in minutes.",
)
fclk_break_threshold_hours = fields.Float(
string='Break Threshold (hours)',
config_parameter='fusion_clock.break_threshold_hours',
@@ -42,30 +40,30 @@ class ResConfigSettings(models.TransientModel):
help="Only deduct break if shift is longer than this many hours.",
)
# -- Grace Period & Auto Clock-Out --
# ── Attendance Rules ───────────────────────────────────────────────
fclk_enable_auto_clockout = fields.Boolean(
string='Enable Auto Clock-Out',
config_parameter='fusion_clock.enable_auto_clockout',
default=True,
help="Automatically clock out employees who forget. Triggers after shift end time plus grace period, or after max shift hours.",
)
fclk_grace_period_minutes = fields.Float(
string='Grace Period (min)',
config_parameter='fusion_clock.grace_period_minutes',
default=15.0,
help="Minutes allowed after scheduled end before auto clock-out.",
)
fclk_enable_auto_clockout = fields.Boolean(
string='Enable Auto Clock-Out',
config_parameter='fusion_clock.enable_auto_clockout',
default=True,
)
fclk_max_shift_hours = fields.Float(
string='Max Shift Length (hours)',
config_parameter='fusion_clock.max_shift_hours',
default=12.0,
help="Maximum shift length before auto clock-out (safety net).",
)
# -- Penalties --
fclk_enable_penalties = fields.Boolean(
string='Enable Penalty Tracking',
config_parameter='fusion_clock.enable_penalties',
default=True,
help="Deduct minutes from worked hours when employees clock in late or clock out early.",
)
fclk_penalty_grace_minutes = fields.Float(
string='Penalty Grace (min)',
@@ -79,8 +77,26 @@ class ResConfigSettings(models.TransientModel):
default=15.0,
help="Minutes deducted from worked hours per penalty occurrence.",
)
fclk_enable_overtime = fields.Boolean(
string='Enable Overtime Tracking',
config_parameter='fusion_clock.enable_overtime',
default=True,
help="Calculate and track overtime when net hours exceed the daily or weekly threshold.",
)
fclk_daily_overtime_threshold = fields.Float(
string='Daily OT Threshold (hours)',
config_parameter='fusion_clock.daily_overtime_threshold',
default=8.0,
help="Net hours beyond this threshold count as daily overtime.",
)
fclk_weekly_overtime_threshold = fields.Float(
string='Weekly OT Threshold (hours)',
config_parameter='fusion_clock.weekly_overtime_threshold',
default=40.0,
help="Net hours beyond this threshold count as weekly overtime.",
)
# -- Office User & Notifications --
# ── Notifications ──────────────────────────────────────────────────
fclk_office_user_id = fields.Many2one(
'res.users',
string='Office User',
@@ -123,26 +139,7 @@ class ResConfigSettings(models.TransientModel):
help="Send weekly attendance summary to each employee on Monday.",
)
# -- Overtime --
fclk_enable_overtime = fields.Boolean(
string='Enable Overtime Tracking',
config_parameter='fusion_clock.enable_overtime',
default=True,
)
fclk_daily_overtime_threshold = fields.Float(
string='Daily OT Threshold (hours)',
config_parameter='fusion_clock.daily_overtime_threshold',
default=8.0,
help="Net hours beyond this threshold count as daily overtime.",
)
fclk_weekly_overtime_threshold = fields.Float(
string='Weekly OT Threshold (hours)',
config_parameter='fusion_clock.weekly_overtime_threshold',
default=40.0,
help="Net hours beyond this threshold count as weekly overtime.",
)
# -- Location --
# ── Location & Verification ────────────────────────────────────────
fclk_enable_ip_fallback = fields.Boolean(
string='Enable IP Fallback',
config_parameter='fusion_clock.enable_ip_fallback',
@@ -155,12 +152,17 @@ class ResConfigSettings(models.TransientModel):
default=False,
help="Global toggle for selfie verification on clock-in (per-location control).",
)
fclk_google_maps_api_key = fields.Char(
string='Google Maps API Key',
config_parameter='fusion_clock.google_maps_api_key',
)
# -- Kiosk --
# ── Kiosk & Portal ─────────────────────────────────────────────────
fclk_enable_kiosk = fields.Boolean(
string='Enable Kiosk Mode',
config_parameter='fusion_clock.enable_kiosk',
default=False,
help="Allow employees to clock in/out from a shared device using their PIN code.",
)
fclk_kiosk_pin_required = fields.Boolean(
string='Require PIN for Kiosk',
@@ -168,23 +170,20 @@ class ResConfigSettings(models.TransientModel):
default=True,
help="Require employees to enter a PIN when using kiosk mode.",
)
# -- Corrections --
fclk_enable_correction_requests = fields.Boolean(
string='Enable Correction Requests',
config_parameter='fusion_clock.enable_correction_requests',
default=True,
help="Allow employees to request timesheet corrections from the portal.",
)
# -- CSV Export --
fclk_csv_column_mapping = fields.Char(
string='CSV Column Mapping',
config_parameter='fusion_clock.csv_column_mapping',
help="Custom column names for CSV export (JSON format). Leave blank for defaults.",
fclk_enable_sounds = fields.Boolean(
string='Enable Clock Sounds',
config_parameter='fusion_clock.enable_sounds',
default=True,
help="Play audio confirmation sounds when employees clock in or out.",
)
# -- Pay Period --
# ── Pay Period & Reports ───────────────────────────────────────────
fclk_pay_period_type = fields.Selection(
[
('weekly', 'Weekly'),
@@ -195,42 +194,42 @@ class ResConfigSettings(models.TransientModel):
string='Pay Period',
config_parameter='fusion_clock.pay_period_type',
default='biweekly',
help="How often attendance reports are generated.",
)
fclk_pay_period_start = fields.Char(
string='Pay Period Anchor Date',
config_parameter='fusion_clock.pay_period_start',
help="Start date for pay period calculations (YYYY-MM-DD format).",
)
# -- Reports --
fclk_auto_generate_reports = fields.Boolean(
string='Auto-Generate Reports',
config_parameter='fusion_clock.auto_generate_reports',
default=True,
help="Automatically create attendance reports at the end of each pay period.",
)
fclk_send_employee_reports = fields.Boolean(
string='Send Employee Copies',
config_parameter='fusion_clock.send_employee_reports',
default=True,
help="Send each employee a copy of their individual attendance report.",
)
fclk_report_recipient_user_ids = fields.Many2many(
'res.users',
'fclk_report_recipient_user_rel',
'config_id',
'user_id',
string='Internal Report Recipients',
help="Internal users who will receive batch reports.",
)
fclk_report_recipient_emails = fields.Char(
string='Report Recipient Emails',
config_parameter='fusion_clock.report_recipient_emails',
help="Comma-separated email addresses for batch report delivery.",
)
fclk_send_employee_reports = fields.Boolean(
string='Send Employee Copies',
config_parameter='fusion_clock.send_employee_reports',
default=True,
help="Send individual report copies to each employee's work email.",
)
# -- Google Maps --
fclk_google_maps_api_key = fields.Char(
string='Google Maps API Key',
config_parameter='fusion_clock.google_maps_api_key',
)
# -- Sounds --
fclk_enable_sounds = fields.Boolean(
string='Enable Clock Sounds',
config_parameter='fusion_clock.enable_sounds',
default=True,
fclk_csv_column_mapping = fields.Char(
string='CSV Column Mapping',
config_parameter='fusion_clock.csv_column_mapping',
help="Custom column names for CSV export (JSON format). Leave blank for defaults.",
)
def set_values(self):
@@ -240,6 +239,11 @@ class ResConfigSettings(models.TransientModel):
ICP.set_param('fusion_clock.office_user_id', str(self.fclk_office_user_id.id))
else:
ICP.set_param('fusion_clock.office_user_id', '0')
if self.fclk_report_recipient_user_ids:
ICP.set_param('fusion_clock.report_recipient_user_ids',
','.join(str(uid) for uid in self.fclk_report_recipient_user_ids.ids))
else:
ICP.set_param('fusion_clock.report_recipient_user_ids', '')
@api.model
def get_values(self):
@@ -248,4 +252,11 @@ class ResConfigSettings(models.TransientModel):
office_user_id = int(ICP.get_param('fusion_clock.office_user_id', '0'))
if office_user_id:
res['fclk_office_user_id'] = office_user_id
user_ids_str = ICP.get_param('fusion_clock.report_recipient_user_ids', '')
if user_ids_str:
try:
user_ids = [int(x) for x in user_ids_str.split(',') if x.strip()]
res['fclk_report_recipient_user_ids'] = [(6, 0, user_ids)]
except (ValueError, TypeError):
pass
return res