From caf240daec0669d070675bc7a8a78c8e9bf01233 Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Thu, 14 May 2026 00:36:56 -0400 Subject: [PATCH] feat(fusion_clock): add NFC kiosk location to res.company MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds x_fclk_nfc_kiosk_location_id (Many2one → fusion.clock.location) to res.company so each company can designate which NFC kiosk location it uses. Two tests cover field assignment and default-false behaviour. Co-Authored-By: Claude Sonnet 4.6 --- fusion_clock/models/__init__.py | 1 + fusion_clock/models/res_company.py | 16 ++++++++++++++++ fusion_clock/tests/test_nfc_models.py | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 fusion_clock/models/res_company.py diff --git a/fusion_clock/models/__init__.py b/fusion_clock/models/__init__.py index b4643901..6e1d0c57 100644 --- a/fusion_clock/models/__init__.py +++ b/fusion_clock/models/__init__.py @@ -10,3 +10,4 @@ from . import clock_activity_log from . import clock_leave_request from . import clock_shift from . import clock_correction +from . import res_company diff --git a/fusion_clock/models/res_company.py b/fusion_clock/models/res_company.py new file mode 100644 index 00000000..7672f667 --- /dev/null +++ b/fusion_clock/models/res_company.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Nexa Systems Inc. +# License OPL-1 (Odoo Proprietary License v1.0) + +from odoo import models, fields + + +class ResCompany(models.Model): + _inherit = 'res.company' + + x_fclk_nfc_kiosk_location_id = fields.Many2one( + 'fusion.clock.location', + string='NFC Kiosk Location', + help="Designates which fusion.clock.location is bound to the NFC kiosk " + "for this company. Required when NFC kiosk is enabled.", + ) diff --git a/fusion_clock/tests/test_nfc_models.py b/fusion_clock/tests/test_nfc_models.py index fcbd31a1..c9338434 100644 --- a/fusion_clock/tests/test_nfc_models.py +++ b/fusion_clock/tests/test_nfc_models.py @@ -82,3 +82,22 @@ class TestNfcAttendanceFields(TransactionCase): 'description': 'Test unknown card log', }) self.assertEqual(log2.log_type, 'unknown_card_tap') + + +@tagged('-at_install', 'post_install', 'fusion_clock') +class TestNfcKioskCompanyField(TransactionCase): + + def test_company_has_nfc_kiosk_location(self): + company = self.env.company + location = self.env['fusion.clock.location'].create({ + 'name': 'Plant 1', + 'latitude': 43.65, + 'longitude': -79.38, + 'radius': 100, + }) + company.x_fclk_nfc_kiosk_location_id = location.id + self.assertEqual(company.x_fclk_nfc_kiosk_location_id, location) + + def test_company_field_defaults_to_false(self): + new_company = self.env['res.company'].create({'name': 'Test Co NFC'}) + self.assertFalse(new_company.x_fclk_nfc_kiosk_location_id)