From 1b8038d8e82c81512be03dc9525b39647014d274 Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Tue, 26 May 2026 21:46:23 -0400 Subject: [PATCH] feat(fusion_login_audit): nightly retention GC cron Adds _fc_retention_gc() that deletes rows older than the configured horizon (default 365 days; 0 = keep forever). Registered as a daily ir.cron. Tests verify both the delete path and the "keep forever" short-circuit. Also documents the Odoo 19 gotcha that ir.cron dropped the numbercall field (the legacy "-1 = run forever" pattern now raises ValueError at install time; just omit the field). Co-Authored-By: Claude Opus 4.7 (1M context) --- CLAUDE.md | 2 + fusion_login_audit/__manifest__.py | 1 + fusion_login_audit/data/ir_cron_data.xml | 16 +++++++ .../models/fusion_login_audit.py | 22 ++++++++- fusion_login_audit/tests/test_login_audit.py | 48 +++++++++++++++++++ 5 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 fusion_login_audit/data/ir_cron_data.xml diff --git a/CLAUDE.md b/CLAUDE.md index 3ef13c0c..579ee46b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -27,6 +27,8 @@ The attribute name after the leading underscore becomes the SQL object name suffix (`{table}_{suffix}`). `models.Index` accepts `DESC`, `WHERE` predicates, and `USING btree (...)`. Sources: `odoo/orm/model_classes.py` (warns at registry build), `odoo/orm/table_objects.py` (Constraint + Index classes). 10. **`res.users._login` is an instance method in Odoo 19**, not a classmethod as in earlier versions. Signature is `def _login(self, credential, user_agent_env)` — there is no `db` parameter. Override it like any normal instance method (`super()._login(credential, user_agent_env)`). When called via `authenticate()` on an empty recordset, `self` carries the right env. Older recipes that build a separate `api.Environment` from `odoo.modules.registry.Registry(db)` no longer apply. Source: `odoo/addons/base/models/res_users.py:760`. 11. **Inherited `ir.ui.view` records cannot have `groups`/`group_ids` on the record itself.** Odoo 19 raises `ParseError: Inherited view cannot have 'groups' defined on the record. Use 'groups' attributes inside the view definition` at install time. Move the gate to the inner XML nodes — every `