fix(fusion_clock): settings audit — remove 2 dead knobs, make IP-fallback + all Boolean toggles work

Audit of all 41 settings found 3 that were shown but read nowhere, and 17 Boolean
toggles that couldn't be turned OFF.

- Remove grace_period_minutes (orphaned by the schedule-driven cron rewrite) and
  weekly_overtime_threshold (never implemented): field + view + seed.
- enable_ip_fallback now actually gates _verify_location's IP-whitelist check
  (default ON to preserve current behaviour).
- All 17 fusion_clock Boolean settings now persist explicitly as 'True'/'False'
  via a _FCLK_BOOL_PARAMS loop in get_values/set_values (config_parameter Booleans
  can't store False, so OFF never stuck). Add round-trip tests. Bump 3.15.2 -> 3.16.0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-31 11:51:40 -04:00
parent 31098c4d14
commit d6d6bbe161
8 changed files with 88 additions and 58 deletions

View File

@@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
from odoo.tests import tagged, TransactionCase
@tagged('-at_install', 'post_install', 'fusion_clock')
class TestFusionClockSettings(TransactionCase):
"""The fusion_clock Boolean settings are persisted explicitly as
'True'/'False' so they can actually be turned OFF (a config_parameter
Boolean can't — Odoo deletes the row on a falsy value)."""
def _save(self, vals):
self.env['res.config.settings'].create(vals).set_values()
def test_boolean_toggle_off_persists(self):
ICP = self.env['ir.config_parameter'].sudo()
self._save({'fclk_enable_overtime': False})
self.assertEqual(ICP.get_param('fusion_clock.enable_overtime'), 'False')
# reopening Settings shows it OFF
self.assertFalse(self.env['res.config.settings'].get_values()['fclk_enable_overtime'])
def test_boolean_toggle_back_on_persists(self):
ICP = self.env['ir.config_parameter'].sudo()
self._save({'fclk_enable_overtime': False})
self._save({'fclk_enable_overtime': True})
self.assertEqual(ICP.get_param('fusion_clock.enable_overtime'), 'True')
self.assertTrue(self.env['res.config.settings'].get_values()['fclk_enable_overtime'])
def test_default_on_boolean_when_param_absent(self):
ICP = self.env['ir.config_parameter'].sudo()
# set_param with a falsy value deletes the row → simulates "never set"
ICP.set_param('fusion_clock.enable_ip_fallback', False)
self.assertTrue(self.env['res.config.settings'].get_values()['fclk_enable_ip_fallback'])
def test_default_off_boolean_when_param_absent(self):
ICP = self.env['ir.config_parameter'].sudo()
ICP.set_param('fusion_clock.enable_kiosk', False)
self.assertFalse(self.env['res.config.settings'].get_values()['fclk_enable_kiosk'])
def test_dead_settings_removed(self):
fields = self.env['res.config.settings']._fields
self.assertNotIn('fclk_grace_period_minutes', fields)
self.assertNotIn('fclk_weekly_overtime_threshold', fields)