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_subscription(osv.osv):
27 mail_subscription holds the data related to the follow mechanism inside OpenERP.
28 A subscription is characterized by:
29 :param: res_model: model of the followed objects
30 :param: res_id: ID of resource (may be 0 for every objects)
31 :param: user_id: user_id of the follower
33 _name = 'mail.subscription'
35 _order = 'res_model asc'
36 _description = 'Mail subscription'
38 'res_model': fields.char('Related Document Model', size=128,
39 required=True, select=1,
40 help='Model of the followed resource'),
41 'res_id': fields.integer('Related Document ID', select=1,
42 help='Id of the followed resource'),
43 'user_id': fields.many2one('res.users', string='Related User',
44 ondelete='cascade', required=True, select=1),
47 class mail_subscription_hide(osv.osv):
49 mail_subscription_hide holds the data to store the hiden notifications
50 on the Wall. Hide choices are related to a subscription, not a model
52 :param: subscription_id: the related subscription
53 :param: subtype: the message subtype hiden
55 _name = 'mail.subscription.hide'
58 _description = 'Hidden subscription'
60 'subscription_id': fields.many2one('mail.subscription', string='Subscription',
61 ondelete='cascade', required=True, select=1),
62 'subtype': fields.char('Message subtype', size=64,
63 required=True, help='Message subtype is a string that depends on the related model.'),
66 class mail_notification(osv.osv):
68 mail_notification is a relational table modeling messages pushed to users.
69 :param: read: not used currently
71 _name = 'mail.notification'
74 _order = 'message_id desc'
75 _description = 'Mail notification'
77 'user_id': fields.many2one('res.users', string='User',
78 ondelete='cascade', required=True, select=1),
79 'message_id': fields.many2one('mail.message', string='Message',
80 ondelete='cascade', required=True, select=1),
81 'read': fields.boolean('Read', help="Not used currently",),
82 # TODO: add a timestamp ? or use message date ?