2012-02-01 16:49:02 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
##############################################################################
|
|
|
|
#
|
|
|
|
# OpenERP, Open Source Management Solution
|
2012-03-13 15:24:52 +00:00
|
|
|
# Copyright (C) 2009-today OpenERP SA (<http://www.openerp.com>)
|
2012-02-01 16:49:02 +00:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Affero General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
|
|
# License, or (at your option) any later version
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Affero General Public License for more details
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
from osv import osv
|
|
|
|
from osv import fields
|
|
|
|
|
2012-08-13 19:10:06 +00:00
|
|
|
class mail_followers(osv.Model):
|
|
|
|
""" mail_followers holds the data related to the follow mechanism inside
|
|
|
|
OpenERP. Users can choose to follow documents (records) of any kind that
|
|
|
|
inherits from mail.thread. Following documents allow to receive
|
|
|
|
notifications for new messages.
|
2012-03-13 15:24:52 +00:00
|
|
|
A subscription is characterized by:
|
2012-04-02 12:59:26 +00:00
|
|
|
:param: res_model: model of the followed objects
|
|
|
|
:param: res_id: ID of resource (may be 0 for every objects)
|
|
|
|
:param: user_id: user_id of the follower
|
2012-02-01 16:49:02 +00:00
|
|
|
"""
|
2012-08-13 19:10:06 +00:00
|
|
|
_name = 'mail.followers'
|
2012-02-01 16:49:02 +00:00
|
|
|
_rec_name = 'id'
|
2012-08-09 14:43:45 +00:00
|
|
|
_log_access = False
|
2012-03-13 15:24:52 +00:00
|
|
|
_order = 'res_model asc'
|
2012-08-13 19:10:06 +00:00
|
|
|
_description = 'Mail Document Followers'
|
2012-02-01 16:49:02 +00:00
|
|
|
_columns = {
|
2012-02-06 11:26:23 +00:00
|
|
|
'res_model': fields.char('Related Document Model', size=128,
|
2012-04-02 12:59:26 +00:00
|
|
|
required=True, select=1,
|
|
|
|
help='Model of the followed resource'),
|
|
|
|
'res_id': fields.integer('Related Document ID', select=1,
|
|
|
|
help='Id of the followed resource'),
|
|
|
|
'user_id': fields.many2one('res.users', string='Related User',
|
2012-02-10 12:42:53 +00:00
|
|
|
ondelete='cascade', required=True, select=1),
|
2012-02-01 16:49:02 +00:00
|
|
|
}
|
2012-02-01 17:05:05 +00:00
|
|
|
|
2012-08-09 14:43:45 +00:00
|
|
|
class mail_notification(osv.Model):
|
2012-08-13 19:10:06 +00:00
|
|
|
""" mail_notification is a relational table modeling messages pushed to users.
|
2012-02-01 17:05:05 +00:00
|
|
|
"""
|
|
|
|
_name = 'mail.notification'
|
|
|
|
_rec_name = 'id'
|
2012-02-06 09:06:18 +00:00
|
|
|
_log_access = False
|
2012-03-13 15:24:52 +00:00
|
|
|
_order = 'message_id desc'
|
2012-03-29 16:10:32 +00:00
|
|
|
_description = 'Mail notification'
|
2012-02-01 17:05:05 +00:00
|
|
|
_columns = {
|
2012-02-02 09:48:45 +00:00
|
|
|
'user_id': fields.many2one('res.users', string='User',
|
2012-02-06 09:06:18 +00:00
|
|
|
ondelete='cascade', required=True, select=1),
|
2012-02-02 09:48:45 +00:00
|
|
|
'message_id': fields.many2one('mail.message', string='Message',
|
2012-03-13 15:24:52 +00:00
|
|
|
ondelete='cascade', required=True, select=1),
|
2012-02-01 17:05:05 +00:00
|
|
|
}
|