[MERGE] from master
[odoo/odoo.git] / addons / mail / mail_message_subtype.py
1 # -*- coding: utf-8 -*-
2 ##############################################################################
3 #
4 #    OpenERP, Open Source Management Solution
5 #    Copyright (C) 2012-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 openerp.osv import osv
23 from openerp.osv import fields
24
25
26 class mail_message_subtype(osv.osv):
27     """ Class holding subtype definition for messages. Subtypes allow to tune
28         the follower subscription, allowing only some subtypes to be pushed
29         on the Wall. """
30     _name = 'mail.message.subtype'
31     _description = 'Message subtypes'
32     _order = 'sequence, id'
33
34     _columns = {
35         'name': fields.char('Message Type', required=True, translate=True,
36             help='Message subtype gives a more precise type on the message, '\
37                     'especially for system notifications. For example, it can be '\
38                     'a notification related to a new record (New), or to a stage '\
39                     'change in a process (Stage change). Message subtypes allow to '\
40                     'precisely tune the notifications the user want to receive on its wall.'),
41         'description': fields.text('Description', translate=True,
42             help='Description that will be added in the message posted for this '\
43                     'subtype. If void, the name will be added instead.'),
44         'parent_id': fields.many2one('mail.message.subtype', string='Parent',
45             ondelete='set null',
46             help='Parent subtype, used for automatic subscription.'),
47         'relation_field': fields.char('Relation field',
48             help='Field used to link the related model to the subtype model when '\
49                     'using automatic subscription on a related document. The field '\
50                     'is used to compute getattr(related_document.relation_field).'),
51         'res_model': fields.char('Model',
52             help="Model the subtype applies to. If False, this subtype applies to all models."),
53         'default': fields.boolean('Default',
54             help="Activated by default when subscribing."),
55         'sequence': fields.integer('Sequence', help="Used to order subtypes."),
56         'hidden': fields.boolean('Hidden', help="Hide the subtype in the follower options")
57     }
58
59     _defaults = {
60         'default': True,
61         'sequence': 1,
62     }