[MERGE] from chm

bzr revid: fva@openerp.com-20121025134105-evuqxksk13k7pcnw
This commit is contained in:
Frédéric van der Essen
2012-10-25 15:41:05 +02:00
5 changed files with 273 additions and 240 deletions
+7 -2
View File
@@ -694,7 +694,13 @@ class mail_thread(osv.AbstractModel):
# TDE FIXME: body is plaintext: convert it into html
# when writing on res.partner, without specific thread_id -> redirect to the user's partner
if self._name == 'res.partner' and not thread_id:
thread_id = self.pool.get('res.users').read(cr, uid, uid, ['partner_id'], context=context)['partner_id'][0]
thread_id = self.pool.get('res.users').read(cr, uid, uid, ['partner_id', 'subject'], context=context)['partner_id'][0]
mail_message = self.pool.get('mail.message')
if not subject and parent_id:
parent = mail_message.read(cr, uid, parent_id, ['subject'], context=context)
subject = 'Re: ' + parent['subject']
new_message_id = self.message_post(cr, uid, thread_id=thread_id, body=body, subject=subject, type=type,
subtype=subtype, parent_id=parent_id, context=context)
@@ -702,7 +708,6 @@ class mail_thread(osv.AbstractModel):
# Chatter: attachments linked to the document (not done JS-side), load the message
if attachments:
ir_attachment = self.pool.get('ir.attachment')
mail_message = self.pool.get('mail.message')
attachment_ids = ir_attachment.search(cr, SUPERUSER_ID, [('res_model', '=', 'mail.compose.message'), ('res_id', '=', 0), ('create_uid', '=', 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)
+11 -1
View File
@@ -151,9 +151,11 @@
padding-top: 2px;
padding-bottom:6px;
}
.openerp .oe_mail .oe_msg_attachments.oe_hidden{
.openerp .oe_mail .oe_msg_attachments.oe_hidden,
.openerp .oe_mail .oe_msg_images.oe_hidden{
margin:0px;
border: none;
display: none;
}
.openerp .oe_mail .oe_msg_attachments{
margin-bottom: 4px;
@@ -311,6 +313,14 @@
border-radius: 2px;
}
/* ---------------- MESSAGES BODY ------------------ */
.openerp .oe_mail .oe_msg_content .oe_blockquote,
.openerp .oe_mail .oe_msg_content blockquote {
padding: 4px;
border-radius: 2px;
border: solid 1px rgba(124,123,173,0.14);
}
/* ----------- FORM INTEGRATION ------------ */
/* Nothing to do yay! */
File diff suppressed because it is too large Load Diff
+7 -15
View File
@@ -15,7 +15,7 @@
for main thread composition form in document form view.
-->
<t t-name="mail.compose_message">
<div class="oe_msg #{widget.thread_level and widget.options.display_indented_thread > -1 ? 'oe_msg_indented' : ''} oe_msg_composer">
<div t-attf-class="oe_msg oe_msg_composer #{widget.thread_level and widget.options.display_indented_thread > -1 ? 'oe_msg_indented' : ''}">
<div class="oe_msg_left">
<img class="oe_msg_icon" alt="User img" t-attf-src="#{widget.avatar}"/>
</div>
@@ -41,7 +41,7 @@
mail.compose_message when focus on textarea
-->
<t t-name="mail.compose_message.compact">
<div class="oe_msg #{widget.thread_level and widget.options.display_indented_thread > -1 ? 'oe_msg_indented' : ''} oe_msg_composer_compact">
<div t-attf-class="oe_msg oe_msg_composer_compact #{widget.thread_level and widget.options.display_indented_thread > -1 ? 'oe_msg_indented' : ''}">
<textarea class="field_text oe_compact" placeholder="Write a reply..."/>
</div>
</t>
@@ -72,8 +72,8 @@
Template used to display attachments in a mail.message
-->
<t t-name="mail.thread.message.attachments">
<span t-attf-class="oe_msg_attachments">
<t t-foreach="widget.attachment_ids" t-as="attachment" t-if="!attachment.is_image and !attachment.is_document">
<span class="oe_msg_attachments">
<t t-foreach="widget.attachment_ids" t-as="attachment" t-if="!attachment.is_image">
<div class="oe_attachment">
<span t-if="(attachment.upload or attachment.percent_loaded&lt;100)" t-attf-title="{(attachment.name || attachment.filename) + (attachment.date?' \n('+attachment.date+')':'' )}" t-attf-name="{attachment.name || attachment.filename}">
<div class="oe_upload_in_process">
@@ -92,21 +92,13 @@
</div>
</t>
</span>
<span t-attf-class="oe_msg_images">
<span class="oe_msg_images">
<t t-foreach="widget.attachment_ids" t-as="attachment" t-if="attachment.is_image">
<a t-att-href="attachment.url" t-attf-title="{(attachment.name || attachment.filename) + (attachment.date?' \n('+attachment.date+')':'' )}">
<img t-if="attachment.is_image" t-attf-title="{(attachment.name || attachment.filename) + (attachment.date?' \n('+attachment.date+')':'' )}" t-att-src="attachment.url"/>
</a>
</t>
</span>
<span t-attf-class="oe_msg_document">
<t t-foreach="widget.attachment_ids" t-as="attachment" t-if="attachment.is_document">
<a t-att-href="attachment.url" t-attf-title="{(attachment.name || attachment.filename) + (attachment.date?' \n('+attachment.date+')':'' )}">
<t t-raw="attachment.name || attachment.filename"/>
</a>
<iframe t-attf-src="http://docs.google.com/viewer?url=#{ attachment.url_escape }&amp;embedded=true" width="600" height="400" style="border: none;"></iframe>
</t>
</span>
</t>
<t t-name="mail.thread.message.private">
@@ -215,7 +207,7 @@
</div>
<!-- message itself -->
<div class="oe_msg_content">
<h1 t-if="widget.subject" class="oe_msg_title">
<h1 t-if="widget.subject and !widget.thread_level" class="oe_msg_title">
<t t-raw="widget.subject"/>
</h1>
<div class="oe_msg_body">
@@ -245,7 +237,7 @@
<!-- expandable message layout -->
<t t-name="mail.thread.expandable">
<div t-attf-class="oe_msg #{widget.thread_level and widget.options.display_indented_thread > -1 ? 'oe_msg_indented' : ''} oe_msg_#{widget.type} oe_msg_unread">
<div t-attf-class="oe_msg oe_msg_#{widget.type} #{widget.thread_level and widget.options.display_indented_thread > -1 ? 'oe_msg_indented' : ''} oe_msg_unread">
<div class="oe_msg_content oe_msg_more_message">
<a t-if="widget.nb_messages === 1" class="oe_msg_fetch_more">load one more message</a>
<a t-if="widget.nb_messages !== 1" class="oe_msg_fetch_more">load <t t-raw="widget.nb_messages" /> more messages</a>
+1 -5
View File
@@ -157,11 +157,7 @@ class mail_compose_message(osv.TransientModel):
if not (reply_subject.startswith('Re:') or reply_subject.startswith(re_prefix)) and message_data.subject:
reply_subject = "%s %s" % (re_prefix, reply_subject)
# create the reply in the body
reply_body = _('<div>On %(date)s, %(sender_name)s wrote:<blockquote>%(body)s</blockquote></div>') % {
'date': message_data.date if message_data.date else '',
'sender_name': message_data.author_id.name,
'body': message_data.body,
}
reply_body = (context and context.get('default_body') or '')
# get partner_ids from original message
partner_ids = [partner.id for partner in message_data.partner_ids] if message_data.partner_ids else []