This commit is contained in:
gsinghpal
2026-05-30 20:59:59 -04:00
parent 55da42e91f
commit 5c1f60b3b8
17 changed files with 147 additions and 56 deletions

View File

@@ -72,6 +72,17 @@ class FusionLoginAudit(models.Model):
string='Device Type', default='unknown',
)
database = fields.Char(string='Database', size=64)
login_kind = fields.Selection(
[
('interactive', 'Interactive'),
('service', 'Service / Automation'),
],
string='Login Kind', default='interactive', index=True,
help="Interactive = a real browser/HTTP login. Service = server-to-server "
"auth (XML-RPC/JSON-RPC, cron, inter-instance sync) with no HTTP "
"request. Service logins are hidden from the default Login Events "
"view to keep it focused on real user activity.",
)
# Odoo 19 replaces the legacy `_sql_constraints = [...]` list with
# declarative `models.Constraint` attributes. The plan template used the

View File

@@ -86,11 +86,16 @@ class ResUsers(models.Model):
else:
vals['device_type'] = 'unknown'
vals['geo_lookup_state'] = 'pending'
# A live HTTP request means a real browser/interactive login.
vals['login_kind'] = 'interactive'
else:
vals['ip_address'] = 'internal'
vals['user_agent_raw'] = '<no-request>'
vals['device_type'] = 'unknown'
vals['geo_lookup_state'] = 'internal'
# No HTTP request = server-to-server auth (XML-RPC/JSON-RPC, cron,
# inter-instance sync). Tagged so the default view can hide it.
vals['login_kind'] = 'service'
# _credential is accepted in the signature so callers (T6 _check_credentials,
# T7 _login) can hand the dict in without filtering. The helper deliberately
@@ -388,5 +393,6 @@ class ResUsers(models.Model):
'view_mode': 'list,form',
'domain': [('user_id', '=', self.id)],
'context': {'create': False, 'edit': False, 'delete': False,
'default_user_id': self.id},
'default_user_id': self.id,
'search_default_filter_interactive': 1},
}