[CLEAN] mail: cleaned some read -> browse + forgotten statement to remove
bzr revid: tde@openerp.com-20130913122956-6zkk9ucewbt6w407
This commit is contained in:
parent
ed62d1dac7
commit
fbc6443692
|
@ -8,4 +8,5 @@ openerp.crm = function(openerp) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -91,7 +91,6 @@ class mail_message(osv.Model):
|
||||||
SUPERUSER_ID, to be sure to have the record name correctly stored. """
|
SUPERUSER_ID, to be sure to have the record name correctly stored. """
|
||||||
# TDE note: regroup by model/ids, to have less queries to perform
|
# TDE note: regroup by model/ids, to have less queries to perform
|
||||||
result = dict.fromkeys(ids, False)
|
result = dict.fromkeys(ids, False)
|
||||||
# return result
|
|
||||||
for message in self.read(cr, uid, ids, ['model', 'res_id'], context=context):
|
for message in self.read(cr, uid, ids, ['model', 'res_id'], context=context):
|
||||||
if not message.get('model') or not message.get('res_id') or message['model'] not in self.pool:
|
if not message.get('model') or not message.get('res_id') or message['model'] not in self.pool:
|
||||||
continue
|
continue
|
||||||
|
@ -101,7 +100,7 @@ class mail_message(osv.Model):
|
||||||
def _get_to_read(self, cr, uid, ids, name, arg, context=None):
|
def _get_to_read(self, cr, uid, ids, name, arg, context=None):
|
||||||
""" Compute if the message is unread by the current user. """
|
""" Compute if the message is unread by the current user. """
|
||||||
res = dict((id, False) for id in ids)
|
res = dict((id, False) for id in ids)
|
||||||
partner_id = self.pool.get('res.users').read(cr, uid, uid, ['partner_id'], context=context)['partner_id'][0]
|
partner_id = self.pool['res.users'].browse(cr, SUPERUSER_ID, uid, context=context).partner_id.id
|
||||||
notif_obj = self.pool.get('mail.notification')
|
notif_obj = self.pool.get('mail.notification')
|
||||||
notif_ids = notif_obj.search(cr, uid, [
|
notif_ids = notif_obj.search(cr, uid, [
|
||||||
('partner_id', 'in', [partner_id]),
|
('partner_id', 'in', [partner_id]),
|
||||||
|
@ -120,7 +119,7 @@ class mail_message(osv.Model):
|
||||||
def _get_starred(self, cr, uid, ids, name, arg, context=None):
|
def _get_starred(self, cr, uid, ids, name, arg, context=None):
|
||||||
""" Compute if the message is unread by the current user. """
|
""" Compute if the message is unread by the current user. """
|
||||||
res = dict((id, False) for id in ids)
|
res = dict((id, False) for id in ids)
|
||||||
partner_id = self.pool.get('res.users').read(cr, uid, uid, ['partner_id'], context=context)['partner_id'][0]
|
partner_id = self.pool['res.users'].browse(cr, SUPERUSER_ID, uid, context=context).partner_id.id
|
||||||
notif_obj = self.pool.get('mail.notification')
|
notif_obj = self.pool.get('mail.notification')
|
||||||
notif_ids = notif_obj.search(cr, uid, [
|
notif_ids = notif_obj.search(cr, uid, [
|
||||||
('partner_id', 'in', [partner_id]),
|
('partner_id', 'in', [partner_id]),
|
||||||
|
@ -267,7 +266,7 @@ class mail_message(osv.Model):
|
||||||
:return number of message mark as read
|
:return number of message mark as read
|
||||||
"""
|
"""
|
||||||
notification_obj = self.pool.get('mail.notification')
|
notification_obj = self.pool.get('mail.notification')
|
||||||
user_pid = self.pool.get('res.users').read(cr, uid, uid, ['partner_id'], context=context)['partner_id'][0]
|
user_pid = self.pool['res.users'].browse(cr, SUPERUSER_ID, uid, context=context).partner_id.id
|
||||||
domain = [('partner_id', '=', user_pid), ('message_id', 'in', msg_ids)]
|
domain = [('partner_id', '=', user_pid), ('message_id', 'in', msg_ids)]
|
||||||
if not create_missing:
|
if not create_missing:
|
||||||
domain += [('read', '=', not read)]
|
domain += [('read', '=', not read)]
|
||||||
|
@ -295,7 +294,7 @@ class mail_message(osv.Model):
|
||||||
(i.e. when acting on displayed messages not notified)
|
(i.e. when acting on displayed messages not notified)
|
||||||
"""
|
"""
|
||||||
notification_obj = self.pool.get('mail.notification')
|
notification_obj = self.pool.get('mail.notification')
|
||||||
user_pid = self.pool.get('res.users').read(cr, uid, uid, ['partner_id'], context=context)['partner_id'][0]
|
user_pid = self.pool['res.users'].browse(cr, SUPERUSER_ID, uid, context=context).partner_id.id
|
||||||
domain = [('partner_id', '=', user_pid), ('message_id', 'in', msg_ids)]
|
domain = [('partner_id', '=', user_pid), ('message_id', 'in', msg_ids)]
|
||||||
if not create_missing:
|
if not create_missing:
|
||||||
domain += [('starred', '=', not starred)]
|
domain += [('starred', '=', not starred)]
|
||||||
|
@ -333,7 +332,7 @@ class mail_message(osv.Model):
|
||||||
"""
|
"""
|
||||||
res_partner_obj = self.pool.get('res.partner')
|
res_partner_obj = self.pool.get('res.partner')
|
||||||
ir_attachment_obj = self.pool.get('ir.attachment')
|
ir_attachment_obj = self.pool.get('ir.attachment')
|
||||||
pid = self.pool.get('res.users').read(cr, uid, uid, ['partner_id'], context=None)['partner_id'][0]
|
pid = self.pool['res.users'].browse(cr, SUPERUSER_ID, uid, context=context).partner_id.id
|
||||||
|
|
||||||
# 1. Aggregate partners (author_id and partner_ids) and attachments
|
# 1. Aggregate partners (author_id and partner_ids) and attachments
|
||||||
partner_ids = set()
|
partner_ids = set()
|
||||||
|
@ -649,7 +648,6 @@ class mail_message(osv.Model):
|
||||||
elif not ids:
|
elif not ids:
|
||||||
return ids
|
return ids
|
||||||
|
|
||||||
# pid = self.pool.get('res.users').read(cr, uid, uid, ['partner_id'])['partner_id'][0]
|
|
||||||
pid = self.pool['res.users'].browse(cr, SUPERUSER_ID, uid, context=context).partner_id.id
|
pid = self.pool['res.users'].browse(cr, SUPERUSER_ID, uid, context=context).partner_id.id
|
||||||
author_ids, partner_ids, allowed_ids = set([]), set([]), set([])
|
author_ids, partner_ids, allowed_ids = set([]), set([]), set([])
|
||||||
model_ids = {}
|
model_ids = {}
|
||||||
|
|
|
@ -1399,12 +1399,6 @@ class mail_thread(osv.AbstractModel):
|
||||||
parent_id = message_ids and message_ids[0] or False
|
parent_id = message_ids and message_ids[0] or False
|
||||||
# we want to set a parent: force to set the parent_id to the oldest ancestor, to avoid having more than 1 level of thread
|
# we want to set a parent: force to set the parent_id to the oldest ancestor, to avoid having more than 1 level of thread
|
||||||
elif parent_id:
|
elif parent_id:
|
||||||
# update original mail_mail if exists
|
|
||||||
if type == 'email':
|
|
||||||
mail_mail_ids = self.pool['mail.mail'].search(cr, SUPERUSER_ID, [('mail_message_id', '=', parent_id)], context=context)
|
|
||||||
if mail_mail_ids:
|
|
||||||
self.pool['mail.mail'].set_replied(cr, SUPERUSER_ID, mail_mail_ids, context=context)
|
|
||||||
|
|
||||||
message_ids = mail_message.search(cr, SUPERUSER_ID, [('id', '=', parent_id), ('parent_id', '!=', False)], context=context)
|
message_ids = mail_message.search(cr, SUPERUSER_ID, [('id', '=', parent_id), ('parent_id', '!=', False)], context=context)
|
||||||
# avoid loops when finding ancestors
|
# avoid loops when finding ancestors
|
||||||
processed_list = []
|
processed_list = []
|
||||||
|
|
Loading…
Reference in New Issue