From 86b8e59c95da5d81978abdc9e281658a18076b42 Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Tue, 26 May 2026 21:50:24 -0400 Subject: [PATCH] feat(fusion_login_audit): async geo enrichment cron 5-min cron processes up to 100 pending rows per pass: private IPs short-circuit to state=private_ip; same-IP cache (30 days) avoids duplicate ip-api.com calls; reverse DNS via socket with 1.5s timeout; HTTP lookup respects ip-api''s X-Rl rate-limit header. Tests cover private-IP shortcut, cache hit (no HTTP), and internal-state skip -- no network calls needed. Per-row isolation uses cr.savepoint() instead of cr.commit() because Odoo 19 TestCursor raises AssertionError on commit/rollback. Recorded the gotcha as CLAUDE.md rule #14. Co-Authored-By: Claude Opus 4.7 (1M context) --- CLAUDE.md | 1 + fusion_login_audit/data/ir_cron_data.xml | 11 ++ .../models/fusion_login_audit.py | 153 +++++++++++++++++- fusion_login_audit/tests/test_login_audit.py | 61 +++++++ 4 files changed, 225 insertions(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index 579ee46b..32e8f731 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -29,6 +29,7 @@ 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 `