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.

19 lines
721 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2016 Odoo SA <https://www.odoo.com>
  3. # Copyright 2018 Therp BV <http://therp.nl>
  4. # Copyright 2018 Eficent <http://www.eficent.com>
  5. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
  6. from odoo import api, models
  7. class MailActivity(models.Model):
  8. _inherit = "mail.activity"
  9. @api.multi
  10. def action_create_calendar_event(self):
  11. action = super(MailActivity, self).action_create_calendar_event()
  12. res_model = self.env.context.get('default_res_model', False)
  13. if res_model and res_model == 'crm.lead':
  14. action['context']['default_opportunity_id'] = \
  15. self.env.context.get('default_res_id')
  16. return action