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.

45 lines
1.4 KiB

  1. # Copyright 2018 David Juaneda - <djuaneda@sdi.es>
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  3. from odoo import api, models, fields
  4. class MailActivity(models.Model):
  5. _inherit = "mail.activity"
  6. res_model_id_name = fields.Char(
  7. related='res_model_id.name', string="Origin",
  8. readonly=True)
  9. duration = fields.Float(
  10. related='calendar_event_id.duration', readonly=True)
  11. calendar_event_id_start = fields.Datetime(
  12. related='calendar_event_id.start', readonly=True)
  13. calendar_event_id_partner_ids = fields.Many2many(
  14. related='calendar_event_id.partner_ids',
  15. readonly=True)
  16. @api.multi
  17. def open_origin(self):
  18. self.ensure_one()
  19. vid = self.env[self.res_model].browse(self.res_id).get_formview_id()
  20. response = {
  21. 'type': 'ir.actions.act_window',
  22. 'res_model': self.res_model,
  23. 'view_mode': 'form',
  24. 'res_id': self.res_id,
  25. 'target': 'current',
  26. 'flags': {
  27. 'form': {
  28. 'action_buttons': False
  29. }
  30. },
  31. 'views': [
  32. (vid, "form")
  33. ]
  34. }
  35. return response
  36. @api.model
  37. def action_activities_board(self):
  38. action = self.env.ref(
  39. 'mail_activity_board.open_boards_activities').read()[0]
  40. return action