[FIX] Do not focus unfocusable fields
[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_notification(osv.osv):
48     """
49     mail_notification is a relational table modeling messages pushed to users.
50         :param: read: not used currently
51     """
52     _name = 'mail.notification'
53     _rec_name = 'id'
54     _log_access = False
55     _order = 'message_id desc'
56     _description = 'Mail notification'
57     _columns = {
58         'user_id': fields.many2one('res.users', string='User',
59                         ondelete='cascade', required=True, select=1),
60         'message_id': fields.many2one('mail.message', string='Message',
61                         ondelete='cascade', required=True, select=1),
62         'read': fields.boolean('Read', help="Not used currently",),
63         # TODO: add a timestamp ? or use message date ?
64     }
65     _defaults = {
66         'read': False,
67     }