Four x_fc_* fields on res.config.settings backed by ir.config_parameter: retention_days (default 365, 0 = forever), alert_threshold (5), alert_window_min (15), alert_enabled (True). New "Login Audit" block on the General Settings page (gated by base.group_system on the block, NOT on the inherited view record per CLAUDE.md rule #11). CLAUDE.md gotchas added during this task: #5 Boolean config_parameter fields don't round-trip "False" as a string — IrConfigParameter.set_param deletes the row on falsy. Test with assertFalse, never assertEqual(..., "False"). #6 ir.ui.view uses group_ids (Odoo 19 rename mirrored from res.users). Setting groups_id on an ir.ui.view record raises ValueError at install. (The XML attribute groups="..." on inner nodes is unrelated and still works.) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
37 lines
1.7 KiB
XML
37 lines
1.7 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
|
|
<record id="view_res_config_settings_form_login_audit" model="ir.ui.view">
|
|
<field name="name">res.config.settings.form.login.audit</field>
|
|
<field name="model">res.config.settings</field>
|
|
<field name="inherit_id" ref="base_setup.res_config_settings_view_form"/>
|
|
<field name="arch" type="xml">
|
|
<xpath expr="//block[@id='user_default_rights']" position="after">
|
|
<block title="Login Audit"
|
|
name="login_audit_block"
|
|
groups="base.group_system">
|
|
<setting id="login_audit_retention"
|
|
string="Retention (days)"
|
|
help="0 = keep forever">
|
|
<field name="x_fc_login_audit_retention_days"/>
|
|
</setting>
|
|
<setting id="login_audit_alert_enabled"
|
|
string="Send failed-login alerts"
|
|
help="Email Settings admins when consecutive failures cross the threshold">
|
|
<field name="x_fc_login_audit_alert_enabled"/>
|
|
</setting>
|
|
<setting id="login_audit_alert_threshold"
|
|
string="Alert threshold (failures)">
|
|
<field name="x_fc_login_audit_alert_threshold"/>
|
|
</setting>
|
|
<setting id="login_audit_alert_window"
|
|
string="Alert window (minutes)">
|
|
<field name="x_fc_login_audit_alert_window_min"/>
|
|
</setting>
|
|
</block>
|
|
</xpath>
|
|
</field>
|
|
</record>
|
|
|
|
</odoo>
|