[ADD] Thread widget: added a 'reply by email' link. Open the mail.compose.message wizard. WIP: must add default values, such as email_to, ... Will be done asap.

bzr revid: tde@openerp.com-20120420155827-8of3e0i70getenpl
This commit is contained in:
Thibault Delavallée 2012-04-20 17:58:27 +02:00
parent e6e51cdda6
commit c4addb4d5a
4 changed files with 33 additions and 1 deletions

View File

@ -225,6 +225,22 @@ openerp.mail = function(session) {
this.$element.find('div.oe_mail_thread_display').delegate('img.oe_mail_msg_menu_icon', 'click', function (event) {
self.$element.find('ul.oe_mail_msg_menu').toggle();
});
// event: click on "send an email"
this.$element.find('div.oe_mail_thread_act').delegate('a.oe_mail_compose', 'click', function (event) {
console.log('cacaprout');
self.do_action({
type: 'ir.actions.act_window',
res_model: 'mail.compose.message',
views: [[false, 'form']],
view_type: 'form',
view_mode: 'form',
target: 'new',
context: {'active_model': self.params.res_model, 'active_id': self.params.res_id, 'mail.compose.message.mode': 'new'},
key2: 'client_action_multi',
});
return false;
});
},
destroy: function () {

View File

@ -45,6 +45,7 @@
<ul t-name="Thread" class="oe_mail oe_mail_thread">
<div class="oe_mail_thread_act">
<a href="#" class="oe_mail_compose">Repley by e-mail</a><br />
<img class="oe_mail_msg_image oe_mail_oe_left" alt="User img"/>
<div class="oe_mail_msg_content">
<textarea class="oe_mail oe_mail_action_textarea" placeholder="Add your comment here..." onfocus="this.value = '';"/><br />

View File

@ -67,6 +67,7 @@ class mail_compose_message(osv.osv_memory):
:param dict context: several context values will modify the behavior
of the wizard, cfr. the class description.
"""
print context
if context is None:
context = {}
result = super(mail_compose_message, self).default_get(cr, uid, fields, context=context)

View File

@ -8,17 +8,31 @@
<field name="arch" type="xml">
<form string="Compose Email">
<group col="6" colspan="4">
<!--
<field name="model" invisible="1"/>
<field name="res_id" invisible="1"/>
-->
<field name='filter_id'/>
<!--
<field name='filter_id' invisible="context.get('active_model',False)"/>
<field name="email_from" colspan="4" required="1"/>
-->
<newline/>
<field name="email_from" colspan="4" required="1"/>
<field name="email_to" colspan="4" required="1"/>
<field name="email_cc" colspan="4"/>
<field name="email_bcc" colspan="4"/>
<field name="reply_to" colspan="4"/>
<field name="subject" colspan="4" widget="char" size="512"/>
<separator string="Debug information" colspan="6"/>
<field name="model"/>
<field name="res_id"/>
<newline/>
<field name="references"/>
<field name="message_id"/>
<!--
<field name="references" invisible="1"/>
<field name="message_id" invisible="1"/>
-->
</group>
<notebook colspan="4">
<page string="Body">