[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:
commit
0d3425ee15
|
@ -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:
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue