1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-today OpenERP SA (<http://www.openerp.com>)
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as
9 # published by the Free Software Foundation, either version 3 of the
10 # License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Affero General Public License for more details.
17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ##############################################################################
22 from osv import osv, fields
24 from tools.translate import _
27 from base_status.base_state import base_state
30 # crm.meeting is defined here so that it may be used by modules other than crm,
31 # without forcing the installation of crm.
34 class crm_meeting_type(osv.Model):
35 _name = 'crm.meeting.type'
36 _description = 'Meeting Type'
38 'name': fields.char('Name', size=64, required=True, translate=True),
41 class crm_meeting(base_state, osv.Model):
42 """ Model for CRM meetings """
44 _description = "Meeting"
46 _inherit = ["calendar.event", 'ir.needaction_mixin', "mail.thread"]
48 # base_state required fields
49 'create_date': fields.datetime('Creation Date', readonly=True),
50 'write_date': fields.datetime('Write Date', readonly=True),
51 'date_open': fields.datetime('Confirmed', readonly=True),
52 'date_closed': fields.datetime('Closed', readonly=True),
53 'partner_ids': fields.many2many('res.partner', 'crm_meeting_partner_rel', 'meeting_id','partner_id',
54 string='Attendees', states={'done': [('readonly', True)]}),
55 'state': fields.selection(
56 [('draft', 'Unconfirmed'), ('open', 'Confirmed'), ('cancel', 'Cancelled'), ('done', 'Done')],
57 string='Status', size=16, readonly=True),
59 'name': fields.char('Meeting Subject', size=128, required=True, states={'done': [('readonly', True)]}),
60 'categ_ids': fields.many2many('crm.meeting.type', 'meeting_category_rel',
61 'event_id', 'type_id', 'Tags'),
62 'attendee_ids': fields.many2many('calendar.attendee', 'meeting_attendee_rel',\
63 'event_id', 'attendee_id', 'Attendees', states={'done': [('readonly', True)]}),
69 # ----------------------------------------
71 # ----------------------------------------
73 def case_get_note_msg_prefix(self, cr, uid, id, context=None):
76 def case_open_send_note(self, cr, uid, ids, context=None):
77 return self.message_append_note(cr, uid, ids, body=_("Meeting has been <b>confirmed</b>."), context=context)
79 def case_close_send_note(self, cr, uid, ids, context=None):
80 return self.message_append_note(cr, uid, ids, body=_("Meeting has been <b>done</b>."), context=context)