fix(addon): correct existence check for bus.presence model

env.get() isn't an Odoo Environment method, so the existence guard
silently returned without ever writing the bot's presence row. Use the
'in self.env' check instead.
This commit is contained in:
Carlos Garcia
2026-04-25 17:10:35 -04:00
parent 5e9b4b244c
commit 38fa508e0f

View File

@@ -113,9 +113,9 @@ class AbAiBot(models.Model):
[('login', 'in', ('activeblue_ai_bot', 'activeblue_ai_bot@local'))], limit=1) [('login', 'in', ('activeblue_ai_bot', 'activeblue_ai_bot@local'))], limit=1)
if not bot_user: if not bot_user:
return return
Presence = self.env.get('bus.presence') if 'bus.presence' not in self.env:
if Presence is None:
return return
Presence = self.env['bus.presence']
status = 'online' if online else 'offline' status = 'online' if online else 'offline'
now = fields.Datetime.now() now = fields.Datetime.now()
rec = Presence.sudo().search([('user_id', '=', bot_user.id)], limit=1) rec = Presence.sudo().search([('user_id', '=', bot_user.id)], limit=1)