diff --git a/addons/account_followup/wizard/account_followup_print.py b/addons/account_followup/wizard/account_followup_print.py
index f2438ab7c64..05fa6ee6886 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 04bf76033fc..687cd836d1a 100644
--- a/addons/crm/crm.py
+++ b/addons/crm/crm.py
@@ -308,7 +308,7 @@ class crm_case(object):
return {'value': {'phone': address.phone}}
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('mailgate.thread')
+ mailgate_pool = self.pool.get('email.thread')
return mailgate_pool.history(cr, uid, cases, keyword, history=history,\
subject=subject, email=email, \
details=details, email_from=email_from,\
@@ -458,7 +458,7 @@ class crm_case(object):
raise osv.except_osv(_('Error!'), ("Partner Email is not specified in Case"))
if not case.user_id.user_email:
raise osv.except_osv(_('Error!'), ("User Email is not specified in Case"))
-
+
if destination and case.section_id.user_id:
case_email = case.section_id.user_id.user_email
else:
@@ -487,18 +487,18 @@ class crm_case(object):
attach_to_send = map(lambda x: (x['datas_fname'], base64.decodestring(x['datas'])), attach_to_send)
# Send an email
- subject = "Reminder: [%s] %s" % (str(case.id), case.name, )
- email_message_obj.email_send(cr, uid,
- src,
- [dest],
- subject,
- body,
- model='crm.case',
- reply_to=case.section_id.reply_to,
- openobject_id=str(case.id),
- attach=attach_to_send
- )
- self._history(cr, uid, [case], _('Send'), history=True, subject=subject, email=dest, details=body, email_from=src)
+ subject = "Reminder: [%s] %s" % (str(case.id), case.name, )
+ email_message_obj.schedule_with_attach(cr, uid,
+ src,
+ [dest],
+ subject,
+ body,
+ model='crm.case',
+ reply_to=case.section_id.reply_to,
+ openobject_id=str(case.id),
+ attach=attach_to_send
+ )
+ self._history(cr, uid, [case], _('Send'), history=True, subject=subject, email=dest, details=body, email_from=src)
return True
def _check(self, cr, uid, ids=False, context=None):
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 e229ef83730..31a61f86f47 100644
--- a/addons/crm/crm_lead.py
+++ b/addons/crm/crm_lead.py
@@ -40,7 +40,7 @@ class crm_lead(crm_case, osv.osv):
_name = "crm.lead"
_description = "Lead/Opportunity"
_order = "date_action, priority, id desc"
- _inherit = ['mailgate.thread','res.partner.address']
+ _inherit = ['email.thread','res.partner.address']
def _compute_day(self, cr, uid, ids, fields, args, context=None):
"""
@param cr: the current row, from the database cursor,
@@ -326,7 +326,7 @@ class crm_lead(crm_case, osv.osv):
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks
"""
- mailgate_pool = self.pool.get('email.server.tools')
+ thread_pool = self.pool.get('email.thread')
subject = msg.get('subject')
body = msg.get('body')
@@ -343,7 +343,7 @@ class crm_lead(crm_case, osv.osv):
if msg.get('priority', False):
vals['priority'] = priority
- res = mailgate_pool.get_partner(cr, uid, msg.get('from') or msg.get_unixfrom())
+ res = thread_pool.get_partner(cr, uid, msg.get('from') or msg.get_unixfrom())
if res:
vals.update(res)
@@ -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/crm_lead_view.xml b/addons/crm/crm_lead_view.xml
index 0313595193a..1ff6a4d75a0 100644
--- a/addons/crm/crm_lead_view.xml
+++ b/addons/crm/crm_lead_view.xml
@@ -199,13 +199,13 @@
-
+
-
+
-
+
-
+
@@ -55,12 +55,12 @@
-
+
@@ -73,14 +73,13 @@
email.message
tree
-
+
-
+
-
@@ -94,16 +93,11 @@
search
-
-
-
-
-
-
+
@@ -150,82 +144,8 @@
parent="menu_email_message_tools"
action="action_view_mail_message" />
-
- email.smtp_server.form
- email.smtp_server
- form
-
-
-
-
-
-
- email.smtp_server.tree
- email.smtp_server
- tree
-
-
-
-
-
-
-
-
-
-
-
-
- email_smtp.server.search
- email.smtp_server
- search
-
-
-
-
-
-
-
-
-
- Outgoing Servers
- email.smtp_server
- form
- form,tree
-
- {'group_by': [], 'search_default_draft': 1, 'search_default_my': 1}
-
-
-
-
diff --git a/addons/email/scripts/openerp_mailgate/openerp_mailgate.py b/addons/email/scripts/openerp_mailgate/openerp_mailgate.py
index 204cb2d5d03..68e9a0849db 100644
--- a/addons/email/scripts/openerp_mailgate/openerp_mailgate.py
+++ b/addons/email/scripts/openerp_mailgate/openerp_mailgate.py
@@ -54,7 +54,7 @@ class email_parser(object):
try:
# pass message as bytes because we don't know its encoding until we parse its headers
# and hence can't convert it to utf-8 for transport
- res_id = self.rpc('email.server.tools', 'process_email', self.model, xmlrpclib.Binary(message), custom_values)
+ res_id = self.rpc('email.thread', 'process_email', self.model, xmlrpclib.Binary(message), custom_values)
except Exception:
logger = logging.getLogger('mail-gateway')
logger.warning('Failed to process incoming email. Source of the failed mail is available at debug level.', exc_info=True)
diff --git a/addons/email/security/ir.model.access.csv b/addons/email/security/ir.model.access.csv
index bc1df5fbb54..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_mailgate_thread",,1,0,0,0
\ No newline at end of file
+"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 b198378ea8b..b9e11160510 100644
--- a/addons/email/wizard/email_compose_message.py
+++ b/addons/email/wizard/email_compose_message.py
@@ -25,7 +25,7 @@ import tools
class email_compose_message(osv.osv_memory):
_name = 'email.compose.message'
- _inherit = 'email.message.template'
+ _inherit = 'email.message.common'
_description = 'This is the wizard for Compose E-mail'
def default_get(self, cr, uid, fields, context=None):
@@ -43,8 +43,8 @@ class email_compose_message(osv.osv_memory):
if not vals:
return result
- if 'name' in fields:
- result.update({'name' : vals.get('name','')})
+ if 'subject' in fields:
+ result.update({'subject' : vals.get('name','')})
if 'email_to' in fields:
result.update({'email_to' : vals.get('email_to','')})
@@ -52,8 +52,8 @@ class email_compose_message(osv.osv_memory):
if 'email_from' in fields:
result.update({'email_from' : vals.get('email_from','')})
- if 'description' in fields:
- result.update({'description' : vals.get('description','')})
+ if 'body' in fields:
+ result.update({'body' : vals.get('description','')})
if 'model' in fields:
result.update({'model' : vals.get('model','')})
@@ -135,11 +135,11 @@ class email_compose_message(osv.osv_memory):
message_pool = self.pool.get('email.message')
if message_id:
message_data = message_pool.browse(cr, uid, message_id, context)
- subject = tools.ustr(message_data and message_data.name or '')
+ subject = tools.ustr(message_data and message_data.subject or '')
if context.get('mail','') == 'reply':
subject = "Re :- " + subject
- description = message_data and message_data.description and message_data.description or ''
+ description = message_data and message_data.body or ''
message_body = False
if context.get('mail','') == 'reply':
header = '-------- Original Message --------'
@@ -150,8 +150,8 @@ class email_compose_message(osv.osv_memory):
description = '\n'.join([header, sender, email_to, sentdate, desc])
result.update({
- 'description' : description,
- 'name' : subject,
+ 'body' : description,
+ 'subject' : subject,
'message_id' : message_data and message_data.message_id or False,
'attachment_ids' : message_data and message_pool.read(cr, uid, message_id, ['attachment_ids'])['attachment_ids'] or [],
'res_id' : message_data and message_data.res_id or False,
@@ -183,25 +183,20 @@ class email_compose_message(osv.osv_memory):
result.update({
'email_from': vals.get('email_from',''),
'email_to': vals.get('email_to',''),
- 'name': vals.get('name',''),
- 'description': vals.get('description',''),
+ 'subject': vals.get('name',''),
+ 'body': vals.get('description',''),
'email_cc': vals.get('email_cc',''),
'email_bcc': vals.get('email_bcc',''),
'reply_to': vals.get('reply_to',''),
})
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:
- email_smtp_server_pool = self.pool.get("email.smtp_server")
- email_from = email_smtp_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.subject, mail.body,
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..eab36ebc522 100644
--- a/addons/email/wizard/email_compose_message_view.xml
+++ b/addons/email/wizard/email_compose_message_view.xml
@@ -12,19 +12,18 @@
-
+
-
+
-
+
diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py
index 35125782aab..10df9798b0b 100644
--- a/addons/email_template/email_template.py
+++ b/addons/email_template/email_template.py
@@ -33,7 +33,7 @@ import pooler
class email_template(osv.osv):
"Templates for sending Email"
- _inherit = 'email.message.template'
+ _inherit = 'email.message.common'
_name = "email.template"
_description = 'Email Templates for Models'
@@ -124,13 +124,6 @@ This is useful for CRM leads for example"),
'Wizard Button',
help="Button in the side bar of the form view of this Resource that will invoke the Window Action",
readonly=True),
- 'allowed_groups':fields.many2many(
- 'res.groups',
- 'template_group_rel',
- 'templ_id', 'group_id',
- string="Allowed User Groups",
- help="Only users from these groups will be"
- " allowed to send mails from this Template"),
'model_object_field':fields.many2one(
'ir.model.fields',
string="Field",
@@ -138,37 +131,36 @@ This is useful for CRM leads for example"),
"\nIf it is a relationship field you will be able to "
"choose the nested values in the box below\n(Note:If "
"there are no values make sure you have selected the"
- " correct model)",
- store=False),
+ " correct model)"),
'sub_object':fields.many2one(
'ir.model',
'Sub-model',
help='When a relation field is used this field'
- ' will show you the type of field you have selected',
- store=False),
+ ' will show you the type of field you have selected'),
'sub_model_object_field':fields.many2one(
'ir.model.fields',
'Sub Field',
help="When you choose relationship fields "
- "this field will specify the sub value you can use.",
- store=False),
+ "this field will specify the sub value you can use."),
'null_value':fields.char(
'Null Value',
help="This Value is used if the field is empty",
- size=50, store=False),
+ size=50),
'copyvalue':fields.char(
'Expression',
size=100,
help="Copy and paste the value in the "
- "location you want to use a system value.",
- store=False),
- 'table_html':fields.text(
- 'HTML code',
- help="Copy this html code to your HTML message"
- " body for displaying the info in your mail.",
- store=False),
+ "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 = [
@@ -220,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)
@@ -360,14 +348,14 @@ 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
"""
if context is None:
context = {}
- smtp_pool = self.pool.get('email.smtp_server')
+ smtp_pool = self.pool.get('ir.mail_server')
email_message_pool = self.pool.get('email.message')
report_xml_pool = self.pool.get('ir.actions.report.xml')
template = self.get_email_template(cr, uid, template_id, record_id, context)
@@ -375,7 +363,7 @@ This is useful for CRM leads for example"),
if not smtp_server_id and template.smtp_server_id:
smtp_server_id = template.smtp_server_id.id
else:
- smtp_ids = smtp_pool.search(cr, uid, [('default','=',True)])
+ smtp_ids = smtp_pool.search(cr, uid, [])
smtp_server_id = smtp_ids and smtp_ids[0]
smtp_server = smtp_pool.browse(cr, uid, smtp_server_id, context=context)
# determine name of sender, either it is specified in email_id
@@ -394,8 +382,9 @@ 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),
+ 'auto_delete': self.get_template_value(cr, uid, template.auto_delete, model, record_id, context),
#'body_html': self.get_template_value(cr, uid, template.body_html, model, record_id, context),
}
@@ -405,7 +394,7 @@ This is useful for CRM leads for example"),
elif template['track_campaign_item']:
# get appropriate message-id
- values.update({'message_id': tools.misc.generate_tracking_message_id(record_id)})
+ values.update({'message_id': smtp_pool.generate_tracking_message_id(record_id)})
#Use signatures if allowed
if template.user_signature:
@@ -444,53 +433,14 @@ 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'),
- 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_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, auto_delete=values.get('auto_delete'), 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()
-class email_message(osv.osv):
- _inherit = 'email.message'
- _columns = {
- 'template_id': fields.many2one('email.template', 'Email-Template', readonly=True),
- }
-
- def process_email_queue(self, cr, uid, ids=None, context=None):
- result = super(email_message, self).process_email_queue(cr, uid, ids, context)
- attachment_obj = self.pool.get('ir.attachment')
- for message in self.browse(cr, uid, result, context):
- if message.template_id and message.template_id.auto_delete:
- self.unlink(cr, uid, [id], context=context)
- attachment_ids = [x.id for x in message.attachments_ids]
- attachment_obj.unlink(cr, uid, attachment_ids, context=context)
- return result
-
- 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):
- if context is None:
- context = {}
- notemplate = context.get('notemplate', True)
- if (not notemplate) and model and openobject_id:
- template_pool = self.pool.get('email.template')
- template_ids = template_pool.search(cr, uid, [('model','=',model)])
- if template_ids and len(template_ids):
- template_id = template_ids[0]
- return template_pool.generate_email(cr, uid, template_id, openobject_id, context=context)
-
- return super(email_message, self).email_send(cr, uid, email_from, email_to, subject, body, model=model, email_cc=email_cc, email_bcc=email_bcc, reply_to=reply_to, attach=attach,
- message_id=message_id, references=references, openobject_id=openobject_id, debug=debug, subtype=subtype, x_headers=x_headers, priority=priority, smtp_server_id=smtp_server_id, context=context)
-
-email_message()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
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_compose_message.py b/addons/email_template/wizard/email_compose_message.py
index 19b4e3c7155..77ec0aed5d3 100644
--- a/addons/email_template/wizard/email_compose_message.py
+++ b/addons/email_template/wizard/email_compose_message.py
@@ -44,8 +44,8 @@ class email_compose_message(osv.osv_memory):
result.update({
'template_id' : template.id,
'smtp_server_id' : template.smtp_server_id.id,
- 'description' : _get_template_value('description') or False,
- 'name' : _get_template_value('subject') or False,
+ 'body' : _get_template_value('body') or False,
+ 'subject' : _get_template_value('subject') or False,
'attachment_ids' : template_pool.read(cr, uid, template.id, ['attachment_ids'])['attachment_ids'] or [],
'res_id' : res_id or False,
'email_to' : _get_template_value('email_to') or False,
@@ -92,11 +92,11 @@ class email_compose_message(osv.osv_memory):
if 'email_bcc' in fields:
result.update({'email_bcc' : vals.get('email_bcc', False)})
- if 'name' in fields:
- result.update({'name' : vals.get('name', False)})
+ if 'subject' in fields:
+ result.update({'subject' : vals.get('name', False)})
- if 'description' in fields:
- result.update({'description' : vals.get('description', False)})
+ if 'body' in fields:
+ result.update({'body' : vals.get('description', False)})
if 'reply_to' in fields:
result.update({'reply_to' : vals.get('reply_to', False)})
diff --git a/addons/email_template/wizard/email_template_preview.py b/addons/email_template/wizard/email_template_preview.py
index 175722a2ea2..f1636a64de8 100644
--- a/addons/email_template/wizard/email_template_preview.py
+++ b/addons/email_template/wizard/email_template_preview.py
@@ -93,13 +93,14 @@ class email_template_preview(osv.osv_memory):
if template.message_id:
vals['message_id'] = self.get_template_value(cr, uid, message_id, model, res_id, context)
elif template.track_campaign_item:
- vals['message_id'] = tools.misc.generate_tracking_message_id(res_id)
+ smtp_server_obj = self.pool.get('ir.mail_server')
+ vals['message_id'] = smtp_server_obj.generate_tracking_message_id(res_id)
vals['subject'] = self.get_template_value(cr, uid, template.subject, model, res_id, context)
- description = self.get_template_value(cr, uid, template.description, model, res_id, context) or ''
+ description = self.get_template_value(cr, uid, template.body, model, res_id, context) or ''
if template.user_signature:
signature = self.pool.get('res.users').browse(cr, uid, uid, context).signature
description += '\n' + signature
- vals['description'] = description
+ vals['body'] = description
vals['report_name'] = self.get_template_value(cr, uid, template.report_name, model, res_id, context)
return {'value':vals}
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..30ab10b9e82 100644
--- a/addons/email_template/wizard/email_template_send_wizard.py
+++ b/addons/email_template/wizard/email_template_send_wizard.py
@@ -91,8 +91,8 @@ class email_template_send_wizard(osv.osv_memory):
if 'subject' in fields:
result['subject'] = _get_template_value('subject')
- if 'description' in fields:
- result['description'] = _get_template_value('description')
+ if 'body' in fields:
+ result['body'] = _get_template_value('description')
#if 'body_html' in fields:
# result['body_html'] = _get_template_value('body_html')
@@ -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 7d757156fa4..5e757d02903 100644
--- a/addons/event/event.py
+++ b/addons/event/event.py
@@ -282,7 +282,7 @@ class event_registration(osv.osv):
"""Event Registration"""
_name= 'event.registration'
_description = __doc__
- _inherit = 'mailgate.thread'
+ _inherit = 'email.thread'
def _amount_line(self, cr, uid, ids, field_name, arg, context=None):
cur_obj = self.pool.get('res.currency')
@@ -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/fetchmail/fetchmail.py b/addons/fetchmail/fetchmail.py
index 4b2b44a5414..7e514141fea 100644
--- a/addons/fetchmail/fetchmail.py
+++ b/addons/fetchmail/fetchmail.py
@@ -161,7 +161,7 @@ class email_server(osv.osv):
def fetch_mail(self, cr, uid, ids, context=None):
if context is None:
context = {}
- email_tool = self.pool.get('email.server.tools')
+ thread_pool = self.pool.get('email.thread')
action_pool = self.pool.get('ir.actions.server')
context.update({'get_server': True})
for server in self.browse(cr, uid, ids, context=context):
@@ -174,7 +174,7 @@ class email_server(osv.osv):
result, data = imap_server.search(None, '(UNSEEN)')
for num in data[0].split():
result, data = imap_server.fetch(num, '(RFC822)')
- res_id = email_tool.process_email(cr, user, server.object_id.model, data[0][1], attach=server.attach, context=context)
+ res_id = thread_pool.process_email(cr, user, server.object_id.model, data[0][1], attach=server.attach, context=context)
if res_id and server.action_id:
action_pool.run(cr, user, [server.action_id.id], {'active_id': res_id, 'active_ids':[res_id]})
@@ -196,7 +196,7 @@ class email_server(osv.osv):
for num in range(1, numMsgs + 1):
(header, msges, octets) = pop_server.retr(num)
msg = '\n'.join(msges)
- res_id = email_tool.process_email(cr, user, server.object_id.model, msg, attach=server.attach, context=context)
+ res_id = thread_pool.process_email(cr, user, server.object_id.model, msg, attach=server.attach, context=context)
if res_id and server.action_id:
action_pool.run(cr, user, [server.action_id.id], {'active_id': res_id, 'active_ids':[res_id]})
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 cdf34b50a59..7d210f8b685 100644
--- a/addons/hr_recruitment/hr_recruitment.py
+++ b/addons/hr_recruitment/hr_recruitment.py
@@ -82,7 +82,7 @@ class hr_applicant(crm.crm_case, osv.osv):
_name = "hr.applicant"
_description = "Applicant"
_order = "id desc"
- _inherit = ['mailgate.thread']
+ _inherit = ['email.thread']
def _compute_day(self, cr, uid, ids, fields, args, context=None):
"""
@@ -308,7 +308,7 @@ class hr_applicant(crm.crm_case, osv.osv):
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks
"""
- mailgate_pool = self.pool.get('email.server.tools')
+ thread_pool = self.pool.get('email.thread')
attach_obj = self.pool.get('ir.attachment')
subject = msg.get('subject')
@@ -326,7 +326,7 @@ class hr_applicant(crm.crm_case, osv.osv):
if msg.get('priority', False):
vals['priority'] = priority
- res = mailgate_pool.get_partner(cr, uid, msg.get('from'))
+ res = thread_pool.get_partner(cr, uid, msg.get('from'))
if res:
vals.update(res)
res = self.create(cr, uid, vals, context=context)
@@ -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/outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py b/addons/outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py
index 4892006516d..28244e84fe2 100644
--- a/addons/outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py
+++ b/addons/outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py
@@ -208,7 +208,7 @@ class XMLRpcConn(object):
if attachments:
result = self.MakeAttachment([rec], mail)
attachment_ids = result.get(model, {}).get(res_id, [])
- execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.server.tools','history',model, res_id, msg, attachment_ids)
+ execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.thread','history',model, res_id, msg, attachment_ids)
new_msg += """- {0} : {1}\n""".format(object_name,str(rec[2]))
flag = True
@@ -298,7 +298,7 @@ class XMLRpcConn(object):
endCut = message_id.find(">")
message_id = message_id[startCut:endCut+1]
email.replace_header('Message-Id',message_id)
- id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.server.tools','process_email',section, str(email))
+ id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.thread','process_email',section, str(email))
if id > 0:
flag = True
return flag
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 1c8bc327d6d..3349334041f 100644
--- a/addons/project_issue/project_issue.py
+++ b/addons/project_issue/project_issue.py
@@ -46,7 +46,7 @@ class project_issue(crm.crm_case, osv.osv):
_name = "project.issue"
_description = "Project Issue"
_order = "priority, id desc"
- _inherit = ['mailgate.thread']
+ _inherit = ['email.thread']
def case_open(self, cr, uid, ids, *args):
"""
@@ -374,7 +374,7 @@ class project_issue(crm.crm_case, osv.osv):
"""
if context is None:
context = {}
- mailgate_pool = self.pool.get('email.server.tools')
+ thread_pool = self.pool.get('email.thread')
subject = msg.get('subject') or _('No Title')
body = msg.get('body')
@@ -391,7 +391,7 @@ class project_issue(crm.crm_case, osv.osv):
if msg.get('priority', False):
vals['priority'] = priority
- res = mailgate_pool.get_partner(cr, uid, msg.get('from'))
+ res = thread_pool.get_partner(cr, uid, msg.get('from'))
if res:
vals.update(res)
context.update({'state_to' : 'draft'})
@@ -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_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml
index 492a1ca9064..93df5636a87 100644
--- a/addons/project_issue/project_issue_view.xml
+++ b/addons/project_issue/project_issue_view.xml
@@ -113,13 +113,13 @@
-
+
-
+