Files
odoo_source/addons/crm/models/calendar.py
T
Ravi Gohil aa44700dcc [MIG] crm : migration to new API
Also adapt code in crm_partner_assign according to migration of crm.lead
2016-07-04 17:28:04 +02:00

19 lines
553 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class CalendarEvent(models.Model):
_inherit = 'calendar.event'
opportunity_id = fields.Many2one('crm.lead', 'Opportunity', domain="[('type', '=', 'opportunity')]")
@api.model
def create(self, vals):
event = super(CalendarEvent, self).create(vals)
if event.opportunity_id:
event.opportunity_id.log_meeting(event.name, event.start, event.duration)
return event