@@ -23,12 +23,12 @@ class mail_mail(osv.Model):
|
||||
'message_id': fields.many2one('mail.message', 'Message', required=True, ondelete='cascade'),
|
||||
'mail_server_id': fields.many2one('ir.mail_server', 'Outgoing mail server', readonly=1),
|
||||
'state': fields.selection([
|
||||
('outgoing', 'Outgoing'),
|
||||
('sent', 'Sent'),
|
||||
('received', 'Received'),
|
||||
('exception', 'Delivery Failed'),
|
||||
('cancel', 'Cancelled'),
|
||||
], 'Status', readonly=True),
|
||||
('outgoing', 'Outgoing'),
|
||||
('sent', 'Sent'),
|
||||
('received', 'Received'),
|
||||
('exception', 'Delivery Failed'),
|
||||
('cancel', 'Cancelled'),
|
||||
], 'Status', readonly=True),
|
||||
'auto_delete': fields.boolean('Auto Delete',
|
||||
help="Permanently delete this email after sending it, to save space"),
|
||||
|
||||
@@ -97,10 +97,11 @@ class mail_mail(osv.Model):
|
||||
for param in (email_to, email_cc):
|
||||
if param and not isinstance(param, list):
|
||||
param = [param]
|
||||
partner_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).partner_id.id
|
||||
msg_vals = {
|
||||
'subject': subject,
|
||||
'date': fields.datetime.now(),
|
||||
'user_id': uid,
|
||||
'author_id': partner_id,
|
||||
'model': model,
|
||||
'res_id': res_id,
|
||||
'type': type,
|
||||
|
||||
@@ -94,9 +94,7 @@ class mail_message(osv.Model):
|
||||
help="Message type: email for email message, notification for system "\
|
||||
"message, comment for other messages such as user replies"),
|
||||
|
||||
# partner_id should be renamed into author_id, user_id removed
|
||||
'author_id': fields.many2one('res.partner', 'Author', required=True),
|
||||
|
||||
# this is redundant with notifications ? Yes
|
||||
'partner_ids': fields.many2many('res.partner',
|
||||
'mail_message_res_partner_rel',
|
||||
@@ -179,7 +177,7 @@ class mail_message(osv.Model):
|
||||
notification_obj = self.pool.get('mail.notification')
|
||||
modobj = self.pool.get(values.get('model'))
|
||||
follower_notify = []
|
||||
for follower in modobj.follower_ids:
|
||||
for follower in modobj.message_follower_ids:
|
||||
if follower.id <> uid:
|
||||
follower_notify.append(follower.id)
|
||||
self.pool.get('mail.notification').notify(cr, uid, follower_notify, newid, context=context)
|
||||
|
||||
@@ -28,7 +28,6 @@ class mail_subscription(osv.osv):
|
||||
A subscription is characterized by:
|
||||
: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
|
||||
"""
|
||||
_name = 'mail.subscription'
|
||||
_rec_name = 'id'
|
||||
@@ -40,7 +39,7 @@ class mail_subscription(osv.osv):
|
||||
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',
|
||||
'partner_id': fields.many2one('res.partner', string='Related User',
|
||||
ondelete='cascade', required=True, select=1),
|
||||
}
|
||||
|
||||
@@ -77,10 +76,10 @@ class mail_notification(osv.osv):
|
||||
}
|
||||
for partner in partner_obj.browse(cr, uid, partner_ids, context=context):
|
||||
notification_obj.create(cr, uid, {
|
||||
'partner_id': user.id,
|
||||
'partner_id': partner.id,
|
||||
'message_id': msg_id
|
||||
}, context=context)
|
||||
if partner.notification_email_pref=='none' or not partner.user_email:
|
||||
if partner.notification_email_pref=='none' or not partner.email:
|
||||
continue
|
||||
|
||||
if partner.notification_email_pref=='comment' and msg.type in ('email','comment'):
|
||||
@@ -88,7 +87,7 @@ class mail_notification(osv.osv):
|
||||
|
||||
if not msg.email_from:
|
||||
current_user = res_users_obj.browse(cr, uid, uid, context=context)
|
||||
towrite['email_from'] = current_user.user_email
|
||||
towrite['email_from'] = current_user.email
|
||||
|
||||
towrite['state'] = 'outgoing'
|
||||
if not towrite.get('email_to', False):
|
||||
|
||||
Reference in New Issue
Block a user