fix(fusion_clock): tz resolver uses company.partner_id.tz (res.company has no tz in Odoo 19)

_resolve_tz fell back to env.company.tz, which raises AttributeError for any
user without a personal tz (surfaced by the new list-wide pay-period filters,
which resolve a company-level tz). Use env.company.partner_id.tz. Regression
test added. Bump 3.15.0 -> 3.15.1.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-31 11:23:27 -04:00
parent 3f78f652e7
commit 1a1ab2da4f
3 changed files with 20 additions and 6 deletions

View File

@@ -84,6 +84,18 @@ class TestPayPeriodFilters(TransactionCase):
'check_out': eight_ago,
})
def test_resolve_tz_company_fallback_when_user_has_no_tz(self):
# Regression: res.company has no `tz` field in Odoo 19; the resolver must
# fall back to env.company.partner_id.tz, not env.company.tz, or a
# tz-less user crashes the period filters with AttributeError.
self.env.user.tz = False
self.env.company.partner_id.tz = 'America/Toronto'
res = self.env['hr.attendance'].search([
('employee_id', '=', self.emp.id),
('x_fclk_in_current_period', '=', True),
])
self.assertIn(self.att_current, res)
def test_current_filter_returns_only_current(self):
res = self.env['hr.attendance'].search([
('employee_id', '=', self.emp.id),