[IMP] mail: add a feature to call _hook_message_sent method of the related module with will trigger the workflow and set state accordingly
bzr revid: psi@tinyerp.com-20120316065927-1m4ns7gpe5bwr4pk
This commit is contained in:
@@ -517,7 +517,9 @@ class mail_message(osv.osv):
|
||||
message.write({'state':'sent', 'message_id': res})
|
||||
else:
|
||||
message.write({'state':'exception'})
|
||||
|
||||
model_pool = self.pool.get(message.model)
|
||||
if hasattr(model_pool, '_hook_message_sent'):
|
||||
model_pool._hook_message_sent(cr, uid, message.res_id, context=context)
|
||||
# if auto_delete=True then delete that sent messages as well as attachments
|
||||
message.refresh()
|
||||
if message.state == 'sent' and message.auto_delete:
|
||||
|
||||
@@ -100,6 +100,7 @@ class mail_compose_message(osv.osv_memory):
|
||||
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
|
||||
result['subtype'] = 'html'
|
||||
return result
|
||||
|
||||
_columns = {
|
||||
@@ -158,8 +159,9 @@ class mail_compose_message(osv.osv_memory):
|
||||
if not (subject.startswith('Re:') or subject.startswith(re_prefix)):
|
||||
subject = "%s %s" % (re_prefix, subject)
|
||||
result.update({
|
||||
'subtype' : 'plain', # default to the text version due to quoting
|
||||
'subtype' : message_data.subtype or 'plain', # default to the text version due to quoting
|
||||
'body_text' : body,
|
||||
'body_html' : message_data.body_html,
|
||||
'subject' : subject,
|
||||
'attachment_ids' : [],
|
||||
'model' : message_data.model or False,
|
||||
@@ -238,7 +240,6 @@ class mail_compose_message(osv.osv_memory):
|
||||
subtype=mail.subtype, headers=headers, context=context)
|
||||
# in normal mode, we send the email immediately, as the user expects us to (delay should be sufficiently small)
|
||||
mail_message.send(cr, uid, [msg_id], context=context)
|
||||
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
def render_template(self, cr, uid, template, model, res_id, context=None):
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
<notebook colspan="4">
|
||||
<page string="Body">
|
||||
<field name="body_text" colspan="4" nolabel="1" height="300" width="300"/>
|
||||
<field name="body_html" invisible="1"/>
|
||||
</page>
|
||||
<page string="Attachments">
|
||||
<field name="attachment_ids" colspan="4" nolabel="1"/>
|
||||
|
||||
Reference in New Issue
Block a user