summaryrefslogtreecommitdiff
path: root/addons/mail/wizard/mail_compose_message.py
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2011-09-06 10:00:14 +0200
committerOlivier Dony <odo@openerp.com>2011-09-06 10:00:14 +0200
commite9d94b824eee6970bf3263d7d0fd3208a3b0f037 (patch)
treec1b3c0061a5c64b28dc67e378937d8d0fc055cbe /addons/mail/wizard/mail_compose_message.py
parent4f5fa4f0d83e077e03ea9b712fb8fee25503271f (diff)
[IMP]: crm,mail: minor fixes after review
bzr revid: odo@openerp.com-20110906080014-6texz097jepfrwsp
Diffstat (limited to 'addons/mail/wizard/mail_compose_message.py')
-rw-r--r--addons/mail/wizard/mail_compose_message.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py
index 9179af2a009..6d40ef13e80 100644
--- a/addons/mail/wizard/mail_compose_message.py
+++ b/addons/mail/wizard/mail_compose_message.py
@@ -39,7 +39,7 @@ class mail_compose_message(osv.osv_memory):
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
@@ -68,18 +68,19 @@ class mail_compose_message(osv.osv_memory):
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 = {