[REVIEW] Cleaning before merging.

bzr revid: tde@openerp.com-20121018093453-trijh79z0j7oha6f
This commit is contained in:
Thibault Delavallée 2012-10-18 11:34:53 +02:00
parent 1c7859c67a
commit 1737a3161b
5 changed files with 10 additions and 13 deletions

View File

@ -17,7 +17,6 @@
</group>
</xpath>
<xpath expr="//form/footer/button" position="after">
<button icon="/email_template/static/src/img/email_template.png"
type="object" name="toggle_template" string=""
help="Use a message template"

View File

@ -208,6 +208,7 @@ class mail_message(osv.Model):
'is_author': message['author_id'] and message['author_id'][0] == uid,
'partner_ids': partner_ids,
'parent_id': message['parent_id'] and message['parent_id'][0] or False,
# TDE note: see with CHM about votes, how they are displayed (only number, or name_get ?)
# 'vote_user_ids': vote_ids,
'has_voted': has_voted,
'to_read': message['to_read'],
@ -216,7 +217,7 @@ class mail_message(osv.Model):
def _message_read_expandable(self, cr, uid, tree, result, message_loaded, domain, context, parent_id, limit):
""" Create the expandable message for all parent message read
this function is used by message_read
TDE note: place use default values for args, and comment your vars !!
TDE note: add default values for args, add some comments
:param dict tree: tree of message ids
"""
@ -280,7 +281,7 @@ class mail_message(osv.Model):
'type', 'vote_user_ids', 'attachment_ids', 'author_id', 'partner_ids', 'record_name']
def _get_parent(self, cr, uid, message, context=None):
""" Tools method that try to get the parent of a mail.message. If
""" Tools method that tries to get the parent of a mail.message. If
no parent, or if uid has no access right on the parent, False
is returned.
@ -301,6 +302,8 @@ class mail_message(osv.Model):
After having fetch messages, their parents will be added to obtain
well formed threads.
TDE note: update this comment after final method implementation
:param domain: optional domain for searching ids
:param limit: number of messages to fetch
:param parent_id: if parent_id reached, stop searching for
@ -314,15 +317,12 @@ class mail_message(osv.Model):
if context.get('message_loaded'):
domain += [('id', 'not in', context.get('message_loaded'))]
limit = limit or self._message_read_limit
# tree = []
# result = []
record = None
id_tree = []
message_list = []
record = None
# select ids
# TDE note: should not receive [None] !!
# TDE note: should not receive [None] -> investigate
if ids and ids != [None]:
for message in self.read(cr, uid, ids, self._message_read_fields, context=context):
message_list.append(self._message_get_dict(cr, uid, message, context=context))

View File

@ -706,8 +706,8 @@ class mail_thread(osv.AbstractModel):
attachment_ids = ir_attachment.search(cr, SUPERUSER_ID, [('res_model', '=', False), ('res_id', '=', False), ('user_id', '=', uid), ('id', 'in', attachments)], context=context)
if attachment_ids:
ir_attachment.write(cr, SUPERUSER_ID, attachment_ids, {'res_model': self._name, 'res_id': thread_id}, context=context)
mail_message.write(cr, SUPERUSER_ID, [new_message_id], {'attachment_ids': [(6, 0, [pid for pid in attachment_ids])]})
new_message = self.pool.get('mail.message').message_read(cr, uid, [new_message_id])
mail_message.write(cr, SUPERUSER_ID, [new_message_id], {'attachment_ids': [(6, 0, [pid for pid in attachment_ids])]}, context=context)
new_message = self.pool.get('mail.message').message_read(cr, uid, [new_message_id], context=context)
return new_message

View File

@ -13,7 +13,6 @@
<record id="mail_followers_read_own" model="ir.rule">
<field name="name">mail.followers: read its own entries</field>
<field name="model_id" ref="model_mail_followers"/>
<!-- This rule has to be improved for employee only groups -->
<field name="domain_force">[('partner_id', '=', user.partner_id.id)]</field>
<field name="perm_create" eval="False"/>
<field name="perm_unlink" eval="False"/>
@ -21,7 +20,6 @@
<!--
This rule can not be uncommented, because we have a more wide method in mail.message. When we implement a many2one_variable field, we will be able to uncomment this.
<record id="mail_message_read_partner_or_author" model="ir.rule">
<field name="name">mail.message: read if notified or author</field>
<field name="model_id" ref="model_mail_message"/>

View File

@ -216,7 +216,7 @@ openerp_mail_followers = function(session, mail) {
var checklist = new Array();
_(this.$('.oe_mail_recthread_actions input[type="checkbox"]')).each(function (record) {
if ($(record).is(':checked')) {
checklist.push(parseInt($(record).data('id')))
checklist.push(parseInt($(record).data('id')));
}
});