<group colspan="4">
<field colspan="4" name="email_cc" widget="char" size="512"/>
</group>
- <field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
+ <field name="message_ids" colspan="4" nolabel="1" mode="tree,form" readonly="1">
<tree string="History">
<field name="display_text" string="History Information"/>
+ <field name="email_from" invisible="1"/>
<button
string="Reply" attrs="{'invisible': [('email_from', '=', False)]}"
name="%(mail.action_email_compose_message_wizard)d"
</tree>
<form string="History">
<group col="4" colspan="4">
- <field name="email_from"/>
- <field name="date"/>
- <field name="email_to" size="512"/>
- <field name="email_cc" size="512"/>
+ <group col="2" colspan="2" attrs="{'invisible': [('email_from', '=', False)]}">
+ <field name="email_from"/>
+ <field name="email_to" size="512"/>
+ </group>
+ <group col="2" colspan="2">
+ <field name="date"/>
+ <field name="email_cc" size="512" attrs="{'invisible': [('email_from', '=', False)]}"/>
+ </group>
<field name="subject" colspan="4" widget="char" attrs="{'invisible': [('email_from', '=', False)]}" size="512"/>
<field name="display_text" colspan="4" attrs="{'invisible': [('email_from', '!=', False)]}"/>
</group>
<notebook colspan="4">
- <page string="Details">
+ <page string="Details" attrs="{'invisible': [('email_from', '=', False)]}">
<field name="body_text" colspan="4" nolabel="1"/>
<group attrs="{'invisible': [('email_from', '=', False)]}">
<button colspan="4" string="Reply"
</group>
</page>
- <page string="Attachments">
+ <page string="Attachments" attrs="{'invisible': [('email_from', '=', False)]}">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
result.update({
'subject' : data.name or False,
'email_to' : data.email_from or False,
- 'email_from' : data.user_id and data.user_id.address_id and data.user_id.address_id.email or tools.config.get('email_from', False),
+ 'email_from' : data.user_id.user_email if data.user_id else tools.config.get('email_from', False),
'body_text' : '\n' + (tools.ustr(data.user_id.signature or '')),
'email_cc' : tools.ustr(data.email_cc or ''),
'model': model,
'res_id': res_id,
+ 'subtype': 'plain',
})
if hasattr(data, 'section_id'):
result.update({'reply_to' : data.section_id and data.section_id.reply_to or False})
'model': fields.char('Related Document model', size=128, select=1, readonly=1),
'res_id': fields.integer('Related Document ID', select=1, readonly=1),
'date': fields.datetime('Date'),
- 'email_from': fields.char('From', size=128, help='Message sender'),
+ 'email_from': fields.char('From', size=128, help='Message sender, taken from user preferences'),
'email_to': fields.char('To', size=256, help='Message recipients'),
'email_cc': fields.char('Cc', size=256, help='Carbon copy message recipients'),
'email_bcc': fields.char('Bcc', size=256, help='Blind carbon copy message recipients'),
'user_id': uid,
'model': model,
'res_id': res_id,
- 'body_text': body if subtype == 'plain' else False,
+ 'body_text': body if subtype != 'html' else False,
'body_html': body if subtype == 'html' else False,
'email_from': email_from,
'email_to': email_to and ','.join(email_to) or '',
<field name="message_id" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="state"/>
+ <button name="send" string="Send Now" type="object" icon="gtk-media-play" states='outgoing'/>
<button name="open_document" string="Open Related Document" type="object" icon="gtk-jump-to"/>
<button name="open_attachment" string="Open Attachments" type="object" icon="gtk-jump-to"/>
</tree>
The behavior of the wizard can be modified through the use of context
parameters, among which are:
- * mass_mail: turns multi-recipient mode, where the mail details can
+ * mass_mail: turns multi-recipient mode on, where the mail details can
contain template placeholders that will be merged with
actual data before being sent to each recipient, as
determined via ``context['active_model']`` and
context = {}
result = super(mail_compose_message, self).default_get(cr, uid, fields, context=context)
vals = {}
- if context.get('mass_mail'):
- return result
- if context.get('active_model') and context.get('active_id') and not context.get('mail')=='reply':
+ if context.get('active_model') and context.get('active_id') and not context.get('mail') == 'reply':
vals = self.get_value(cr, uid, context.get('active_model'), context.get('active_id'), context)
- elif context.get('mail')=='reply' and context.get('active_id'):
+ elif context.get('mail') == 'reply' and context.get('active_id'):
vals = self.get_message_data(cr, uid, int(context['active_id']), context)
else:
result['model'] = context.get('active_model', False)
- if not vals:
- return result
- for field in fields:
- result.update({field : vals.get(field, False)})
+ if vals:
+ for field in fields:
+ result.update({field : vals.get(field, False)})
+ # Try to provide default email_from if not specified yet
+ if not result.get('email_from'):
+ current_user = self.pool.get('res.users').browse(cr, uid, uid, context)
+ result['email_from'] = current_user.user_email or False
return result
_columns = {