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:
@@ -113,9 +113,9 @@ class AbAiBot(models.Model):
|
||||
[('login', 'in', ('activeblue_ai_bot', 'activeblue_ai_bot@local'))], limit=1)
|
||||
if not bot_user:
|
||||
return
|
||||
Presence = self.env.get('bus.presence')
|
||||
if Presence is None:
|
||||
if 'bus.presence' not in self.env:
|
||||
return
|
||||
Presence = self.env['bus.presence']
|
||||
status = 'online' if online else 'offline'
|
||||
now = fields.Datetime.now()
|
||||
rec = Presence.sudo().search([('user_id', '=', bot_user.id)], limit=1)
|
||||
|
||||
Reference in New Issue
Block a user