[IMP] email: email cleanup
bzr revid: rha@tinyerp.com-20110318134419-78qmipdipsryqgnz
This commit is contained in:
parent
7fb869688c
commit
455fb2d6b3
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class crm_meeting(crm_case, osv.osv):
|
|||
_name = 'crm.meeting'
|
||||
_description = "Meeting"
|
||||
_order = "id desc"
|
||||
_inherit = ['mailgate.thread',"calendar.event"]
|
||||
_inherit = ['email.thread',"calendar.event"]
|
||||
_columns = {
|
||||
# From crm.case
|
||||
'name': fields.char('Summary', size=124, required=True, states={'done': [('readonly', True)]}),
|
||||
|
|
|
@ -32,7 +32,7 @@ class crm_phonecall(crm_case, osv.osv):
|
|||
_name = "crm.phonecall"
|
||||
_description = "Phonecall"
|
||||
_order = "id desc"
|
||||
_inherit = ['mailgate.thread']
|
||||
_inherit = ['email.thread']
|
||||
_columns = {
|
||||
# From crm.case
|
||||
'id': fields.integer('ID'),
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
"access_res_partner_address_manager","res.partner.address.crm.user.manager","base.model_res_partner_address","base.group_sale_manager",1,0,0,0
|
||||
"access_res_partner_category_manager","res.partner.category.crm.manager","base.model_res_partner_category","base.group_sale_manager",1,0,0,0
|
||||
"email_email_message_manager","email.email.message.manager","email.model_email_message","base.group_sale_manager",1,0,0,0
|
||||
"email_thread_manager","email.mailgate.thread.manager","email.model_mailgate_thread","base.group_sale_manager",1,1,1,1
|
||||
"email_thread_manager","email.mailgate.thread.manager","email.model_email_thread","base.group_sale_manager",1,1,1,1
|
||||
"access_calendar_attendee_crm_user","calendar.attendee.crm.user","model_calendar_attendee","base.group_sale_salesman",1,1,1,0
|
||||
"access_calendar_attendee_crm_manager","calendar.attendee.crm.manager","model_calendar_attendee","base.group_sale_manager",1,1,1,1
|
||||
"access_res_partner","res.partner.crm.user","base.model_res_partner","base.group_sale_salesman",1,1,1,0
|
||||
"access_res_partner_address","res.partner.address.crm.user","base.model_res_partner_address","base.group_sale_salesman",1,1,1,0
|
||||
"access_res_partner_category","res.partner.category.crm.user","base.model_res_partner_category","base.group_sale_salesman",1,1,1,0
|
||||
"email_mailgate_thread","email.mailgate.thread","email.model_mailgate_thread","base.group_sale_salesman",1,1,1,1
|
||||
"email_mailgate_thread","email.mailgate.thread","email.model_email_thread","base.group_sale_salesman",1,1,1,1
|
||||
"email_gateway_email_message_user","email.email.message.user","email.model_email_message","base.group_sale_salesman",1,1,1,1
|
||||
"access_crm_case_categ_manager","crm.case.categ manager","model_crm_case_categ","base.group_sale_manager",1,1,1,1
|
||||
"access_base_action_rule_manager","base.action.rule manager","model_base_action_rule","base.group_sale_manager",1,1,1,1
|
||||
|
|
|
|
@ -40,7 +40,7 @@ class crm_claim(crm.crm_case, osv.osv):
|
|||
_name = "crm.claim"
|
||||
_description = "Claim"
|
||||
_order = "priority,date desc"
|
||||
_inherit = ['mailgate.thread']
|
||||
_inherit = ['email.thread']
|
||||
_columns = {
|
||||
'id': fields.integer('ID', readonly=True),
|
||||
'name': fields.char('Claim Subject', size=128, required=True),
|
||||
|
@ -156,7 +156,7 @@ class crm_claim(crm.crm_case, osv.osv):
|
|||
self.write(cr, uid, [ids[i]], {'stage_id' : stage_id})
|
||||
|
||||
return res
|
||||
|
||||
|
||||
def message_new(self, cr, uid, msg, context=None):
|
||||
"""
|
||||
Automatically calls when new email message arrives
|
||||
|
@ -165,7 +165,7 @@ class crm_claim(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')
|
||||
|
||||
subject = msg.get('subject')
|
||||
body = msg.get('body')
|
||||
|
@ -182,7 +182,7 @@ class crm_claim(crm.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)
|
||||
|
||||
|
@ -206,7 +206,7 @@ class crm_claim(crm.crm_case, osv.osv):
|
|||
@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 update mail’s IDs
|
||||
@param ids: List of update mail’s IDs
|
||||
"""
|
||||
if isinstance(ids, (str, int, long)):
|
||||
ids = [ids]
|
||||
|
|
|
@ -31,7 +31,7 @@ class crm_fundraising(crm.crm_case, osv.osv):
|
|||
_name = "crm.fundraising"
|
||||
_description = "Fund Raising"
|
||||
_order = "id desc"
|
||||
_inherit = ['mailgate.thread']
|
||||
_inherit = ['email.thread']
|
||||
_columns = {
|
||||
'id': fields.integer('ID'),
|
||||
'name': fields.char('Name', size=128, required=True),
|
||||
|
|
|
@ -39,7 +39,7 @@ class crm_helpdesk(crm.crm_case, osv.osv):
|
|||
_name = "crm.helpdesk"
|
||||
_description = "Helpdesk"
|
||||
_order = "id desc"
|
||||
_inherit = ['mailgate.thread']
|
||||
_inherit = ['email.thread']
|
||||
_columns = {
|
||||
'id': fields.integer('ID', readonly=True),
|
||||
'name': fields.char('Name', size=128, required=True),
|
||||
|
@ -104,7 +104,7 @@ class crm_helpdesk(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')
|
||||
|
||||
subject = msg.get('subject')
|
||||
body = msg.get('body')
|
||||
|
@ -121,7 +121,7 @@ class crm_helpdesk(crm.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)
|
||||
|
||||
|
@ -145,7 +145,7 @@ class crm_helpdesk(crm.crm_case, osv.osv):
|
|||
@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 update mail’s IDs
|
||||
@param ids: List of update mail’s IDs
|
||||
"""
|
||||
if isinstance(ids, (str, int, long)):
|
||||
ids = [ids]
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
import email_smtp_server
|
||||
import email_message
|
||||
import email_gateway
|
||||
import email_thread
|
||||
import res_partner
|
||||
import wizard
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
'update_xml': [
|
||||
"wizard/email_compose_message_view.xml",
|
||||
"email_view.xml",
|
||||
"email_gateway_view.xml",
|
||||
"email_thread_view.xml",
|
||||
"res_partner_view.xml",
|
||||
'security/ir.model.access.csv',
|
||||
'email_data.xml',
|
||||
|
|
|
@ -19,7 +19,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="'run_mail_scheduler'" name="function"/>-->
|
||||
<field eval="'()'" name="args"/>
|
||||
</record>
|
||||
</data>
|
||||
|
|
|
@ -63,10 +63,10 @@ def format_date_tz(date, tz=None):
|
|||
format = tools.DEFAULT_SERVER_DATETIME_FORMAT
|
||||
return tools.server_to_local_timestamp(date, format, format, tz)
|
||||
|
||||
class email_message_template(osv.osv_memory):
|
||||
_name = 'email.message.template'
|
||||
class email_message_common(osv.osv_memory):
|
||||
_name = 'email.message.common'
|
||||
_columns = {
|
||||
'name':fields.text('Subject', translate=True),
|
||||
'subject':fields.text('Subject', translate=True),
|
||||
'model': fields.char('Object Name', size=128, select=1),
|
||||
'res_id': fields.integer('Resource ID', select=1),
|
||||
'date': fields.datetime('Date'),
|
||||
|
@ -79,20 +79,22 @@ class email_message_template(osv.osv_memory):
|
|||
'references': fields.text('References', help="References emails."),
|
||||
'reply_to':fields.char('Reply-To', size=250),
|
||||
'sub_type': fields.char('Sub Type', size=32),
|
||||
'headers': fields.char('x_headers',size=256),
|
||||
'headers': fields.text('x_headers'),
|
||||
'priority':fields.integer('Priority'),
|
||||
'description': fields.text('Description', translate=True),
|
||||
'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'),
|
||||
}
|
||||
_rec_name='subject'
|
||||
|
||||
_sql_constraints = []
|
||||
email_message_template()
|
||||
email_message_common()
|
||||
|
||||
class email_message(osv.osv):
|
||||
'''
|
||||
Email Message
|
||||
'''
|
||||
_inherit = 'email.message.template'
|
||||
_inherit = 'email.message.common'
|
||||
_name = 'email.message'
|
||||
_description = 'Email Message'
|
||||
_order = 'date desc'
|
||||
|
@ -170,7 +172,6 @@ class email_message(osv.osv):
|
|||
return result
|
||||
|
||||
_columns = {
|
||||
'message': fields.text('Description'),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner'),
|
||||
'attachment_ids': fields.many2many('ir.attachment', 'message_attachment_rel', 'message_id', 'attachment_id', 'Attachments'),
|
||||
'display_text': fields.function(_get_display_text, method=True, type='text', size="512", string='Display Text'),
|
||||
|
@ -184,12 +185,12 @@ class email_message(osv.osv):
|
|||
('sent', 'Sent Items'),
|
||||
], 'Folder'),
|
||||
'state':fields.selection([
|
||||
('draft', 'Draft'),
|
||||
('sending', 'Sending'),
|
||||
('waiting', 'Waiting'),
|
||||
('outgoing', 'Outgoing'),
|
||||
('sent', 'Sent'),
|
||||
('received', 'Received'),
|
||||
('exception', 'Exception'),
|
||||
], 'State', readonly=True),
|
||||
'auto_delete': fields.boolean('Auto Delete', help="Permanently delete emails after sending"),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
@ -197,21 +198,21 @@ class email_message(osv.osv):
|
|||
'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 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
|
||||
|
@ -221,22 +222,22 @@ 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 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 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):
|
||||
|
@ -325,7 +326,7 @@ class email_message(osv.osv):
|
|||
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.smtpserver or None,
|
||||
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,
|
||||
|
|
|
@ -106,7 +106,7 @@ unless it is already specified in the From Email, e.g: John Doe <john@doe.com>",
|
|||
help="Specify the username if your SMTP server requires authentication, "
|
||||
"otherwise leave it empty."),
|
||||
'smtppass': fields.char('Password',
|
||||
size=120,
|
||||
size=120,
|
||||
required=False),
|
||||
'smtptls':fields.boolean('TLS'),
|
||||
'smtpssl':fields.boolean('SSL/TLS'),
|
||||
|
@ -133,7 +133,7 @@ unless it is already specified in the From Email, e.g: John Doe <john@doe.com>",
|
|||
default_ids = self.search(cr, uid, [('default','=',True)])
|
||||
if len(default_ids) > 1:
|
||||
return False
|
||||
|
||||
|
||||
return True
|
||||
|
||||
_constraints = [
|
||||
|
@ -145,7 +145,7 @@ unless it is already specified in the From Email, e.g: John Doe <john@doe.com>",
|
|||
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):
|
||||
"""
|
||||
|
@ -153,7 +153,7 @@ unless it is already specified in the From Email, e.g: John Doe <john@doe.com>",
|
|||
"""
|
||||
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,
|
||||
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()
|
||||
|
|
|
@ -34,12 +34,12 @@ import xmlrpclib
|
|||
|
||||
_logger = logging.getLogger('mailgate')
|
||||
|
||||
class mailgate_thread(osv.osv):
|
||||
class email_thread(osv.osv):
|
||||
'''
|
||||
Mailgateway Thread
|
||||
Email Thread
|
||||
'''
|
||||
_name = 'mailgate.thread'
|
||||
_description = 'Mailgateway Thread'
|
||||
_name = 'email.thread'
|
||||
_description = 'Email Thread'
|
||||
|
||||
_columns = {
|
||||
'message_ids': fields.one2many('email.message', 'res_id', 'Messages', readonly=True),
|
||||
|
@ -71,7 +71,7 @@ class mailgate_thread(osv.osv):
|
|||
def message_update(self, cr, uid, ids, vals={}, msg="", default_act='pending', context=None):
|
||||
raise Exception, _('Method is not implemented')
|
||||
|
||||
def message_followers(self, cr, uid, ids, context=None):
|
||||
def thread_followers(self, cr, uid, ids, context=None):
|
||||
""" Get a list of emails of the people following this thread
|
||||
"""
|
||||
res = {}
|
||||
|
@ -172,18 +172,6 @@ class mailgate_thread(osv.osv):
|
|||
}
|
||||
obj.create(cr, uid, data, context=context)
|
||||
return True
|
||||
mailgate_thread()
|
||||
|
||||
def format_date_tz(date, tz=None):
|
||||
if not date:
|
||||
return 'n/a'
|
||||
format = tools.DEFAULT_SERVER_DATETIME_FORMAT
|
||||
return tools.server_to_local_timestamp(date, format, format, tz)
|
||||
|
||||
class mailgate_tool(osv.osv_memory):
|
||||
|
||||
_name = 'email.server.tools'
|
||||
_description = "Email Server Tools"
|
||||
|
||||
def _decode_header(self, text):
|
||||
"""Returns unicode() string conversion of the the given encoded smtp header"""
|
||||
|
@ -194,45 +182,6 @@ class mailgate_tool(osv.osv_memory):
|
|||
def to_email(self,text):
|
||||
return re.findall(r'([^ ,<@]+@[^> ,]+)',text)
|
||||
|
||||
def history(self, cr, uid, model, res_ids, msg, attach, context=None):
|
||||
"""This function creates history for mails fetched
|
||||
@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 model: OpenObject Model
|
||||
@param res_ids: Ids of the record of OpenObject model created
|
||||
@param msg: Email details
|
||||
@param attach: Email attachments
|
||||
"""
|
||||
if isinstance(res_ids, (int, long)):
|
||||
res_ids = [res_ids]
|
||||
|
||||
msg_pool = self.pool.get('email.message')
|
||||
for res_id in res_ids:
|
||||
case = self.pool.get(model).browse(cr, uid, res_id, context=context)
|
||||
partner_id = hasattr(case, 'partner_id') and (case.partner_id and case.partner_id.id or False) or False
|
||||
if not partner_id and model == 'res.partner':
|
||||
partner_id = res_id
|
||||
msg_data = {
|
||||
'name': msg.get('subject', 'No subject'),
|
||||
'date': msg.get('date'),
|
||||
'description': msg.get('body', msg.get('from')),
|
||||
'history': True,
|
||||
'partner_id': partner_id,
|
||||
'model': model,
|
||||
'email_cc': msg.get('cc'),
|
||||
'email_from': msg.get('from'),
|
||||
'email_to': msg.get('to'),
|
||||
'message_id': msg.get('message-id'),
|
||||
'references': msg.get('references') or msg.get('in-reply-to'),
|
||||
'res_id': res_id,
|
||||
'user_id': uid,
|
||||
'folder': 'inbox',
|
||||
'attachment_ids': [(6, 0, attach)]
|
||||
}
|
||||
msg_pool.create(cr, uid, msg_data, context=context)
|
||||
return True
|
||||
|
||||
def email_forward(self, cr, uid, model, res_ids, msg, email_error=False, context=None):
|
||||
"""Sends an email to all people following the thread
|
||||
@param res_id: Id of the record of OpenObject model created from the email message
|
||||
|
@ -242,8 +191,8 @@ class mailgate_tool(osv.osv_memory):
|
|||
model_pool = self.pool.get(model)
|
||||
|
||||
for res in model_pool.browse(cr, uid, res_ids, context=context):
|
||||
message_followers = model_pool.message_followers(cr, uid, [res.id])[res.id]
|
||||
message_followers_emails = self.to_email(','.join(filter(None, message_followers)))
|
||||
thread_followers = model_pool.thread_followers(cr, uid, [res.id])[res.id]
|
||||
message_followers_emails = self.to_email(','.join(filter(None, thread_followers)))
|
||||
message_recipients = self.to_email(','.join(filter(None,
|
||||
[self._decode_header(msg['from']),
|
||||
self._decode_header(msg['to']),
|
||||
|
@ -486,6 +435,14 @@ class mailgate_tool(osv.osv_memory):
|
|||
|
||||
return res
|
||||
|
||||
mailgate_tool()
|
||||
|
||||
email_thread()
|
||||
|
||||
def format_date_tz(date, tz=None):
|
||||
if not date:
|
||||
return 'n/a'
|
||||
format = tools.DEFAULT_SERVER_DATETIME_FORMAT
|
||||
return tools.server_to_local_timestamp(date, format, format, tz)
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -3,8 +3,8 @@
|
|||
<data>
|
||||
|
||||
<record model="ir.ui.view" id="view_mailgate_thread_form">
|
||||
<field name="name">mailgate.thread.form</field>
|
||||
<field name="model">mailgate.thread</field>
|
||||
<field name="name">email.thread.form</field>
|
||||
<field name="model">email.thread</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Mailgateway Thread">
|
||||
|
@ -41,8 +41,8 @@
|
|||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_mailgate_thread_tree">
|
||||
<field name="name">mailgate.thread.tree</field>
|
||||
<field name="model">mailgate.thread</field>
|
||||
<field name="name">email.thread.tree</field>
|
||||
<field name="model">email.thread</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Mailgateway Thread">
|
||||
|
@ -54,7 +54,7 @@
|
|||
<!-- Emails action-->
|
||||
<record model="ir.actions.act_window" id="action_view_mailgate_thread">
|
||||
<field name="name">Mailgateway Threads</field>
|
||||
<field name="res_model">mailgate.thread</field>
|
||||
<field name="res_model">email.thread</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_id" ref="view_mailgate_thread_tree"/>
|
|
@ -44,7 +44,7 @@
|
|||
<group col="4" colspan="4" attrs="{'invisible':[('folder','not in',['drafts','outbox'])]}">
|
||||
<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_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>
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
"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
|
||||
"access_mailgate_thread","mailgate.thread","model_email_thread",,1,0,0,0
|
||||
|
|
|
|
@ -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','')})
|
||||
|
@ -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,8 +183,8 @@ 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',''),
|
||||
|
@ -193,8 +193,8 @@ class email_compose_message(osv.osv_memory):
|
|||
|
||||
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
|
||||
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):
|
||||
|
|
|
@ -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,35 +131,26 @@ 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'),
|
||||
}
|
||||
|
@ -460,37 +444,5 @@ This is useful for CRM leads for example"),
|
|||
|
||||
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:
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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]})
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'})
|
||||
|
|
|
@ -25,7 +25,7 @@ import binascii
|
|||
|
||||
class project_tasks(osv.osv):
|
||||
_name = "project.task"
|
||||
_inherit = ['mailgate.thread','project.task']
|
||||
_inherit = ['email.thread','project.task']
|
||||
|
||||
_columns={
|
||||
'message_ids': fields.one2many('email.message', 'res_id', 'Messages', domain=[('model','=',_name)], readonly=True),
|
||||
|
@ -38,7 +38,7 @@ class project_tasks(osv.osv):
|
|||
# @param cr: the current row, from the database cursor,
|
||||
# @param uid: the current user’s ID for security checks
|
||||
# """
|
||||
mailgate_obj = self.pool.get('email.server.tools')
|
||||
thread_obj = self.pool.get('email.thread')
|
||||
subject = msg.get('subject')
|
||||
body = msg.get('body')
|
||||
msg_from = msg.get('from')
|
||||
|
@ -49,7 +49,7 @@ class project_tasks(osv.osv):
|
|||
'description': body,
|
||||
'planned_hours' : 0.0,
|
||||
}
|
||||
res = mailgate_obj.get_partner(cr, uid, msg_from)
|
||||
res = thread_obj.get_partner(cr, uid, msg_from)
|
||||
if res:
|
||||
data.update(res)
|
||||
res = self.create(cr, uid, data)
|
||||
|
@ -69,8 +69,8 @@ class project_tasks(osv.osv):
|
|||
return res
|
||||
|
||||
def message_update(self, cr, uid, id, msg, data={}, default_act='pending'):
|
||||
mailgate_obj = self.pool.get('email.server.tools')
|
||||
msg_actions, body_data = mailgate_obj.msg_act_get(msg)
|
||||
thread_obj = self.pool.get('email.thread')
|
||||
msg_actions, body_data = thread_obj.msg_act_get(msg)
|
||||
data.update({
|
||||
'description': body_data,
|
||||
})
|
||||
|
@ -93,7 +93,7 @@ class project_tasks(osv.osv):
|
|||
getattr(self,act)(cr, uid, [id])
|
||||
return True
|
||||
|
||||
def message_followers(self, cr, uid, ids, context=None):
|
||||
def thread_followers(self, cr, uid, ids, context=None):
|
||||
res = []
|
||||
if isinstance(ids, (str, int, long)):
|
||||
select = [ids]
|
||||
|
@ -110,7 +110,7 @@ class project_tasks(osv.osv):
|
|||
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('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,\
|
||||
|
|
|
@ -24,8 +24,8 @@ import base64
|
|||
import email
|
||||
import tools
|
||||
import binascii
|
||||
class email_server_tools(osv.osv_memory):
|
||||
_inherit = "email.server.tools"
|
||||
class email_thread(osv.osv):
|
||||
_inherit = "email.thread"
|
||||
def history_message(self, cr, uid, model, res_id, message, context=None):
|
||||
#@param message: string of mail which is read from EML File
|
||||
attachment_pool = self.pool.get('ir.attachment')
|
||||
|
@ -127,7 +127,7 @@ class email_server_tools(osv.osv_memory):
|
|||
msg['body'] = body
|
||||
msg['attachments'] = attachments
|
||||
return msg
|
||||
email_server_tools()
|
||||
email_thread()
|
||||
|
||||
class thunderbird_partner(osv.osv_memory):
|
||||
_name = "thunderbird.partner"
|
||||
|
@ -149,8 +149,8 @@ class thunderbird_partner(osv.osv_memory):
|
|||
ref_ids = str(dictcreate.get('ref_ids')).split(';')
|
||||
msg = dictcreate.get('message')
|
||||
mail = msg
|
||||
msg = self.pool.get('email.server.tools').parse_message(msg)
|
||||
server_tools_pool = self.pool.get('email.server.tools')
|
||||
msg = self.pool.get('email.thread').parse_message(msg)
|
||||
thread_pool = self.pool.get('email.thread')
|
||||
message_id = msg.get('message-id', False)
|
||||
msg_pool = self.pool.get('email.message')
|
||||
msg_ids = []
|
||||
|
@ -191,7 +191,7 @@ class thunderbird_partner(osv.osv_memory):
|
|||
res['datas'] = base64.b64encode(mail)
|
||||
res['res_id'] = res_id
|
||||
obj_attch.create(cr, uid, res)
|
||||
server_tools_pool.history_message(cr, uid, model, res_id, msg_new)
|
||||
thread_pool.history_message(cr, uid, model, res_id, msg_new)
|
||||
res_ids.append(res_id)
|
||||
return len(res_ids)
|
||||
|
||||
|
@ -199,7 +199,7 @@ class thunderbird_partner(osv.osv_memory):
|
|||
dictcreate = dict(vals)
|
||||
model = str(dictcreate.get('model'))
|
||||
message = dictcreate.get('message')
|
||||
return self.pool.get('email.server.tools').process_email(cr, uid, model, message, attach=True, context=None)
|
||||
return self.pool.get('email.thread').process_email(cr, uid, model, message, attach=True, context=None)
|
||||
|
||||
def search_message(self, cr, uid, message, context=None):
|
||||
#@param message: string of mail which is read from EML File
|
||||
|
@ -207,7 +207,7 @@ class thunderbird_partner(osv.osv_memory):
|
|||
references = []
|
||||
dictcreate = dict(message)
|
||||
msg = dictcreate.get('message')
|
||||
msg = self.pool.get('email.server.tools').parse_message(msg)
|
||||
msg = self.pool.get('email.thread').parse_message(msg)
|
||||
message_id = msg.get('message-id')
|
||||
refs = msg.get('references',False)
|
||||
references = False
|
||||
|
|
Loading…
Reference in New Issue