[FIX] mail: add name in the dictionnary of attachments_tree and check url in js

bzr revid: chm@openerp.com-20130208131029-2idd6ltxch62ig28
This commit is contained in:
Christophe Matthieu 2013-02-08 14:10:29 +01:00
commit 0d3425ee15
2 changed files with 4 additions and 4 deletions

View File

@ -310,8 +310,8 @@ class mail_message(osv.Model):
partner_tree = dict((partner[0], partner) for partner in partners)
# 2. Attachments as SUPERUSER, because could receive msg and attachments for doc uid cannot see
attachments = ir_attachment_obj.read(cr, SUPERUSER_ID, list(attachment_ids), ['id', 'datas_fname'], context=context)
attachments_tree = dict((attachment['id'], {'id': attachment['id'], 'filename': attachment['datas_fname']}) for attachment in attachments)
attachments = ir_attachment_obj.read(cr, SUPERUSER_ID, list(attachment_ids), ['id', 'datas_fname', 'name'], context=context)
attachments_tree = dict((attachment['id'], {'id': attachment['id'], 'filename': attachment['datas_fname'], 'name': attachment['name']}) for attachment in attachments)
# 3. Update message dictionaries
for message_dict in messages:

View File

@ -104,8 +104,8 @@ openerp.mail = function (session) {
// returns the file type of a file based on its extension
// As it only looks at the extension it is quite approximative.
filetype: function(url){
url = url.filename || url;
var tokens = (url+'').split('.');
var url = url && url.filename || url;
var tokens = typeof url == 'string' ? url.split('.') : [];
if(tokens.length <= 1){
return 'unknown';
}