diff --git a/addons/account_followup/wizard/account_followup_print.py b/addons/account_followup/wizard/account_followup_print.py
index 02f463a78eb..49b83973b66 100644
--- a/addons/account_followup/wizard/account_followup_print.py
+++ b/addons/account_followup/wizard/account_followup_print.py
@@ -278,7 +278,7 @@ class account_followup_print_all(osv.osv_memory):
msg = ''
if dest:
try:
- email_message_obj.email_send(cr, uid, src, dest, sub, body, model='account.followup.print.all')
+ email_message_obj.schedule_with_attach(cr, uid, src, dest, sub, body, model='account.followup.print.all')
msg_sent += partner.name + '\n'
except Exception, e:
raise osv.except_osv('Error !', e )
diff --git a/addons/base_action_rule/base_action_rule.py b/addons/base_action_rule/base_action_rule.py
index a2432050f1b..02e929f6a28 100644
--- a/addons/base_action_rule/base_action_rule.py
+++ b/addons/base_action_rule/base_action_rule.py
@@ -315,7 +315,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
if not emailfrom:
raise osv.except_osv(_('Error!'),
_("No E-Mail ID Found for your Company address!"))
- return email_message_obj.email_send(cr, uid, emailfrom, emails, name, body, model='base.action.rule', reply_to=reply_to, openobject_id=str(obj.id))
+ return email_message_obj.schedule_with_attach(cr, uid, emailfrom, emails, name, body, model='base.action.rule', reply_to=reply_to, openobject_id=str(obj.id))
def do_check(self, cr, uid, action, obj, context=None):
diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py
index 7cfed6711b4..d49594f4a60 100644
--- a/addons/base_calendar/base_calendar.py
+++ b/addons/base_calendar/base_calendar.py
@@ -507,7 +507,7 @@ property or property parameter."),
body = html_invitation % body_vals
if mail_to and email_from:
attach = self.get_ics_file(cr, uid, res_obj, context=context)
- email_message_obj.email_send(cr, uid,
+ email_message_obj.schedule_with_attach(cr, uid,
email_from,
mail_to,
sub,
@@ -893,7 +893,7 @@ From:
for att in alarm.attendee_ids:
mail_to.append(att.user_id.address_id.email)
if mail_to:
- email_message_obj.email_send(cr, uid,
+ email_message_obj.schedule_with_attach(cr, uid,
tools.config.get('email_from', False),
mail_to,
sub,
diff --git a/addons/crm/crm.py b/addons/crm/crm.py
index cbf246edb31..687cd836d1a 100644
--- a/addons/crm/crm.py
+++ b/addons/crm/crm.py
@@ -488,7 +488,7 @@ class crm_case(object):
# Send an email
subject = "Reminder: [%s] %s" % (str(case.id), case.name, )
- email_message_obj.email_send(cr, uid,
+ email_message_obj.schedule_with_attach(cr, uid,
src,
[dest],
subject,
diff --git a/addons/crm/crm_action_rule.py b/addons/crm/crm_action_rule.py
index d877c074020..acb7801c7c9 100644
--- a/addons/crm/crm_action_rule.py
+++ b/addons/crm/crm_action_rule.py
@@ -66,7 +66,7 @@ this if you want the rule to send an email to the partner."),
if not emailfrom:
raise osv.except_osv(_('Error!'),
_("No E-Mail ID Found for your Company address!"))
- return email_message_obj.email_send(cr, uid, emailfrom, emails, name, body, model='base.action.rule', reply_to=reply_to, openobject_id=str(obj.id))
+ return email_message_obj.schedule_with_attach(cr, uid, emailfrom, emails, name, body, model='base.action.rule', reply_to=reply_to, openobject_id=str(obj.id))
def do_check(self, cr, uid, action, obj, context=None):
""" @param self: The object pointer
diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py
index 6c3fa3d71f6..557403a8b5a 100644
--- a/addons/crm/crm_lead.py
+++ b/addons/crm/crm_lead.py
@@ -399,18 +399,6 @@ class crm_lead(crm_case, osv.osv):
res = self.write(cr, uid, [case.id], values, context=context)
return res
- def msg_send(self, cr, uid, id, *args, **argv):
-
- """ Send The Message
- @param self: The object pointer
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of email’s IDs
- @param *args: Return Tuple Value
- @param **args: Return Dictionary of Keyword Value
- """
- return True
-
def on_change_optin(self, cr, uid, ids, optin):
return {'value':{'optin':optin,'optout':False}}
diff --git a/addons/crm/wizard/crm_send_email.py b/addons/crm/wizard/crm_send_email.py
index d130dab712e..71c83b20c33 100644
--- a/addons/crm/wizard/crm_send_email.py
+++ b/addons/crm/wizard/crm_send_email.py
@@ -45,7 +45,7 @@ class crm_send_new_email(osv.osv_memory):
'body': fields.text('Message Body', required=True),
'state': fields.selection(AVAILABLE_STATES, string='Set New State To', required=True),
'attachment_ids' : fields.one2many('crm.send.mail.attachment', 'wizard_id', 'Attachment'),
- 'html': fields.boolean('HTML formatting?', help="Select this if you want to send email with HTML formatting."),
+ 'html': fields.boolean('HTML formatting?', help="Select this if you want to send email with HTML formatting."),
}
def action_send(self, cr, uid, ids, context=None):
@@ -111,7 +111,7 @@ class crm_send_new_email(osv.osv_memory):
if obj.html:
subtype = 'html'
- flag = email_message_obj.email_send(cr, uid,
+ flag = email_message_obj.schedule_with_attach(cr, uid,
email_from,
emails,
obj.subject,
diff --git a/addons/crm_claim/crm_claim.py b/addons/crm_claim/crm_claim.py
index 94b541b83d7..afb49152b1f 100644
--- a/addons/crm_claim/crm_claim.py
+++ b/addons/crm_claim/crm_claim.py
@@ -238,18 +238,6 @@ class crm_claim(crm.crm_case, osv.osv):
res = self.write(cr, uid, [case.id], values, context=context)
return res
- def msg_send(self, cr, uid, id, *args, **argv):
-
- """ Send The Message
- @param self: The object pointer
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of email’s IDs
- @param *args: Return Tuple Value
- @param **args: Return Dictionary of Keyword Value
- """
- return True
-
crm_claim()
diff --git a/addons/crm_helpdesk/crm_helpdesk.py b/addons/crm_helpdesk/crm_helpdesk.py
index 3493e03bc79..4e0289bcff0 100644
--- a/addons/crm_helpdesk/crm_helpdesk.py
+++ b/addons/crm_helpdesk/crm_helpdesk.py
@@ -177,18 +177,6 @@ class crm_helpdesk(crm.crm_case, osv.osv):
res = self.write(cr, uid, [case.id], values, context=context)
return res
- def msg_send(self, cr, uid, id, *args, **argv):
-
- """ Send The Message
- @param self: The object pointer
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of email’s IDs
- @param *args: Return Tuple Value
- @param **args: Return Dictionary of Keyword Value
- """
- return True
-
crm_helpdesk()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/email/__init__.py b/addons/email/__init__.py
index 95b26dd215f..d4d786ed27f 100644
--- a/addons/email/__init__.py
+++ b/addons/email/__init__.py
@@ -19,7 +19,7 @@
#
##############################################################################
-import email_smtp_server
+#import email_smtp_server
import email_message
import email_thread
import res_partner
diff --git a/addons/email/email_data.xml b/addons/email/email_data.xml
index cd824172473..8423222ea9b 100644
--- a/addons/email/email_data.xml
+++ b/addons/email/email_data.xml
@@ -1,17 +1,7 @@
-
- Administrator
-
-
- example@test.com
- draft
-
- localhost
-
-
-
+
Email scheduler
1
@@ -19,7 +9,7 @@
-1
-
+
diff --git a/addons/email/email_message.py b/addons/email/email_message.py
index 81120f733da..c024de29253 100644
--- a/addons/email/email_message.py
+++ b/addons/email/email_message.py
@@ -83,7 +83,7 @@ class email_message_common(osv.osv_memory):
'priority':fields.integer('Priority'),
'body': fields.text('Description', translate=True),
'body_html': fields.text('HTML', help="Contains HTML version of email"),
- 'smtp_server_id':fields.many2one('email.smtp_server', 'SMTP Server'),
+ 'smtp_server_id':fields.many2one('ir.mail.server', 'SMTP Server'),
}
_rec_name='subject'
@@ -177,13 +177,6 @@ class email_message(osv.osv):
'display_text': fields.function(_get_display_text, method=True, type='text', size="512", string='Display Text'),
'debug':fields.boolean('Debug', readonly=True),
'history': fields.boolean('History', readonly=True),
- 'folder':fields.selection([
- ('drafts', 'Drafts'),
- ('inbox', 'Inbox'),
- ('outbox', 'Outbox'),
- ('trash', 'Trash'),
- ('sent', 'Sent Items'),
- ], 'Folder'),
'state':fields.selection([
('outgoing', 'Outgoing'),
('sent', 'Sent'),
@@ -194,26 +187,8 @@ class email_message(osv.osv):
}
_defaults = {
- 'state': lambda * a: 'draft',
- 'folder': lambda * a: 'outbox',
}
-# def unlink(self, cr, uid, ids, context=None):
-# """
-# It just changes the folder of the item to "Trash", if it is no in Trash folder yet,
-# or completely deletes it if it is already in Trash.
-# """
-# to_update = []
-# to_remove = []
-# for mail in self.browse(cr, uid, ids, context=context):
-# if mail.folder == 'trash':
-# to_remove.append(mail.id)
-# else:
-# to_update.append(mail.id)
-# # Changes the folder to trash
-# self.write(cr, uid, to_update, {'folder': 'trash'}, context=context)
-# return super(email_message, self).unlink(cr, uid, to_remove, context=context)
-
def init(self, cr):
cr.execute("""SELECT indexname
FROM pg_indexes
@@ -222,25 +197,8 @@ class email_message(osv.osv):
cr.execute("""CREATE INDEX email_message_res_id_model_idx
ON email_message (model, res_id)""")
-# def process_queue(self, cr, uid, ids, arg):
-# self.process_email_queue(cr, uid, ids=ids)
-# return True
-
-# def run_mail_scheduler(self, cursor, user, context=None):
-# """
-# This method is called by OpenERP Scheduler
-# to periodically send emails
-# """
-# try:
-# self.process_email_queue(cursor, user, context=context)
-# except Exception, e:
-# LOGGER.notifyChannel(
-# "Email Template",
-# netsvc.LOG_ERROR,
-# _("Error sending mail: %s") % e)
-
- def email_send(self, cr, uid, email_from, email_to, subject, body, model=False, email_cc=None, email_bcc=None, reply_to=False, attach=None,
- message_id=False, references=False, openobject_id=False, debug=False, subtype='plain', x_headers={}, priority='3', smtp_server_id=False, context=None):
+ def schedule_with_attach(self, cr, uid, email_from, email_to, subject, body, model=False, email_cc=None, email_bcc=None, reply_to=False, attach=None,
+ message_id=False, references=False, openobject_id=False, debug=False, subtype='plain', x_headers={}, priority='3', smtp_server_id=False, context=None, auto_delete=False):
attachment_obj = self.pool.get('ir.attachment')
if email_to and type(email_to) != list:
email_to = [email_to]
@@ -250,11 +208,11 @@ class email_message(osv.osv):
email_bcc = [email_bcc]
msg_vals = {
- 'name': subject,
+ 'subject': subject,
'model': model or '',
'date': time.strftime('%Y-%m-%d'),
'user_id': uid,
- 'description': body,
+ 'body': body,
'email_from': email_from,
'email_to': email_to and ','.join(email_to) or '',
'email_cc': email_cc and ','.join(email_cc) or '',
@@ -267,7 +225,6 @@ class email_message(osv.osv):
'headers': x_headers or False,
'priority': priority,
'debug': debug,
- 'folder': 'outbox',
'history': True,
'smtp_server_id': smtp_server_id,
'state': 'waiting',
@@ -277,10 +234,10 @@ class email_message(osv.osv):
attachment_ids = []
for attachment in attach:
attachment_data = {
- 'name': (subject or '') + _(' (Email Attachment)'),
+ 'subject': (subject or '') + _(' (Email Attachment)'),
'datas': attachment[1],
'datas_fname': attachment[0],
- 'description': subject or _('No Description'),
+ 'body': subject or _('No Description'),
'res_model':'email.message',
'res_id': email_msg_id,
}
@@ -298,13 +255,13 @@ class email_message(osv.osv):
if context is None:
context = {}
attachment_obj = self.pool.get('ir.attachment')
- smtp_server_obj = self.pool.get('email.smtp_server')
+ smtp_server_obj = self.pool.get('ir.mail.server')
if not ids:
- filters = [('folder', '=', 'outbox'), ('state', '=', 'waiting')]
+ filters = [('state', '=', 'outgoing')]
if 'filters' in context:
filters.extend(context['filters'])
ids = self.search(cr, uid, filters, context=context)
- self.write(cr, uid, ids, {'state':'sending', 'folder':'sent'}, context)
+ self.write(cr, uid, ids, {'state':'sending'}, context)
for message in self.browse(cr, uid, ids, context):
try:
attachments = []
@@ -315,22 +272,7 @@ class email_message(osv.osv):
smtp_ids = smtp_server_obj.search(cr, uid, [('default','=',True)])
if smtp_ids:
smtp_server = smtp_server_obj.browse(cr, uid, smtp_ids, context)[0]
- res = tools.email_send(message.email_from,
- message.email_to and message.email_to.split(',') or [],
- message.name, message.description,
- email_cc=message.email_cc and message.email_cc.split(',') or [],
- email_bcc=message.email_bcc and message.email_bcc.split(',') or [],
- reply_to=message.reply_to,
- attach=attachments, message_id=message.message_id, references = message.references,
- openobject_id=message.res_id,
- subtype=message.sub_type,
- x_headers=message.headers and eval(message.headers) or {},
- priority=message.priority, debug=message.debug,
- smtp_server=smtp_server and smtp_server.smtp_host or None,
- smtp_port=smtp_server and smtp_server.smtpport or None,
- ssl=smtp_server and smtp_server.smtpssl or False,
- smtp_user=smtp_server and smtp_server.smtpuname or None,
- smtp_password=smtp_server and smtp_server.smtppass or None)
+ res = self.send_email(cr, uid, ids, auto_commit=True, context=context)
if res:
self.write(cr, uid, [message.id], {'state':'sent', 'message_id': res}, context)
else:
diff --git a/addons/email/email_smtp_server.py b/addons/email/email_smtp_server.py
deleted file mode 100644
index f9b1be3a597..00000000000
--- a/addons/email/email_smtp_server.py
+++ /dev/null
@@ -1,376 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2011 Tiny SPRL ()
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see
-#
-##############################################################################
-
-from osv import osv
-from osv import fields
-from tools.translate import _
-import tools
-
-#import time
-#import binascii
-#import email
-#from email.header import decode_header
-#from email.utils import parsedate
-#import base64
-#import re
-#import logging
-#import xmlrpclib
-
-#_logger = logging.getLogger('mailgate')
-
-#import re
-import smtplib
-#import base64
-#from email import Encoders
-#from email.mime.base import MIMEBase
-#from email.mime.multipart import MIMEMultipart
-#from email.mime.text import MIMEText
-#from email.header import decode_header, Header
-#from email.utils import formatdate
-#import netsvc
-#import datetime
-#import tools
-#import logging
-
-#EMAIL_PATTERN = re.compile(r'([^()\[\] ,<:\\>@";]+@[^()\[\] ,<:\\>@";]+)') # See RFC822
-#def extract_emails(emails_str):
-# """
-# Returns a list of email addresses recognized in a string, ignoring the rest of the string.
-# extract_emails('a@b.com,c@bcom, "John Doe" , e@b.com') -> ['a@b.com','c@bcom', 'd@b.com', 'e@b.com']"
-# """
-# return EMAIL_PATTERN.findall(emails_str)
-#
-#
-#def extract_emails_from_dict(addresses={}):
-# """
-# Extracts email addresses from a dictionary with comma-separated address string values, handling
-# separately the To, CC, BCC and Reply-To addresses.
-#
-# :param addresses: a dictionary of addresses in the form {'To': 'a@b.com,c@bcom; d@b.com;e@b.com' , 'CC': 'e@b.com;f@b.com', ... }
-# :return: a dictionary with a list of separate addresses for each header (To, CC, BCC), with an additional key 'all-recipients'
-# containing all addresses for the 'To', 'CC', 'BCC' entries.
-# """
-# result = {'all-recipients':[]}
-# keys = ['To', 'CC', 'BCC', 'Reply-To']
-# for each in keys:
-# emails = extract_emails(addresses.get(each, u''))
-# while u'' in emails:
-# emails.remove(u'')
-# result[each] = emails
-# if each != 'Reply-To':
-# result['all-recipients'].extend(emails)
-# return result
-
-class email_smtp_server(osv.osv):
- """
- SMTP Server
- """
- _name = "email.smtp_server"
-
- _columns = {
- 'name': fields.char('Name',
- size=64, required=True,
- select=True,
- help="The Name is used as the Sender name along with the provided From Email, \
-unless it is already specified in the From Email, e.g: John Doe ",
- ),
- 'email_id': fields.char('From Email',
- size=120, required=True,
- help="eg: 'john@doe.com' or 'John Doe '"),
- 'smtpserver': fields.char('Server',
- size=120, required=True,
- help="Enter name of outgoing server, eg: smtp.yourdomain.com"),
- 'smtpport': fields.integer('SMTP Port',
- size=64, required=True,
- help="Enter port number, eg: 25 or 587"),
- 'smtpuname': fields.char('User Name',
- size=120, required=False,
- help="Specify the username if your SMTP server requires authentication, "
- "otherwise leave it empty."),
- 'smtppass': fields.char('Password',
- size=120,
- required=False),
- 'smtptls':fields.boolean('TLS'),
- 'smtpssl':fields.boolean('SSL/TLS'),
- 'default': fields.boolean('Default', help="Only one account can be default at a time"),
- }
-
- _defaults = {
- 'name':lambda self, cursor, user, context:self.pool.get( 'res.users'
- ).read(cursor, user, user, ['name'], context)['name'],
- 'smtpport': tools.config.get('smtp_port',25),
- 'smtpserver': tools.config.get('smtp_server','localhost'),
- 'smtpssl': tools.config.get('smtp_ssl',False),
- 'smtptls': True,
- }
-
- _sql_constraints = [
- (
- 'email_uniq',
- 'unique (email_id)',
- 'Another setting already exists with this email ID !')
- ]
-
- def _constraint_unique(self, cr, uid, ids, context=None):
- default_ids = self.search(cr, uid, [('default','=',True)])
- if len(default_ids) > 1:
- return False
-
- return True
-
- _constraints = [
- (_constraint_unique,
- 'Error: You must be define one default smtp server account !.',
- [])
- ]
-
- def name_get(self, cr, uid, ids, context=None):
- return [(a["id"], "%s (%s)" % (a['email_id'], a['name'])) for a in self.read(cr, uid, ids, ['name', 'email_id'], context=context)]
-
-
-
- def test_smtp_connection(self, cr, uid, ids, context=None):
- """
- Test SMTP connection works
- """
- try:
- for smtp_server in self.browse(cr, uid, ids, context=context):
- smtp = tools.connect_smtp_server(smtp_server.smtpserver, smtp_server.smtpport, user_name=smtp_server.smtpuname,
- user_password=smtp_server.smtppass, ssl=smtp_server.smtpssl, tls=smtp_server.smtptls)
- try:
- smtp.quit()
- except Exception:
- # ignored, just a consequence of the previous exception
- pass
- except Exception, error:
- raise osv.except_osv(
- _("SMTP Connection: Test failed"),
- _("Reason: %s") % error
- )
-
- raise osv.except_osv(_("SMTP Connection: Test Successfully!"), '')
-
-# def do_approval(self, cr, uid, ids, context=None):
-# #TODO: Check if user has rights
-# self.write(cr, uid, ids, {'state':'approved'}, context=context)
-## wf_service = netsvc.LocalService("workflow")
-#
-# def smtp_connection(self, cursor, user, id, context=None):
-# """
-# This method should now wrap smtp_connection
-# """
-# #This function returns a SMTP server object
-# logger = netsvc.Logger()
-# core_obj = self.browse(cursor, user, id, context=context)
-# if core_obj.smtpserver and core_obj.smtpport and core_obj.state == 'approved':
-# try:
-# serv = self.get_outgoing_server(cursor, user, id, context)
-# except Exception, error:
-# logger.notifyChannel(_("Email Template"), netsvc.LOG_ERROR, _("Mail from Account %s failed on login. Probable Reason:Could not login to server\nError: %s") % (id, error))
-# return False
-# #Everything is complete, now return the connection
-# return serv
-# else:
-# logger.notifyChannel(_("Email Template"), netsvc.LOG_ERROR, _("Mail from Account %s failed. Probable Reason:Account not approved") % id)
-# return False
-#
-##**************************** MAIL SENDING FEATURES ***********************#
-# def send_email(self, cr, uid, ids, addresses, subject='', body=None, payload=None, message_id=None, context=None):
-# #TODO: Replace all this with a single email object
-# if body is None:
-# body = {}
-# if payload is None:
-# payload = {}
-# if context is None:
-# context = {}
-# logger = netsvc.Logger()
-# for id in ids:
-# core_obj = self.browse(cr, uid, id, context)
-# serv = self.smtp_connection(cr, uid, id)
-# if serv:
-# try:
-# # Need a multipart/mixed wrapper for attachments if content is alternative
-# if payload:
-# payload_part = MIMEMultipart(_subtype='mixed')
-# text_part = MIMEMultipart(_subtype='mixed')
-# payload_part.attach(text_part)
-# else:
-# # otherwise a single multipart/mixed will do the whole job
-# payload_part = text_part = MIMEMultipart(_subtype='mixed')
-#
-# if subject:
-# payload_part['Subject'] = subject
-# from_email = core_obj.email_id
-# if '<' in from_email:
-# # We have a structured email address, keep it untouched
-# payload_part['From'] = Header(core_obj.email_id, 'utf-8').encode()
-# else:
-# # Plain email address, construct a structured one based on the name:
-# sender_name = Header(core_obj.name, 'utf-8').encode()
-# payload_part['From'] = sender_name + " <" + core_obj.email_id + ">"
-# payload_part['Organization'] = tools.ustr(core_obj.user.company_id.name)
-# payload_part['Date'] = formatdate()
-# addresses_l = extract_emails_from_dict(addresses)
-# if addresses_l['To']:
-# payload_part['To'] = u','.join(addresses_l['To'])
-# if addresses_l['CC']:
-# payload_part['CC'] = u','.join(addresses_l['CC'])
-# if addresses_l['Reply-To']:
-# payload_part['Reply-To'] = addresses_l['Reply-To'][0]
-# if message_id:
-# payload_part['Message-ID'] = message_id
-# if body.get('text', False):
-# temp_body_text = body.get('text', '')
-# l = len(temp_body_text.replace(' ', '').replace('\r', '').replace('\n', ''))
-# if l == 0:
-# body['text'] = u'No Mail Message'
-# # Attach parts into message container.
-# # According to RFC 2046, the last part of a multipart message, in this case
-# # the HTML message, is best and preferred.
-## if core_obj.send_pref in ('text', 'mixed', 'alternative'):
-## body_text = body.get('text', u'')
-## body_text = tools.ustr(body_text)
-## text_part.attach(MIMEText(body_text.encode("utf-8"), _charset='UTF-8'))
-## if core_obj.send_pref in ('html', 'mixed', 'alternative'):
-# html_body = body.get('html', u'')
-# if len(html_body) == 0 or html_body == u'':
-# html_body = body.get('text', u'<Empty Message>
').replace('\n', '
').replace('\r', '
')
-# html_body = tools.ustr(html_body)
-# text_part.attach(MIMEText(html_body.encode("utf-8"), _subtype='html', _charset='UTF-8'))
-#
-# #Now add attachments if any, wrapping into a container multipart/mixed if needed
-# if payload:
-# for file in payload:
-# part = MIMEBase('application', "octet-stream")
-# part.set_payload(base64.decodestring(payload[file]))
-# part.add_header('Content-Disposition', 'attachment; filename="%s"' % file)
-# Encoders.encode_base64(part)
-# payload_part.attach(part)
-# except Exception, error:
-# logger.notifyChannel(_("Email Template"), netsvc.LOG_ERROR, _("Mail from Account %s failed. Probable Reason:MIME Error\nDescription: %s") % (id, error))
-# return {'error_msg': _("Server Send Error\nDescription: %s")%error}
-# try:
-# serv.sendmail(payload_part['From'], addresses_l['all-recipients'], payload_part.as_string())
-# except Exception, error:
-# logging.getLogger('email_template').error(_("Mail from Account %s failed. Probable Reason: Server Send Error\n Description: %s"), id, error, exc_info=True)
-# return {'error_msg': _("Server Send Error\nDescription: %s")%error}
-# #The mail sending is complete
-# serv.close()
-# logger.notifyChannel(_("Email Template"), netsvc.LOG_INFO, _("Mail from Account %s successfully Sent.") % (id))
-# return True
-# else:
-# logger.notifyChannel(_("Email Template"), netsvc.LOG_ERROR, _("Mail from Account %s failed. Probable Reason:Account not approved") % id)
-# return {'nodestroy':True,'error_msg': _("Mail from Account %s failed. Probable Reason:Account not approved")% id}
-#
-# def extracttime(self, time_as_string):
-# """
-# TODO: DOC THis
-# """
-# logger = netsvc.Logger()
-# #The standard email dates are of format similar to:
-# #Thu, 8 Oct 2009 09:35:42 +0200
-# date_as_date = False
-# convertor = {'+':1, '-':-1}
-# try:
-# time_as_string = time_as_string.replace(',', '')
-# date_list = time_as_string.split(' ')
-# date_temp_str = ' '.join(date_list[1:5])
-# if len(date_list) >= 6:
-# sign = convertor.get(date_list[5][0], False)
-# else:
-# sign = False
-# try:
-# dt = datetime.datetime.strptime(
-# date_temp_str,
-# "%d %b %Y %H:%M:%S")
-# except:
-# try:
-# dt = datetime.datetime.strptime(
-# date_temp_str,
-# "%d %b %Y %H:%M")
-# except:
-# return False
-# if sign:
-# try:
-# offset = datetime.timedelta(
-# hours=sign * int(
-# date_list[5][1:3]
-# ),
-# minutes=sign * int(
-# date_list[5][3:5]
-# )
-# )
-# except Exception, e2:
-# """Looks like UT or GMT, just forget decoding"""
-# return False
-# else:
-# offset = datetime.timedelta(hours=0)
-# dt = dt + offset
-# date_as_date = dt.strftime('%Y-%m-%d %H:%M:%S')
-# except Exception, e:
-# logger.notifyChannel(
-# _("Email Template"),
-# netsvc.LOG_WARNING,
-# _(
-# "Datetime Extraction failed.Date:%s \
-# \tError:%s") % (
-# time_as_string,
-# e)
-# )
-# return date_as_date
-#
-# def send_receive(self, cr, uid, ids, context=None):
-# for id in ids:
-# ctx = context.copy()
-# ctx['filters'] = [('account_id', '=', id)]
-# self.pool.get('email.message').send_all_mail(cr, uid, [], context=ctx)
-# return True
-#
-# def decode_header_text(self, text):
-# """ Decode internationalized headers RFC2822.
-# To, CC, BCC, Subject fields can contain
-# text slices with different encodes, like:
-# =?iso-8859-1?Q?Enric_Mart=ED?= ,
-# =?Windows-1252?Q?David_G=F3mez?=
-# Sometimes they include extra " character at the beginning/
-# end of the contact name, like:
-# "=?iso-8859-1?Q?Enric_Mart=ED?="
-# and decode_header() does not work well, so we use regular
-# expressions (?= ? ? ?=) to split the text slices
-# """
-# if not text:
-# return text
-# p = re.compile("(=\?.*?\?.\?.*?\?=)")
-# text2 = ''
-# try:
-# for t2 in p.split(text):
-# text2 += ''.join(
-# [s.decode(
-# t or 'ascii'
-# ) for (s, t) in decode_header(t2)]
-# ).encode('utf-8')
-# except:
-# return text
-# return text2
-
-email_smtp_server()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/email/email_thread.py b/addons/email/email_thread.py
index e15b3228824..23cfd8595ab 100644
--- a/addons/email/email_thread.py
+++ b/addons/email/email_thread.py
@@ -86,9 +86,6 @@ class email_thread(osv.osv):
res[thread.id] = l
return res
- def msg_send(self, cr, uid, id, *args, **argv):
- raise Exception, _('Method is not implemented')
-
def history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, \
email_from=False, message_id=False, references=None, attach=None, email_cc=None, \
email_bcc=None, email_date=None, context=None):
@@ -134,14 +131,14 @@ class email_thread(osv.osv):
if not partner_id and case._name == 'res.partner':
partner_id = case.id
data = {
- 'name': keyword,
+ 'subject': keyword,
'user_id': uid,
'model' : case._name,
'partner_id': partner_id,
'res_id': case.id,
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
'message_id': message_id,
- 'description': details or (hasattr(case, 'description') and case.description or False),
+ 'body': details or (hasattr(case, 'description') and case.description or False),
'attachment_ids': [(6, 0, attachments)]
}
@@ -151,13 +148,13 @@ class email_thread(osv.osv):
param = ", ".join(param)
data = {
- 'name': subject or _('History'),
+ 'subject': subject or _('History'),
'history': True,
'user_id': uid,
'model' : case._name,
'res_id': case.id,
'date': email_date or time.strftime('%Y-%m-%d %H:%M:%S'),
- 'description': details,
+ 'body': details,
'email_to': email,
'email_from': email_from or \
(hasattr(case, 'user_id') and case.user_id and case.user_id.address_id and \
@@ -167,7 +164,6 @@ class email_thread(osv.osv):
'partner_id': partner_id,
'references': references,
'message_id': message_id,
- 'folder': 'inbox',
'attachment_ids': [(6, 0, attachments)]
}
obj.create(cr, uid, data, context=context)
@@ -247,12 +243,12 @@ class email_thread(osv.osv):
model_pool.write(cr, uid, [res_id], custom_values, context=context)
else:
data = {
- 'name': msg.get('subject'),
+ 'subject': msg.get('subject'),
'email_from': msg.get('from'),
'email_cc': msg.get('cc'),
'user_id': False,
- 'description': msg.get('body'),
- 'state' : 'draft',
+ 'body': msg.get('body'),
+ #'state' : 'draft',
}
data.update(self.get_partner(cr, uid, msg.get('from'), context=context))
res_id = model_pool.create(cr, uid, data, context=context)
diff --git a/addons/email/email_view.xml b/addons/email/email_view.xml
index 0849c766c2c..787cf101418 100644
--- a/addons/email/email_view.xml
+++ b/addons/email/email_view.xml
@@ -12,7 +12,7 @@
diff --git a/addons/email/security/ir.model.access.csv b/addons/email/security/ir.model.access.csv
index d9f3f3a74be..f4dad0d8765 100644
--- a/addons/email/security/ir.model.access.csv
+++ b/addons/email/security/ir.model.access.csv
@@ -1,4 +1,3 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
-"access_email_smtp_server","email.smtp_server","model_email_smtp_server",,1,0,0,0
"access_email_message","email.message","model_email_message",,1,0,0,0
"access_mailgate_thread","mailgate.thread","model_email_thread",,1,0,0,0
diff --git a/addons/email/wizard/email_compose_message.py b/addons/email/wizard/email_compose_message.py
index ade9095774e..1405971a874 100644
--- a/addons/email/wizard/email_compose_message.py
+++ b/addons/email/wizard/email_compose_message.py
@@ -191,17 +191,12 @@ class email_compose_message(osv.osv_memory):
})
return {'value': result}
- def on_change_smtp_server(self, cr, uid, ids, smtp_server_id, email_from, context=None):
- if not email_from and smtp_server_id:
- mail_server_pool = self.pool.get("email.smtp_server")
- email_from = mail_server_pool.browse(cr, uid, smtp_server_id, context).email_id or False
- return {'value':{'email_from': email_from}}
def save_to_drafts(self, cr, uid, ids, context=None):
if context is None:
context = {}
email_id = self.save_to_mailbox(cr, uid, ids, context=context)
- self.pool.get('email.message').write(cr, uid, email_id, {'folder':'drafts', 'state': 'draft'}, context)
+ self.pool.get('email.message').write(cr, uid, email_id, {'state': 'outgoing'}, context)
return {'type': 'ir.actions.act_window_close'}
def send_mail(self, cr, uid, ids, context=None):
@@ -223,7 +218,7 @@ class email_compose_message(osv.osv_memory):
references = mail.references and mail.references + "," + mail.message_id or mail.message_id
else:
message_id = mail.message_id
- email_id = email_message_pool.email_send(cr, uid, mail.email_from, mail.email_to, mail.name, mail.description,
+ email_id = email_message_pool.schedule_with_attach(cr, uid, mail.email_from, mail.email_to, mail.name, mail.description,
model=mail.model, email_cc=mail.email_cc, email_bcc=mail.email_bcc, reply_to=mail.reply_to,
attach=attachment, message_id=message_id, references=references, openobject_id=int(mail.res_id), debug=mail.debug,
subtype=mail.sub_type, x_headers=mail.headers, priority=mail.priority, smtp_server_id=mail.smtp_server_id and mail.smtp_server_id.id, context=context)
diff --git a/addons/email/wizard/email_compose_message_view.xml b/addons/email/wizard/email_compose_message_view.xml
index a4984ff1ad8..9cb9a6d43fc 100644
--- a/addons/email/wizard/email_compose_message_view.xml
+++ b/addons/email/wizard/email_compose_message_view.xml
@@ -12,8 +12,7 @@
-
+
diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py
index d75f52dab18..520307fae44 100644
--- a/addons/email_template/email_template.py
+++ b/addons/email_template/email_template.py
@@ -152,7 +152,15 @@ This is useful for CRM leads for example"),
help="Copy and paste the value in the "
"location you want to use a system value."),
'auto_delete': fields.boolean('Auto Delete', help="Permanently delete emails after sending"),
- 'model': fields.related('model_id','model', type='char', size=128, string='Object'),
+ 'model': fields.related('model_id','model', type='char', size=128, string='Object', help="Placeholders can be used here."),
+ 'email_from': fields.char('From', size=128, help="Email From. Placeholders can be used here."),
+ 'email_to': fields.char('To', size=256, help="Email Recipients. Placeholders can be used here."),
+ 'email_cc': fields.char('Cc', size=256, help="Carbon Copy Email Recipients. Placeholders can be used here."),
+ 'email_bcc': fields.char('Bcc', size=256, help="Blind Carbon Copy Email Recipients. Placeholders can be used here."),
+ 'message_id': fields.char('Message Id', size=1024, select=1, help="Message Id on Email. Placeholders can be used here."),
+ 'reply_to':fields.char('Reply-To', size=250, help="Placeholders can be used here."),
+ 'body': fields.text('Description', translate=True, help="Placeholders can be used here."),
+ 'body_html': fields.text('HTML', help="Contains HTML version of email. Placeholders can be used here."),
}
_sql_constraints = [
@@ -204,10 +212,6 @@ This is useful for CRM leads for example"),
except:
raise osv.except_osv(_("Warning"), _("Deletion of Record failed"))
- def delete_action(self, cr, uid, ids, context=None):
- self.unlink_action(cr, uid, ids, context=context)
- return True
-
def unlink(self, cr, uid, ids, context=None):
self.unlink_action(cr, uid, ids, context=context)
return super(email_template, self).unlink(cr, uid, ids, context=context)
@@ -344,7 +348,7 @@ This is useful for CRM leads for example"),
return {'value':result}
- def _generate_email(self, cr, uid, template_id, record_id, context=None):
+ def generate_email(self, cr, uid, template_id, record_id, context=None):
"""
Generates an email from the template for
record record_id of target object
@@ -378,8 +382,8 @@ This is useful for CRM leads for example"),
'email_cc': self.get_template_value(cr, uid, template.email_cc, model, record_id, context),
'email_bcc': self.get_template_value(cr, uid, template.email_bcc, model, record_id, context),
'reply_to': self.get_template_value(cr, uid, template.reply_to, model, record_id, context),
- 'name': self.get_template_value(cr, uid, template.subject, model, record_id, context),
- 'description': self.get_template_value(cr, uid, template.description, model, record_id, context),
+ 'subject': self.get_template_value(cr, uid, template.subject, model, record_id, context),
+ 'body': self.get_template_value(cr, uid, template.description, model, record_id, context),
#'body_html': self.get_template_value(cr, uid, template.body_html, model, record_id, context),
}
@@ -428,20 +432,12 @@ This is useful for CRM leads for example"),
#Send emails
context.update({'notemplate':True})
- email_id = email_message_pool.email_send(cr, uid, values.get('email_from'), values.get('email_to'), values.get('name'), values.get('description'),
+ email_id = email_message_pool.schedule_with_attach(cr, uid, values.get('email_from'), values.get('email_to'), values.get('name'), values.get('description'),
model=model, email_cc=values.get('email_cc'), email_bcc=values.get('email_bcc'), reply_to=values.get('reply_to'),
attach=attachment, message_id=values.get('message_id'), openobject_id=record_id, debug=True, subtype='plain', x_headers={}, priority='3', smtp_server_id=smtp_server.id, context=context)
email_message_pool.write(cr, uid, email_id, {'template_id': context.get('template_id',template.id)})
return email_id
-
-
- def generate_email(self, cr, uid, template_id, record_id, context=None):
- if context is None:
- context = {}
- email_id = self._generate_email(cr, uid, template_id, record_id, context)
- return email_id
-
email_template()
diff --git a/addons/email_template/email_template_view.xml b/addons/email_template/email_template_view.xml
index e38a47756d5..2757ad6b3ce 100644
--- a/addons/email_template/email_template_view.xml
+++ b/addons/email_template/email_template_view.xml
@@ -33,7 +33,7 @@
-
+
-
-
- email.message.template.form
- email.message
-
- form
-
-
-
-
-
-
-
diff --git a/addons/email_template/wizard/email_template_preview_view.xml b/addons/email_template/wizard/email_template_preview_view.xml
index 3e4c889ba65..5b7e3d65119 100644
--- a/addons/email_template/wizard/email_template_preview_view.xml
+++ b/addons/email_template/wizard/email_template_preview_view.xml
@@ -24,7 +24,7 @@
-
+
diff --git a/addons/email_template/wizard/email_template_send_wizard.py b/addons/email_template/wizard/email_template_send_wizard.py
index 4cd2e5294c2..6bf48bb4f42 100644
--- a/addons/email_template/wizard/email_template_send_wizard.py
+++ b/addons/email_template/wizard/email_template_send_wizard.py
@@ -132,7 +132,7 @@ class email_template_send_wizard(osv.osv_memory):
if context is None:
context = {}
mailid = self.save_to_mailbox(cr, uid, ids, context=context)
- self.pool.get('email.message').write(cr, uid, mailid, {'folder':'drafts', 'state': 'draft'}, context)
+ self.pool.get('email.message').write(cr, uid, mailid, {'state': 'outgoing'}, context)
return {'type': 'ir.actions.act_window_close'}
def send_mail(self, cr, uid, ids, context=None):
@@ -170,7 +170,7 @@ class email_template_send_wizard(osv.osv_memory):
email_ids = []
for template in self.browse(cr, uid, ids, context=context):
for record_id in context.get('src_rec_ids',[]):
- email_id = self._generate_email(cr, uid, template.id, record_id, context)
+ email_id = self.generate_email(cr, uid, template.id, record_id, context)
email_ids.append(email_id)
return email_ids
diff --git a/addons/event/event.py b/addons/event/event.py
index b181c0e99a5..5e757d02903 100644
--- a/addons/event/event.py
+++ b/addons/event/event.py
@@ -547,7 +547,7 @@ class event_registration(osv.osv):
subject = _('Auto Confirmation: [%s] %s') %(regestration.id, regestration.name)
body = regestration.event_id.mail_confirm
if subject or body:
- email_message_obj.email_send(cr, uid, src, email_to, subject, body, model='event.registration', email_cc=email_cc, openobject_id=regestration.id)
+ email_message_obj.schedule_with_attach(cr, uid, src, email_to, subject, body, model='event.registration', email_cc=email_cc, openobject_id=regestration.id)
self.history(cr, uid, [regestration], subject, history = True, \
email=email_to, details=body, \
subject=subject, email_from=src, \
diff --git a/addons/hr_evaluation/hr_evaluation.py b/addons/hr_evaluation/hr_evaluation.py
index f28d27e0239..6455b72837a 100644
--- a/addons/hr_evaluation/hr_evaluation.py
+++ b/addons/hr_evaluation/hr_evaluation.py
@@ -229,7 +229,7 @@ class hr_evaluation(osv.osv):
sub = phase.email_subject
dest = [child.work_email]
if dest:
- email_message_obj.email_send(cr, uid, evaluation.employee_id.work_email, dest, sub, body, model='hr_evaluation.evaluation')
+ email_message_obj.schedule_with_attach(cr, uid, evaluation.employee_id.work_email, dest, sub, body, model='hr_evaluation.evaluation')
self.write(cr, uid, ids, {'state':'wait'}, context=context)
return True
diff --git a/addons/hr_evaluation/wizard/hr_evaluation_mail.py b/addons/hr_evaluation/wizard/hr_evaluation_mail.py
index 3bf79b31e71..37696ad465b 100644
--- a/addons/hr_evaluation/wizard/hr_evaluation_mail.py
+++ b/addons/hr_evaluation/wizard/hr_evaluation_mail.py
@@ -35,7 +35,7 @@ class hr_evaluation_reminder(osv.osv_memory):
current_interview = hr_evaluation_interview_obj.browse(cr, uid, evaluation_data.get('evaluation_id'))
if current_interview.state == "waiting_answer" and current_interview.user_to_review_id.work_email :
msg = " Hello %s, \n\n Kindly post your response for '%s' survey interview. \n\n Thanks," %(current_interview.user_to_review_id.name, current_interview.survey_id.title)
- email_message_obj.email_send(cr, uid, tools.config['email_from'], [current_interview.user_to_review_id.work_email],\
+ email_message_obj.schedule_with_attach(cr, uid, tools.config['email_from'], [current_interview.user_to_review_id.work_email],\
'Reminder to fill up Survey', msg, model='hr.evaluation.reminder')
return {'type': 'ir.actions.act_window_close'}
diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py
index 79fd7733672..7d210f8b685 100644
--- a/addons/hr_recruitment/hr_recruitment.py
+++ b/addons/hr_recruitment/hr_recruitment.py
@@ -380,17 +380,6 @@ class hr_applicant(crm.crm_case, osv.osv):
res = self.write(cr, uid, ids, vals, context=context)
return res
- def msg_send(self, cr, uid, id, *args, **argv):
- """ Send The Message
- @param self: The object pointer
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of email’s IDs
- @param *args: Return Tuple Value
- @param **args: Return Dictionary of Keyword Value
- """
- return True
-
def case_open(self, cr, uid, ids, *args):
"""
@param self: The object pointer
diff --git a/addons/project/wizard/project_task_close.py b/addons/project/wizard/project_task_close.py
index f396dcecca7..b4b4f46c9a5 100644
--- a/addons/project/wizard/project_task_close.py
+++ b/addons/project/wizard/project_task_close.py
@@ -113,7 +113,7 @@ class project_task_close(osv.osv_memory):
to_adr.append(data.manager_email)
if data.partner_warn and data.partner_email:
to_adr.append(data.partner_email)
- mail_id = email_message_obj.email_send(cr, uid, from_adr, to_adr, subject, tools.ustr(body), model='project.task.close', email_bcc=[from_adr])
+ mail_id = email_message_obj.schedule_with_attach(cr, uid, from_adr, to_adr, subject, tools.ustr(body), model='project.task.close', email_bcc=[from_adr])
if not mail_id:
raise osv.except_osv(_('Error'), _("Couldn't send mail! Check the email ids and smtp configuration settings"))
return {}
diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py
index e4f9a379358..3349334041f 100644
--- a/addons/project_issue/project_issue.py
+++ b/addons/project_issue/project_issue.py
@@ -455,18 +455,6 @@ class project_issue(crm.crm_case, osv.osv):
res = self.write(cr, uid, ids, vals)
return res
- def msg_send(self, cr, uid, id, *args, **argv):
-
- """ Send The Message
- @param self: The object pointer
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of email’s IDs
- @param *args: Return Tuple Value
- @param **args: Return Dictionary of Keyword Value
- """
- return True
-
def copy(self, cr, uid, id, default=None, context=None):
issue = self.read(cr, uid, id, ['name'], context=context)
if not default:
diff --git a/addons/project_mailgate/project_mailgate.py b/addons/project_mailgate/project_mailgate.py
index 557726352ec..23a97af7fc5 100644
--- a/addons/project_mailgate/project_mailgate.py
+++ b/addons/project_mailgate/project_mailgate.py
@@ -106,9 +106,6 @@ class project_tasks(osv.osv):
return len(res) and res[0] or False
return res
- def msg_send(self, cr, uid, id, *args, **argv):
- return True
-
def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, email_from=False, message_id=False, attach=[], context=None):
mailgate_pool = self.pool.get('email.thread')
return mailgate_pool.history(cr, uid, cases, keyword, history=history,\
diff --git a/addons/project_scrum/project_scrum.py b/addons/project_scrum/project_scrum.py
index 637a4a3b36f..cf4df32eecb 100644
--- a/addons/project_scrum/project_scrum.py
+++ b/addons/project_scrum/project_scrum.py
@@ -326,7 +326,7 @@ class project_scrum_meeting(osv.osv):
body += "\n"+ _('*Tasks since yesterday:')+ '\n_______________________%s' % (meeting_id.question_yesterday) + '\n' +_("*Task for Today:")+ '\n_______________________ %s\n' % (meeting_id.question_today )+ '\n' +_('*Blocks encountered:') +'\n_______________________ %s' % (meeting_id.question_blocks or _('No Blocks'))
body += "\n\n"+_('Thank you')+",\n"+ user.name
sub_name = meeting_id.name or _('Scrum Meeting of %s') % meeting_id.date
- flag = email_message_obj.email_send(cr, uid, user_email , [email], sub_name, body, model='project.scrum.meeting', reply_to=None, openobject_id=str(meeting_id.id))
+ flag = email_message_obj.schedule_with_attach(cr, uid, user_email , [email], sub_name, body, model='project.scrum.meeting', reply_to=None, openobject_id=str(meeting_id.id))
if not flag:
return False
return True
diff --git a/addons/project_scrum/wizard/project_scrum_email.py b/addons/project_scrum/wizard/project_scrum_email.py
index 40d8db2ea10..37893f87bc7 100644
--- a/addons/project_scrum/wizard/project_scrum_email.py
+++ b/addons/project_scrum/wizard/project_scrum_email.py
@@ -101,8 +101,8 @@ class project_scrum_email(osv.osv_memory):
if data.scrum_master_email == data.product_owner_email:
data.product_owner_email = False
if data.scrum_master_email:
- email_message_obj.email_send(cr, uid, user_email, [data.scrum_master_email], data.subject, body, model='project.scrum.email', reply_to=user_email)
+ email_message_obj.schedule_with_attach(cr, uid, user_email, [data.scrum_master_email], data.subject, body, model='project.scrum.email', reply_to=user_email)
if data.product_owner_email:
- email_message_obj.email_send(cr, uid, user_email, [data.product_owner_email], data.subject, body, model='project.scrum.email', reply_to=user_email)
+ email_message_obj.schedule_with_attach(cr, uid, user_email, [data.product_owner_email], data.subject, body, model='project.scrum.email', reply_to=user_email)
return {'type': 'ir.actions.act_window_close'}
project_scrum_email()
diff --git a/addons/share/wizard/share_wizard.py b/addons/share/wizard/share_wizard.py
index 02cbda31a1e..32b1b51d598 100644
--- a/addons/share/wizard/share_wizard.py
+++ b/addons/share/wizard/share_wizard.py
@@ -462,7 +462,7 @@ class share_create(osv.osv_memory):
body += _("This additional data has been automatically added to your current access.\n")
body += _("You may use your existing login and password to view it. As a reminder, your login is %s.\n") % result_line.login
- if not email_message_obj.email_send(cr, uid,
+ if not email_message_obj.schedule_with_attach(cr, uid,
user.user_email,
[email_to],
subject,
diff --git a/addons/survey/wizard/survey_answer.py b/addons/survey/wizard/survey_answer.py
index ea468e36a67..b10368d191f 100644
--- a/addons/survey/wizard/survey_answer.py
+++ b/addons/survey/wizard/survey_answer.py
@@ -429,7 +429,7 @@ class survey_question_wiz(osv.osv_memory):
if user_email and resp_email:
user_name = user_obj.browse(cr, uid, uid, context=context).name
mail = "Hello " + survey_data.responsible_id.name + ",\n\n " + str(user_name) + " Give Response Of " + survey_data.title + " Survey.\n\n Thanks,"
- email_message_obj.email_send(cr, uid, user_email, [resp_email], "Survey Answer Of " + str(user_name) , mail, model='survey.question.wiz', attach = attachments)
+ email_message_obj.schedule_with_attach(cr, uid, user_email, [resp_email], "Survey Answer Of " + str(user_name) , mail, model='survey.question.wiz', attach = attachments)
xml_form = etree.Element('form', {'string': _('Complete Survey Answer')})
etree.SubElement(xml_form, 'separator', {'string': 'Complete Survey', 'colspan': "4"})
@@ -448,7 +448,7 @@ class survey_question_wiz(osv.osv_memory):
@param self: The object pointer
@param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
+ @param uid: the current user’s ID for security checks,
@param res_ids: List of survey answer IDs,
@param report_name: name of the report,
@param file_name: To give file name of the report,
diff --git a/addons/survey/wizard/survey_send_invitation.py b/addons/survey/wizard/survey_send_invitation.py
index eb14f76cc5e..a4638e3dd04 100644
--- a/addons/survey/wizard/survey_send_invitation.py
+++ b/addons/survey/wizard/survey_send_invitation.py
@@ -152,7 +152,7 @@ class survey_send_invitation(osv.osv_memory):
mail = record['mail']%{'login':addr.email, 'passwd':user.password, \
'name' : addr.name}
if record['send_mail_existing']:
- email_message_obj.email_send(cr, uid, record['mail_from'], [addr.email] , \
+ email_message_obj.schedule_with_attach(cr, uid, record['mail_from'], [addr.email] , \
record['mail_subject_existing'] , mail, model='survey.send.invitation')
existing+= "- %s (Login: %s, Password: %s)\n" % (user.name, addr.email, \
user.password)
@@ -163,7 +163,7 @@ class survey_send_invitation(osv.osv_memory):
mail = record['mail']%{'login': user_email.login, \
'passwd': user_email.password, 'name': addr.name}
if record['send_mail_existing']:
- email_message_obj.email_send(cr, uid, record['mail_from'], [addr.email],\
+ email_message_obj.schedule_with_attach(cr, uid, record['mail_from'], [addr.email],\
record['mail_subject_existing'], mail, model='survey.send.invitation')
res_user+= "- %s (Login: %s, Password: %s)\n" % \
(user_email.name, user_email.login, user_email.password)
@@ -172,7 +172,7 @@ class survey_send_invitation(osv.osv_memory):
out+= addr.email + ',' + passwd + '\n'
mail= record['mail'] % {'login' : addr.email, 'passwd' : passwd, 'name' : addr.name}
if record['send_mail']:
- ans = email_message_obj.email_send(cr, uid, record['mail_from'], [addr.email], \
+ ans = email_message_obj.schedule_with_attach(cr, uid, record['mail_from'], [addr.email], \
record['mail_subject'], mail, model='survey.send.invitation', attach = attachments)
if ans: