You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
560 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2017 LasLabs Inc.
  3. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
  4. from odoo import api, models
  5. from ..status_constants import OFFLINE
  6. class ResPartner(models.Model):
  7. _inherit = 'res.partner'
  8. @api.multi
  9. def _compute_im_status(self):
  10. bus_recs = self.env['bus.presence'].search([
  11. ('partner_id', 'in', self.ids),
  12. ])
  13. statuses = bus_recs._get_partners_statuses()
  14. for record in self:
  15. record.im_status = statuses.get(record.id, OFFLINE)