[REM] email.smtp_server: removed email.smtp_server and did changes in email module

bzr revid: rha@tinyerp.com-20110321133156-y57yw6sekshnw9ns
This commit is contained in:
Rifakat Haradwala (Open ERP) 2011-03-21 19:01:56 +05:30
parent 455fb2d6b3
commit 2fe7c51e36
34 changed files with 70 additions and 686 deletions

View File

@ -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 )

View File

@ -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):

View File

@ -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,

View File

@ -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,

View File

@ -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

View File

@ -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 users ID for security checks,
@param ids: List of emails 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}}

View File

@ -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,

View File

@ -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 users ID for security checks,
@param ids: List of emails IDs
@param *args: Return Tuple Value
@param **args: Return Dictionary of Keyword Value
"""
return True
crm_claim()

View File

@ -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 users ID for security checks,
@param ids: List of emails 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:

View File

@ -19,7 +19,7 @@
#
##############################################################################
import email_smtp_server
#import email_smtp_server
import email_message
import email_thread
import res_partner

View File

@ -1,17 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="email_smtp_server_administrator0" model="email.smtp_server">
<field name="name">Administrator</field>
<field eval="1" name="default"/>
<field eval="1" name="smtptls"/>
<field name="email_id">example@test.com</field>
<field name="state">draft</field>
<field eval="25" name="smtpport"/>
<field name="smtpserver">localhost</field>
<field eval="0" name="smtpssl"/>
</record>
<record forcecreate="True" id="ir_cron_mail_scheduler_action" model="ir.cron">
<record forcecreate="True" id="ir_cron_mail_scheduler_action" model="ir.cron">
<field name="name">Email scheduler</field>
<field name="user_id" ref="base.user_root"/>
<field name="interval_number">1</field>
@ -19,7 +9,7 @@
<field name="numbercall">-1</field>
<field eval="False" name="doall"/>
<field eval="'email.message'" name="model"/>
<!--<field eval="'run_mail_scheduler'" name="function"/>-->
<field eval="'process_email_queue'" name="function"/>
<field eval="'()'" name="args"/>
</record>
</data>

View File

@ -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:

View File

@ -1,376 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2011 Tiny SPRL (<http://tiny.be>)
#
# 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 <http://www.gnu.org/licenses/>
#
##############################################################################
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" <d@b.com> , 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 <john@doe.com>",
),
'email_id': fields.char('From Email',
size=120, required=True,
help="eg: 'john@doe.com' or 'John Doe <john@doe.com>'"),
'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'<Empty Message>')
## 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'<p>&lt;Empty Message&gt;</p>').replace('\n', '<br/>').replace('\r', '<br/>')
# 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?= <enricmarti@company.com>,
# =?Windows-1252?Q?David_G=F3mez?= <david@company.com>
# Sometimes they include extra " character at the beginning/
# end of the contact name, like:
# "=?iso-8859-1?Q?Enric_Mart=ED?=" <enricmarti@company.com>
# 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:

View File

@ -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)

View File

@ -12,7 +12,7 @@
<field name="arch" type="xml">
<form string="Email message">
<group colspan="4" col="6">
<field name="name" widget="char" size="512"/>
<field name="subject" widget="char" size="512"/>
<field name="date"/>
<field name="user_id" string="User"/>
<field name="partner_id" readonly="1" />
@ -40,11 +40,11 @@
<field name="references" widget="char" size="4096"/>
</group>
<separator string="Description" colspan="4"/>
<field name="description" nolabel="1" colspan="4"/>
<group col="4" colspan="4" attrs="{'invisible':[('folder','not in',['drafts','outbox'])]}">
<field name="body" nolabel="1" colspan="4"/>
<group col="4" colspan="4">
<separator string="" colspan="4"/>
<field name="state"/>
<!--<button name="process_queue" string="Send" type="object" icon="gtk-execute" states='draft,waiting,sending'/>-->
<button name="process_email_queue" string="Send" type="object" icon="gtk-execute" states='draft,waiting,sending'/>
<button name="process_retry" string="Re-Try" type="object" icon="gtk-execute" states='exception'/>
</group>
</page>
@ -55,7 +55,6 @@
<page string="Advanced">
<group col="4" colspan="4">
<field name="smtp_server_id"/>
<field name="folder"/>
<field name="sub_type"/>
<field name="headers"/>
<field name="priority"/>
@ -73,14 +72,13 @@
<field name="model">email.message</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree colors="gray:folder in ('trash')" string="Emails">
<tree string="Emails">
<field name="date"/>
<field name="name"/>
<field name="subject"/>
<field name="email_from"/>
<field name="user_id" string="User"/>
<field name="message_id" string="Message" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="folder"/>
<field name="state"/>
<button name="open_document" string="Open Document" type="object" icon="gtk-jump-to"/>
<button name="open_attachment" string="Open Attachments" type="object" icon="gtk-jump-to"/>
@ -94,16 +92,11 @@
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Email Search">
<filter icon="terp-document-new" string="Draft" domain="[('folder','=','drafts')]"/>
<filter icon="terp-personal" string="Inbox" domain="[('folder','=','inbox')]"/>
<filter icon="terp-check" string="Outbox" domain="[('folder','=','outbox')]"/>
<filter icon="terp-partner" string="Sent Items" domain="[('folder','=','sent')]"/>
<filter icon="terp-mail_delete" string="Trash" domain="[('folder','=','trash')]"/>
<separator orientation="vertical"/>
<filter icon="terp-call-start" string="Waiting" domain="[('state','=','waiting')]"/>
<filter icon="terp-gtk-stop" string="Exception" domain="[('state','=','exception')]"/>
<field name="email_from"/>
<field name="name"/>
<field name="subject"/>
<field name="date"/>
<field name="user_id" string="User"/>
<field name="partner_id" string="Partner Name"/>
@ -150,82 +143,8 @@
parent="menu_email_message_tools"
action="action_view_mail_message" />
<record model="ir.ui.view" id="email_smtp_server_form">
<field name="name">email.smtp_server.form</field>
<field name="model">email.smtp_server</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Smtp Server Configuration">
<group colspan="4">
<field name="name"/>
<field name="default"/>
</group>
<notebook colspan="4">
<page string="Configuration">
<separator string="Server Information" colspan="4"/>
<group colspan="4" col="8">
<field name="smtpserver"/>
<field name="smtpport"/>
<field name="smtpssl"/>
<field name="smtptls"/>
</group>
<separator string="User Information" colspan="4"/>
<group col="6" colspan="4">
<field name="email_id"/>
<field name="smtpuname"/>
<field name="smtppass" password="True"/>
</group>
<separator string="" colspan="4"/>
<label string="" colspan="2"/>
<button name="test_smtp_connection" type="object" string="Test Connection" icon="gtk-network" colspan="2"/>
</page>
</notebook>
</form>
</field>
</record>
<record model="ir.ui.view" id="email_smtp_server_tree">
<field name="name">email.smtp_server.tree</field>
<field name="model">email.smtp_server</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="SMTP Server">
<field name="name"/>
<field name="email_id"/>
<field name="smtpserver"/>
<field name="default"/>
<button name="test_smtp_connection" type="object" string="Test Connection" icon="gtk-network"/>
</tree>
</field>
</record>
<record id="view_email_smtp_server_search" model="ir.ui.view">
<field name="name">email_smtp.server.search</field>
<field name="model">email.smtp_server</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Smtp Server">
<field name="name"/>
<field name="email_id"/>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="action_email_smtp_server_tree_all">
<field name="name">Outgoing Servers</field>
<field name="res_model">email.smtp_server</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" ref="email_smtp_server_tree" />
<field name="context">{'group_by': [], 'search_default_draft': 1, 'search_default_my': 1}</field>
<field name="search_view_id" ref="view_email_smtp_server_search"/>
</record>
<menuitem name="Email" id="menu_config_email" parent="base.menu_lunch_survey_root" sequence="20"/>
<menuitem name="Outgoing Servers" id="menu_email_smtp_server_all" parent="menu_config_email" action="action_email_smtp_server_tree_all"/>
</data>
</openerp>

View File

@ -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

1 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
2 access_email_message email.message model_email_message 1 0 0 0
3 access_mailgate_thread mailgate.thread model_email_thread 1 0 0 0

View File

@ -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)

View File

@ -12,8 +12,7 @@
<field name="model" invisible="1"/>
<field name="res_id" invisible="context.get('active_model','') != 'ir.ui.menu'"
colspan="4" on_change="on_change_referred_doc(model, res_id, context)"/>
<field name="smtp_server_id" widget="selection" colspan="4"
on_change="on_change_smtp_server(smtp_server_id, email_from)"/>
<field name="smtp_server_id" widget="selection" colspan="4"/>
<field name="email_from" colspan="4" required="1"/>
<field name="email_to" colspan="4" required="1"/>
<field name="email_cc" colspan="4"/>

View File

@ -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()

View File

@ -33,7 +33,7 @@
<field name="subject" colspan="4" required="1"/>
<notebook>
<page string="Body">
<field name="description" colspan="4" nolabel="1"/>
<field name="body" colspan="4" nolabel="1"/>
</page>
<!-- <page string="Body (Raw HTML)">
<field name="def_body_html" colspan="4" nolabel="1"/>
@ -70,7 +70,7 @@
<button name="create_action" string="Create Action" type="object" icon="gtk-execute" colspan="2" attrs="{'invisible':[('ref_ir_act_window','!=',False), ('ref_ir_value','!=',False)]}"/>
<field name="ref_ir_act_window"/>
<field name="ref_ir_value"/>
<button name="delete_action" string="Delete Action" type="object" icon="gtk-delete" colspan="2" attrs="{'invisible':[('ref_ir_act_window','=',False), ('ref_ir_value','=',False)]}"/>
<button name="unlink_action" string="Delete Action" type="object" icon="gtk-delete" colspan="2" attrs="{'invisible':[('ref_ir_act_window','=',False), ('ref_ir_value','=',False)]}"/>
</group>
<group colspan="2" col="2">
<separator string="Advanced Options" colspan="2"/>
@ -155,19 +155,5 @@
<menuitem name="Templates" id="menu_email_template_all_tools"
parent="email.menu_email_message_tools" action="action_email_template_tree_all" />
<!-- Inherit email.message view -->
<record model="ir.ui.view" id="view_email_message_template_form">
<field name="name">email.message.template.form</field>
<field name="model">email.message</field>
<field name="inherit_id" ref="email.view_email_message_form"/>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="debug" position="after">
<field name="template_id"/>
</field>
</field>
</record>
</data>
</openerp>

View File

@ -24,7 +24,7 @@
<separator string= "Body" colspan="2" />
<!--<separator string= "Body(Html)" colspan="2" />-->
<newline/>
<field name="description" nolabel="1" colspan="2" readonly="1"/>
<field name="body" nolabel="1" colspan="2" readonly="1"/>
<!-- <field name="body_html" nolabel="1" colspan="2" readonly="1"/>-->
</group>
<field name="report_name" colspan="2" readonly="1"/>

View File

@ -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

View File

@ -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, \

View File

@ -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

View File

@ -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'}

View File

@ -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 users ID for security checks,
@param ids: List of emails 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

View File

@ -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 {}

View File

@ -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 users ID for security checks,
@param ids: List of emails 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:

View File

@ -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,\

View File

@ -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

View File

@ -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()

View File

@ -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,

View File

@ -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 users ID for security checks,
@param uid: the current users 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,

View File

@ -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: