diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 11fc203d890..0f404155f42 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -423,7 +423,7 @@ class mail_thread(osv.osv): map_id_to_name[attach_id] = '' # use empty string as a placeholder ids = map_id_to_name.keys() - names = self.pool.get('ir.attachment').name_get(cr, uid, ids) + names = self.pool.get('ir.attachment').name_get(cr, uid, ids, context=context) # convert the list of tuples into a dictionnary for name in names: @@ -436,7 +436,6 @@ class mail_thread(osv.osv): for attach_id in msg["attachment_ids"]: msg["attachments"].append({'id': attach_id, 'name': map_id_to_name[attach_id]}) - """ Sort and return messages """ msgs = sorted(msgs, key=lambda d: (-d['id'])) return msgs diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 2f2daa4692a..2a253154fde 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -327,59 +327,59 @@ /* Gear menu */ .openerp .oe_mail_msg_content a.oe_gear_menuaction { - position: absolute; - top: 0px; - right: 3px; - display: none; - color: #4c4c4c; - cursor: pointer; + position: absolute; + top: 0px; + right: 3px; + display: none; + color: #4c4c4c; + cursor: pointer; } .openerp .oe_mail_msg_content:hover .oe_gear_menuaction { - display: block; + display: block; } .openerp .oe_mail_msg_content a.oe_gear_menuaction:hover { - text-decoration: none; + text-decoration: none; } .openerp .oe_mail_msg_content ul.oe_gear_menu { - list-style-type: none; - display: none; - position: absolute; - top: 30px; - right: -140px; - padding: 4px; - border: 1px solid #afafb6; - min-width: 160px; - overflow-x: hidden; - z-index: 900; - background: white; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; - -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); - -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); - -box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); + list-style-type: none; + display: none; + position: absolute; + top: 30px; + right: -140px; + padding: 4px; + border: 1px solid #afafb6; + min-width: 160px; + overflow-x: hidden; + z-index: 900; + background: white; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); + -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); + -box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); } .openerp .oe_mail_msg_content ul.oe_gear_menu > li { float: none; } .openerp .oe_mail_msg_content .oe_gear_menu > li > a { - display: block; - padding: 3px 6px; - line-height: 14px; - color: #4c4c4c; - text-decoration: none; + display: block; + padding: 3px 6px; + line-height: 14px; + color: #4c4c4c; + text-decoration: none; } .openerp .oe_mail_msg_content .oe_gear_menu > li > a:hover { - background: #f0f0fa; - background: -moz-linear-gradient(#f0f0fa, #eeeef6); - background: -webkit-gradient(linear, left top, left bottom, from(#f0f0fa), to(#eeeef6)); - background: -webkit-linear-gradient(#f0f0fa, #eeeef6); - -moz-box-shadow: none; - -webkit-box-shadow: none; - -box-shadow: none; + background: #f0f0fa; + background: -moz-linear-gradient(#f0f0fa, #eeeef6); + background: -webkit-gradient(linear, left top, left bottom, from(#f0f0fa), to(#eeeef6)); + background: -webkit-linear-gradient(#f0f0fa, #eeeef6); + -moz-box-shadow: none; + -webkit-box-shadow: none; + -box-shadow: none; } .openerp .oe_mail_msg_content .oe_gear_menu p { - margin-left: 12px; + margin-left: 12px; } /* Attachments */ @@ -387,11 +387,15 @@ display: none; width: 100%; border-top: 1px solid #CCC; - margin-top: .5em; + margin: .5em 0 0 0; padding: .5em 0; + list-style-position: inside; } .openerp ul.oe_mail_msg_attachments li { float: none; + margin: 0; + padding: 0; + list-style-type: square; } diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 0abd48f098f..8f0e2c8303a 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -249,10 +249,21 @@ openerp.mail = function(session) { $.when(defer).then(function (records) { if (records.length <= self.params.limit) self.display.show_more = false; else { self.display.show_more = true; records.pop(); } + + //build attachments download urls + for (var k in records) { + if (records[k].attachments) { + for (var l in records[k].attachments) { + records[k].attachments[l].url = self.session.origin + '/web/binary/saveas?session_id=' + self.session.session_id + '&model=ir.attachment&field=datas&filename_field=datas_fname&id='+records[k].attachments[l].id; + } + } + } + self.display_comments(records); if (self.display.show_more == true) self.$element.find('div.oe_mail_thread_more:last').show(); else self.$element.find('div.oe_mail_thread_more:last').hide(); - }); + }); + return defer; }, diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index adedb8e6bc3..87b82899cd6 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -202,7 +202,7 @@