This commit is contained in:
gsinghpal
2026-02-27 14:32:32 -05:00
parent b649246e81
commit b925766966
80 changed files with 7831 additions and 1041 deletions

View File

@@ -38,7 +38,7 @@ class ResConfigSettings(models.TransientModel):
fclk_break_threshold_hours = fields.Float(
string='Break Threshold (hours)',
config_parameter='fusion_clock.break_threshold_hours',
default=5.0,
default=4.0,
help="Only deduct break if shift is longer than this many hours.",
)
@@ -73,6 +73,116 @@ class ResConfigSettings(models.TransientModel):
default=5.0,
help="Minutes of grace before a late/early penalty is recorded.",
)
fclk_penalty_deduction_minutes = fields.Float(
string='Penalty Deduction (min)',
config_parameter='fusion_clock.penalty_deduction_minutes',
default=15.0,
help="Minutes deducted from worked hours per penalty occurrence.",
)
# -- Office User & Notifications --
fclk_office_user_id = fields.Many2one(
'res.users',
string='Office User',
help="User who receives activity notifications for attendance issues.",
)
fclk_very_late_threshold_minutes = fields.Float(
string='Very Late Threshold (min)',
config_parameter='fusion_clock.very_late_threshold_minutes',
default=15.0,
help="Minutes late before an activity is scheduled for the office user.",
)
fclk_max_monthly_absences = fields.Integer(
string='Max Monthly Absences',
config_parameter='fusion_clock.max_monthly_absences',
default=3,
help="Alert office user when an employee reaches this many absences in a month.",
)
fclk_enable_employee_notifications = fields.Boolean(
string='Enable Employee Notifications',
config_parameter='fusion_clock.enable_employee_notifications',
default=True,
help="Send clock-in/out reminders to employees.",
)
fclk_reminder_before_shift_minutes = fields.Float(
string='Remind After Shift Start (min)',
config_parameter='fusion_clock.reminder_before_shift_minutes',
default=30.0,
help="Send reminder if employee hasn't clocked in this many minutes after shift start.",
)
fclk_reminder_before_end_minutes = fields.Float(
string='Remind Before Shift End (min)',
config_parameter='fusion_clock.reminder_before_end_minutes',
default=15.0,
help="Send clock-out reminder this many minutes before shift end.",
)
fclk_send_weekly_summary = fields.Boolean(
string='Send Weekly Summary',
config_parameter='fusion_clock.send_weekly_summary',
default=True,
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 --
fclk_enable_ip_fallback = fields.Boolean(
string='Enable IP Fallback',
config_parameter='fusion_clock.enable_ip_fallback',
default=False,
help="Allow IP-based location verification when GPS is unavailable.",
)
fclk_enable_photo_verification = fields.Boolean(
string='Enable Photo Verification',
config_parameter='fusion_clock.enable_photo_verification',
default=False,
help="Global toggle for selfie verification on clock-in (per-location control).",
)
# -- Kiosk --
fclk_enable_kiosk = fields.Boolean(
string='Enable Kiosk Mode',
config_parameter='fusion_clock.enable_kiosk',
default=False,
)
fclk_kiosk_pin_required = fields.Boolean(
string='Require PIN for Kiosk',
config_parameter='fusion_clock.kiosk_pin_required',
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.",
)
# -- Pay Period --
fclk_pay_period_type = fields.Selection(
@@ -89,7 +199,7 @@ class ResConfigSettings(models.TransientModel):
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, anchor for weekly/biweekly).",
help="Start date for pay period calculations (YYYY-MM-DD format).",
)
# -- Reports --
@@ -122,3 +232,20 @@ class ResConfigSettings(models.TransientModel):
config_parameter='fusion_clock.enable_sounds',
default=True,
)
def set_values(self):
super().set_values()
ICP = self.env['ir.config_parameter'].sudo()
if self.fclk_office_user_id:
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')
@api.model
def get_values(self):
res = super().get_values()
ICP = self.env['ir.config_parameter'].sudo()
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
return res