[IMP] add argument in email_send method of addons module.
bzr revid: ysa@tinyerp.com-20110209091848-tb1d9qcj9bz3iq2b
This commit is contained in:
parent
ab8194f033
commit
659900e4d5
|
@ -277,7 +277,7 @@ class account_followup_print_all(osv.osv_memory):
|
|||
msg = ''
|
||||
if dest:
|
||||
try:
|
||||
email_message_obj.email_send(src, dest, sub, body, model='account.followup.print.all')
|
||||
email_message_obj.email_send(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 )
|
||||
|
|
|
@ -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(emailfrom, emails, name, body, model='base.action.rule', reply_to=reply_to, openobject_id=str(obj.id))
|
||||
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))
|
||||
|
||||
|
||||
def do_check(self, cr, uid, action, obj, context=None):
|
||||
|
|
|
@ -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(
|
||||
email_message_obj.email_send(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(
|
||||
email_message_obj.email_send(cr, uid,
|
||||
tools.config.get('email_from', False),
|
||||
mail_to,
|
||||
sub,
|
||||
|
|
|
@ -481,7 +481,7 @@ class crm_case(object):
|
|||
|
||||
# Send an email
|
||||
subject = "Reminder: [%s] %s" % (str(case.id), case.name, )
|
||||
email_message_obj.email_send(
|
||||
email_message_obj.email_send(cr, uid,
|
||||
src,
|
||||
[dest],
|
||||
subject,
|
||||
|
|
|
@ -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(emailfrom, emails, name, body, model='base.action.rule', reply_to=reply_to, openobject_id=str(obj.id))
|
||||
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))
|
||||
|
||||
def do_check(self, cr, uid, action, obj, context=None):
|
||||
""" @param self: The object pointer
|
||||
|
|
|
@ -123,7 +123,7 @@ class crm_send_new_email(osv.osv_memory):
|
|||
if obj.html:
|
||||
subtype = 'html'
|
||||
|
||||
flag = email_message_obj.email_send(
|
||||
flag = email_message_obj.email_send(cr, uid,
|
||||
email_from,
|
||||
emails,
|
||||
obj.subject,
|
||||
|
|
|
@ -25,7 +25,7 @@ from tools.translate import _
|
|||
import tools
|
||||
import netsvc
|
||||
|
||||
#import time
|
||||
import time
|
||||
#import binascii
|
||||
#import email
|
||||
#from email.header import decode_header
|
||||
|
@ -236,8 +236,8 @@ class email_message(osv.osv):
|
|||
netsvc.LOG_ERROR,
|
||||
_("Error sending mail: %s") % e)
|
||||
|
||||
def email_send(cr, uid, email_from, email_to, subject, body, model=False, email_cc=None, email_bcc=None, reply_to=False, attach=None,
|
||||
openobject_id=False, debug=False, subtype='plain', x_headers={}, priority='3'):
|
||||
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,
|
||||
openobject_id=False, debug=False, subtype='plain', x_headers={}, priority='3', context=None):
|
||||
attachment_obj = self.pool.get('ir.attachment')
|
||||
msg_vals = {
|
||||
'name': subject,
|
||||
|
@ -260,6 +260,7 @@ class email_message(osv.osv):
|
|||
}
|
||||
email_msg_id = self.create(cr, uid, msg_vals, context)
|
||||
if attach:
|
||||
attachment_ids = []
|
||||
for attachment in attach:
|
||||
attachment_data = {
|
||||
'name': (subject or '') + _(' (Email Attachment)'),
|
||||
|
@ -269,10 +270,9 @@ class email_message(osv.osv):
|
|||
'res_model':'email.message',
|
||||
'res_id': email_msg_id,
|
||||
}
|
||||
attachment_id = attachment_obj.create(cr, uid, attachment_data, context)
|
||||
if attachment_id:
|
||||
attachment_ids.append(attachment_obj.create(cr, uid, attachment_data, context))
|
||||
self.write(cr, uid, email_msg_id,
|
||||
{ 'attachments_ids':[(4, attachment_id)] }, context)
|
||||
{ 'attachment_ids': [[6, 0, attachment_ids]] }, context)
|
||||
return True
|
||||
|
||||
def process_email_queue(self, cr, uid, ids=None, context=None):
|
||||
|
|
|
@ -544,7 +544,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(src, email_to, subject, body, model='event.registration', email_cc=email_cc, openobject_id=regestration.id)
|
||||
email_message_obj.email_send(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, \
|
||||
subjec=subject, email_from=src, \
|
||||
|
|
|
@ -229,7 +229,7 @@ class hr_evaluation(osv.osv):
|
|||
sub = phase.email_subject
|
||||
dest = [child.work_email]
|
||||
if dest:
|
||||
email_message_obj.email_send(evaluation.employee_id.work_email, dest, sub, body, model='hr_evaluation.evaluation')
|
||||
email_message_obj.email_send(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
|
||||
|
|
|
@ -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(tools.config['email_from'], [current_interview.user_to_review_id.work_email],\
|
||||
email_message_obj.email_send(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'}
|
||||
|
||||
|
|
|
@ -107,7 +107,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(from_adr, to_adr, subject, tools.ustr(body), model='project.task.close', email_bcc=[from_adr])
|
||||
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])
|
||||
if not mail_id:
|
||||
raise osv.except_osv(_('Error'), _("Couldn't send mail! Check the email ids and smtp configuration settings"))
|
||||
return {}
|
||||
|
|
|
@ -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(user_email , [email], sub_name, body, model='project.scrum.meeting', reply_to=None, openobject_id=str(meeting_id.id))
|
||||
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))
|
||||
if not flag:
|
||||
return False
|
||||
return True
|
||||
|
|
|
@ -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(user_email, [data.scrum_master_email], data.subject, body, model='project.scrum.email', reply_to=user_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)
|
||||
if data.product_owner_email:
|
||||
email_message_obj.email_send(user_email, [data.product_owner_email], data.subject, body, model='project.scrum.email', reply_to=user_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)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
project_scrum_email()
|
||||
|
|
|
@ -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(
|
||||
if not email_message_obj.email_send(cr, uid,
|
||||
user.user_email,
|
||||
[email_to],
|
||||
subject,
|
||||
|
|
|
@ -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(user_email, [resp_email], "Survey Answer Of " + str(user_name) , mail, model='survey.question.wiz', attach = attachments)
|
||||
email_message_obj.email_send(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"})
|
||||
|
|
|
@ -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(record['mail_from'], [addr.email] , \
|
||||
email_message_obj.email_send(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(record['mail_from'], [addr.email],\
|
||||
email_message_obj.email_send(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(record['mail_from'], [addr.email], \
|
||||
ans = email_message_obj.email_send(cr, uid, record['mail_from'], [addr.email], \
|
||||
record['mail_subject'], mail, model='survey.send.invitation', attach = attachments)
|
||||
|
||||
if ans:
|
||||
|
|
Loading…
Reference in New Issue