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.
52 lines
1.9 KiB
52 lines
1.9 KiB
# -*- coding: utf-8 -*-
|
|
# Copyright 2016 Odoo SA <https://www.odoo.com>
|
|
# Copyright 2018 Eficent <http://www.eficent.com>
|
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
|
|
from openerp import api, models, fields, tools, _
|
|
|
|
|
|
class MailActivityType(models.Model):
|
|
_inherit = "mail.activity.type"
|
|
|
|
category = fields.Selection(selection_add=[('meeting', 'Meeting')])
|
|
|
|
|
|
class MailActivity(models.Model):
|
|
_inherit = "mail.activity"
|
|
|
|
calendar_event_id = fields.Many2one('calendar.event',
|
|
string="Calendar Meeting",
|
|
ondelete='cascade')
|
|
|
|
@api.multi
|
|
def action_create_calendar_event(self):
|
|
self.ensure_one()
|
|
action = self.env.ref('calendar.action_calendar_event').read()[0]
|
|
action['context'] = {
|
|
'default_activity_type_id': self.activity_type_id.id,
|
|
'default_res_id': self.env.context.get('default_res_id'),
|
|
'default_res_model': self.env.context.get('default_res_model'),
|
|
'default_name': self.summary,
|
|
'default_description': self.note and tools.html2plaintext(
|
|
self.note) or '',
|
|
'default_activity_ids': [(6, 0, self.ids)],
|
|
}
|
|
return action
|
|
|
|
def action_feedback(self, feedback=False):
|
|
events = self.mapped('calendar_event_id')
|
|
res = super(MailActivity, self).action_feedback(feedback)
|
|
if feedback:
|
|
for event in events:
|
|
description = event.description
|
|
description = '%s\n%s%s' % (description or '', _(
|
|
"Feedback: "), feedback)
|
|
event.write({'description': description})
|
|
return res
|
|
|
|
@api.one
|
|
def unlink_w_meeting(self):
|
|
events = self.mapped('calendar_event_id')
|
|
res = self.unlink()
|
|
events.unlink()
|
|
return res
|