[IMP] mail: composition form: removed default body_html;
[odoo/odoo.git] / addons / mail / mail_subscription.py
1 # -*- coding: utf-8 -*-
2 ##############################################################################
3 #
4 #    OpenERP, Open Source Management Solution
5 #    Copyright (C) 2009-today OpenERP SA (<http://www.openerp.com>)
6 #
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
11 #
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
16 #
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/>
19 #
20 ##############################################################################
21
22 from osv import osv
23 from osv import fields
24
25 class mail_subscription(osv.osv):
26     """
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
32     """
33     _name = 'mail.subscription'
34     _rec_name = 'id'
35     _order = 'res_model asc'
36     _description = 'Mail subscription'
37     _columns = {
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),
45     }
46
47 class mail_subscription_hide(osv.osv):
48     """
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
51     or a user.
52         :param: subscription_id: the related subscription
53         :param: subtype: the message subtype hiden
54     """
55     _name = 'mail.subscription.hide'
56     _rec_name = 'id'
57     _order = 'id desc'
58     _description = 'Hidden subscription'
59     _columns = {
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.'),
64     }
65
66 class mail_notification(osv.osv):
67     """
68     mail_notification is a relational table modeling messages pushed to users.
69         :param: read: not used currently
70     """
71     _name = 'mail.notification'
72     _rec_name = 'id'
73     _log_access = False
74     _order = 'message_id desc'
75     _description = 'Mail notification'
76     _columns = {
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 ?
83     }
84     _defaults = {
85         'read': False,
86     }