2012-02-01 16:49:02 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
##############################################################################
|
|
|
|
#
|
|
|
|
# OpenERP, Open Source Management Solution
|
|
|
|
# Copyright (C) 2010-2011 OpenERP SA (<http://www.openerp.com>)
|
|
|
|
#
|
|
|
|
# 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/>
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
import tools
|
|
|
|
from osv import osv
|
|
|
|
from osv import fields
|
|
|
|
from tools.translate import _
|
|
|
|
|
|
|
|
class mail_subscription(osv.osv):
|
|
|
|
"""
|
|
|
|
mail_subscription holds the data related to the follow mechanism inside OpenERP.
|
|
|
|
A subscription can be of following:
|
|
|
|
- res_model: model of the followed objects
|
|
|
|
- res_id: ID of resource OR
|
2012-02-02 11:26:57 +00:00
|
|
|
- res_domain: a domain filtering followed objects - currently removed
|
2012-02-01 16:49:02 +00:00
|
|
|
"""
|
|
|
|
_name = 'mail.subscription'
|
|
|
|
_rec_name = 'id'
|
|
|
|
_columns = {
|
2012-02-06 11:26:23 +00:00
|
|
|
'res_model': fields.char('Related Document Model', size=128,
|
|
|
|
select=1, required=True),
|
2012-02-01 16:49:02 +00:00
|
|
|
'res_id': fields.integer('Related Document ID', select=1),
|
2012-02-02 11:26:57 +00:00
|
|
|
#'res_domain': fields.char('res_domain', size=256),
|
2012-02-10 12:42:53 +00:00
|
|
|
'user_id': fields.many2one('res.users', string='Related User ID',
|
|
|
|
ondelete='cascade', required=True, select=1),
|
2012-02-01 16:49:02 +00:00
|
|
|
}
|
|
|
|
_defaults = {
|
|
|
|
}
|
|
|
|
mail_subscription()
|
2012-02-01 17:05:05 +00:00
|
|
|
|
|
|
|
class mail_notification(osv.osv):
|
|
|
|
"""
|
|
|
|
TODO
|
|
|
|
"""
|
|
|
|
_name = 'mail.notification'
|
|
|
|
_rec_name = 'id'
|
2012-02-06 09:06:18 +00:00
|
|
|
_log_access = False
|
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-02-01 17:05:05 +00:00
|
|
|
ondelete='cascade', required=True),
|
|
|
|
'read': fields.boolean('Read'),
|
2012-02-03 12:29:33 +00:00
|
|
|
# TODO: add a timestamp ? or use message date ?
|
2012-02-01 17:05:05 +00:00
|
|
|
}
|
|
|
|
_defaults = {
|
2012-02-02 11:26:57 +00:00
|
|
|
'read': False,
|
2012-02-01 17:05:05 +00:00
|
|
|
}
|
|
|
|
mail_notification()
|