1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2009-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 ##############################################################################
23 from osv import fields
25 class mail_followers(osv.Model):
26 """ mail_followers holds the data related to the follow mechanism inside
27 OpenERP. Users can choose to follow documents (records) of any kind that
28 inherits from mail.thread. Following documents allow to receive
29 notifications for new messages.
30 A subscription is characterized by:
31 :param: res_model: model of the followed objects
32 :param: res_id: ID of resource (may be 0 for every objects)
33 :param: user_id: user_id of the follower
35 _name = 'mail.followers'
38 _order = 'res_model asc'
39 _description = 'Mail Document Followers'
41 'res_model': fields.char('Related Document Model', size=128,
42 required=True, select=1,
43 help='Model of the followed resource'),
44 'res_id': fields.integer('Related Document ID', select=1,
45 help='Id of the followed resource'),
46 'user_id': fields.many2one('res.users', string='Related User',
47 ondelete='cascade', required=True, select=1),
50 class mail_notification(osv.Model):
51 """ mail_notification is a relational table modeling messages pushed to users.
53 _name = 'mail.notification'
56 _order = 'message_id desc'
57 _description = 'Mail notification'
59 'user_id': fields.many2one('res.users', string='User',
60 ondelete='cascade', required=True, select=1),
61 'message_id': fields.many2one('mail.message', string='Message',
62 ondelete='cascade', required=True, select=1),