[IMP] attachments on messages

bzr revid: fp@tinyerp.com-20140316113742-odae0ph3a1qrqn12
This commit is contained in:
Fabien Pinckaers 2014-03-16 12:37:42 +01:00
parent 9d9e6007fe
commit 675a71b2b8
3 changed files with 22 additions and 2 deletions

View File

@ -88,7 +88,7 @@ def slug(value):
else:
# assume name_search result tuple
id, name = value
slugname = slugify(name)
slugname = slugify(name or '')
if not slugname:
return str(id)
return "%s-%d" % (slugname, id)

View File

@ -66,8 +66,11 @@ class MailGroup(http.Controller):
)
thread_ids = thread_obj.search(cr, uid, domain, limit=self._thread_per_page, offset=pager['offset'])
messages = thread_obj.browse(cr, uid, thread_ids, context)
for m in messages:
print m.subject
values = {
'messages': thread_obj.browse(cr, uid, thread_ids, context),
'messages': messages,
'group': group,
'pager': pager,
'mode': mode

View File

@ -94,6 +94,23 @@
on <span t-field="message.date"/>
</h4>
<div t-raw="message.body"/>
<div class="row" t-if="message.attachment_ids">
<h3 class="col-sm-12">Attachment(s):</h3>
<div class="col-md-2 col-sm-3 text-center" t-foreach='message.attachment_ids' t-as='attachment'>
<a t-att-href="'/mail/download_attachment?model=mail.message&amp;id='+str(message.id)+'&amp;method=download_attachment&amp;attachment_id='+str(attachment.id)" target="_blank">
<t t-if="attachment.file_type == 'webimage'">
<img t-att-src="'/web/binary/image?model=ir.attachment&amp;field=datas&amp;id=' + str(attachment.id) + '&amp;resize=100,80'"
class='oe_attachment_embedded'></img>
</t>
<t t-if="attachment.file_type != 'webimage'">
<img t-att-src="'/mail/static/src/img/mimetypes/' + attachment.file_type + '.png'"
class='oe_attachment_webimage'></img>
</t>
<div class='oe_attachment_name'><t t-raw='attachment.name' /></div>
</a>
</div>
</div>
<div t-if="message.child_ids">
<h2 class="page-header">Follow ups</h2>
<t t-set="messages" t-value="message.child_ids"/>