diff options
| author | Olivier Dony <odo@openerp.com> | 2011-08-22 19:16:59 +0200 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2011-08-22 19:16:59 +0200 |
| commit | 8f9f45ea948d1ffecb79601e860d522fc6686c2d (patch) | |
| tree | a789d72a67cef289e770323aaf45c158579ecc6c /addons | |
| parent | 50507512cbaf6d0119a29943c9ca85deb4057404 (diff) | |
[IMP] all: next pass of review/renaming for new mail API
bzr revid: odo@openerp.com-20110822171659-zxho36a6n628i10q
Diffstat (limited to 'addons')
49 files changed, 212 insertions, 338 deletions
diff --git a/addons/account/company.py b/addons/account/company.py index c7836e0128b..7a3291f2ce8 100644 --- a/addons/account/company.py +++ b/addons/account/company.py @@ -36,10 +36,12 @@ class res_company(osv.osv): } _defaults = { - 'overdue_msg': 'Please note that the following payments are now due. If your payment \ - has been sent, kindly forward your payment details. If payment will be \ - delayed further, please contact us to discuss. \ - \nWould your payment have been carried out after this mail was sent, please consider the present one as void.' + 'overdue_msg': 'Please note that the following payments are now due. If your payment ' + 'has been carried out, may we ask you to forward us your payment details ' + 'as we seem to have missed it. If the payment needs to be delayed further, ' + 'please contact us to discuss.\n' + 'If your payment has been carried out after this mail was sent, please ' + 'ignore this message.' } res_company() diff --git a/addons/account_followup/account_followup_demo.xml b/addons/account_followup/account_followup_demo.xml index 2bf627de9b7..01b275de306 100644 --- a/addons/account_followup/account_followup_demo.xml +++ b/addons/account_followup/account_followup_demo.xml @@ -17,9 +17,9 @@ <field name="description"> Dear %(partner_name)s, -Exception made if there was a mistake of ours, it seems that the following amount staid unpaid. Please, take appropriate measures in order to carry out this payment in the next 8 days. +Exception made if there was a mistake of ours, it seems that the following amount stays unpaid. Please, take appropriate measures in order to carry out this payment in the next 8 days. -Would your payment have been carried out after this mail was sent, please consider the present one as void. Do not hesitate to contact our accounting department at (+32).10.68.94.39. +Would your payment have been carried out after this mail was sent, please ignore this message. Do not hesitate to contact our accounting department at (+32).10.68.94.39. Best Regards, </field> diff --git a/addons/account_followup/wizard/account_followup_print.py b/addons/account_followup/wizard/account_followup_print.py index 20bf1de8d2d..78f1b8b34c7 100644 --- a/addons/account_followup/wizard/account_followup_print.py +++ b/addons/account_followup/wizard/account_followup_print.py @@ -205,7 +205,7 @@ class account_followup_print_all(osv.osv_memory): move_obj = self.pool.get('account.move.line') user_obj = self.pool.get('res.users') line_obj = self.pool.get('account_followup.stat') - email_message_obj = self.pool.get('email.message') + mail_message = self.pool.get('mail.message') if context is None: context = {} @@ -278,7 +278,7 @@ class account_followup_print_all(osv.osv_memory): msg = '' if dest: try: - email_message_obj.schedule_with_attach(cr, uid, src, dest, sub, body, model='account.followup.print.all') + mail_message.schedule_with_attach(cr, uid, src, dest, sub, body, context=context) 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 f67b8e4bce1..805c35e4462 100644 --- a/addons/base_action_rule/base_action_rule.py +++ b/addons/base_action_rule/base_action_rule.py @@ -299,7 +299,7 @@ the rule to mark CC(mail to any other person defined in actions)."), if context is None: context = {} - email_message_obj = self.pool.get('email.message') + mail_message = self.pool.get('mail.message') body = self.format_mail(obj, body) if not emailfrom: if hasattr(obj, 'user_id') and obj.user_id and obj.user_id.user_email: @@ -311,7 +311,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.schedule_with_attach(cr, uid, emailfrom, emails, name, body, model='base.action.rule', reply_to=reply_to, openobject_id=str(obj.id)) + return mail_message.schedule_with_attach(cr, uid, emailfrom, emails, name, body, model='base.action.rule', reply_to=reply_to, res_id=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 77549a4137a..e020984a647 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -484,7 +484,7 @@ property or property parameter."), context = {} company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.name - email_message_obj = self.pool.get('email.message') + mail_message = self.pool.get('mail.message') for att in self.browse(cr, uid, ids, context=context): sign = att.sent_by_uid and att.sent_by_uid.signature or '' sign = '<br>'.join(sign and sign.split('\n') or []) @@ -511,15 +511,15 @@ 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.schedule_with_attach(cr, uid, + mail_message.schedule_with_attach(cr, uid, email_from, mail_to, sub, body, - model='calendar.attendee', - attach=attach and {'invitation.ics': attach} or None, + attachments=attach and {'invitation.ics': attach} or None, subtype='html', - reply_to=email_from + reply_to=email_from, + context=context ) return True @@ -814,7 +814,7 @@ class calendar_alarm(osv.osv): """ if context is None: context = {} - email_message_obj = self.pool.get('email.message') + mail_message = self.pool.get('mail.message') current_datetime = datetime.now() request_obj = self.pool.get('res.request') alarm_ids = self.search(cr, uid, [('state', '!=', 'done')], context=context) @@ -896,12 +896,12 @@ From: for att in alarm.attendee_ids: mail_to.append(att.user_id.user_email) if mail_to: - email_message_obj.schedule_with_attach(cr, uid, + mail_message.schedule_with_attach(cr, uid, tools.config.get('email_from', False), mail_to, sub, body, - model='calendar.alarm' + context=context ) if next_trigger_date: update_vals.update({'trigger_date': next_trigger_date}) diff --git a/addons/crm/crm.py b/addons/crm/crm.py index 8aabf45409e..8c2d58b15ea 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -210,8 +210,8 @@ class crm_base(object): class crm_case(crm_base): """ A simple python class to be used for common functions - Object that inherit from this class should inherit from mailgate.thread - And need a stage_id field + Objects that inherit from this class should inherit from mail.thread + and need a stage_id field And object that inherit (orm inheritance) from a class the overwrite copy """ @@ -472,8 +472,9 @@ class crm_case(crm_base): body, model='crm.case', reply_to=case.section_id.reply_to, - res_id=str(case.id), - attachments=attach_to_send + res_id=case.id, + attachments=attach_to_send, + context=context ) return True diff --git a/addons/crm/crm_action_rule.py b/addons/crm/crm_action_rule.py index 1840d05dd65..6022d837620 100644 --- a/addons/crm/crm_action_rule.py +++ b/addons/crm/crm_action_rule.py @@ -59,7 +59,7 @@ class base_action_rule(osv.osv): reply_to = emailfrom if not emailfrom: raise osv.except_osv(_('Error!'), _("No E-Mail Found for your Company address!")) - return mail_message.schedule_with_attach(cr, uid, emailfrom, emails, name, body, model='base.action.rule', reply_to=reply_to, res_id=str(obj.id)) + return mail_message.schedule_with_attach(cr, uid, emailfrom, emails, name, body, model='base.action.rule', reply_to=reply_to, res_id=obj.id) def do_check(self, cr, uid, action, obj, context=None): ok = super(base_action_rule, self).do_check(cr, uid, action, obj, context=context) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index aa0791a815e..ab5b81d03ba 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -352,7 +352,7 @@ class crm_lead(crm_case, osv.osv): 'description': body, 'user_id': False, } - if msg.get('priority', False): + if priority: vals['priority'] = priority res = mail_thread.get_partner(cr, uid, msg.get('from', False)) if res: diff --git a/addons/crm/wizard/__init__.py b/addons/crm/wizard/__init__.py index 559214b6b60..3ebdceda437 100644 --- a/addons/crm/wizard/__init__.py +++ b/addons/crm/wizard/__init__.py @@ -19,8 +19,7 @@ # ############################################################################## -#import crm_send_email -import email_compose_message +import mail_compose_message import crm_add_note import crm_lead_to_partner diff --git a/addons/crm/wizard/crm_merge_opportunities.py b/addons/crm/wizard/crm_merge_opportunities.py index b1f5451c059..bb3fe01051f 100644 --- a/addons/crm/wizard/crm_merge_opportunities.py +++ b/addons/crm/wizard/crm_merge_opportunities.py @@ -137,7 +137,7 @@ class crm_merge_opportunity(osv.osv_memory): attach_ids = self.get_attachments(cr, uid, opp, context=context) self.set_attachements_res_id(cr, uid, first_opportunity.id, attach_ids) for mail_msg in opp.message_ids: - message_obj.write(cr, uid, mail_msg.id, {'res_id': first_opportunity.id, 'name' : _("From %s : %s") % (opp.name, mail_msg.subject) }, context=context) + message_obj.write(cr, uid, mail_msg.id, {'res_id': first_opportunity.id, 'subject' : _("From %s : %s") % (opp.name, mail_msg.subject) }, context=context) #Notification about loss of information details = [] diff --git a/addons/crm/wizard/email_compose_message.py b/addons/crm/wizard/mail_compose_message.py index e871eeebe31..c11f4d8c29d 100644 --- a/addons/crm/wizard/email_compose_message.py +++ b/addons/crm/wizard/mail_compose_message.py @@ -33,8 +33,8 @@ class mail_compose_message(osv.osv_memory): wizard when sending an email related to the document record identified by ``model`` and ``res_id``. - The default implementation returns an empty dictionary, and is meant - to be overridden by subclasses. + Overrides the default implementation to provide more default field values + related to the corresponding CRM case. :param str model: model name of the document record this mail is related to. :param int res_id: id of the document record this mail is related to. diff --git a/addons/crm_claim/crm_claim.py b/addons/crm_claim/crm_claim.py index 2b7a1220766..fdefb8b2569 100644 --- a/addons/crm_claim/crm_claim.py +++ b/addons/crm_claim/crm_claim.py @@ -27,7 +27,7 @@ import binascii import tools from tools.translate import _ -wizard.email_compose_message.email_model.append('crm.claim') +wizard.mail_compose_message.SUPPORTED_MODELS.append('crm.claim') CRM_CLAIM_PENDING_STATES = ( crm.AVAILABLE_STATES[2][0], # Cancelled crm.AVAILABLE_STATES[3][0], # Done diff --git a/addons/crm_claim/report/crm_claim_report.py b/addons/crm_claim/report/crm_claim_report.py index 2199a814f2d..141b3a0277d 100644 --- a/addons/crm_claim/report/crm_claim_report.py +++ b/addons/crm_claim/report/crm_claim_report.py @@ -106,7 +106,7 @@ class crm_claim_report(osv.osv): c.type_action as type_action, date_trunc('day',c.create_date) as create_date, avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close, - (SELECT count(id) FROM email_message WHERE model='crm.claim' AND res_id=c.id AND email_from IS NOT NULL) AS email, + (SELECT count(id) FROM mail_message WHERE model='crm.claim' AND res_id=c.id AND email_from IS NOT NULL) AS email, (SELECT avg(probability) FROM crm_case_stage WHERE type='claim' AND id=c.stage_id) AS probability, extract('epoch' from (c.date_deadline - c.date_closed))/(3600*24) as delay_expected from diff --git a/addons/crm_fundraising/crm_fundraising.py b/addons/crm_fundraising/crm_fundraising.py index d6b438b9915..e6b01bf91cd 100644 --- a/addons/crm_fundraising/crm_fundraising.py +++ b/addons/crm_fundraising/crm_fundraising.py @@ -23,7 +23,7 @@ from osv import fields, osv from crm import crm from crm import wizard -wizard.email_compose_message.email_model.append('crm.fundraising') +wizard.mail_compose_message.SUPPORTED_MODELS.append('crm.fundraising') class crm_fundraising(crm.crm_case, osv.osv): """ Fund Raising Cases """ diff --git a/addons/crm_helpdesk/crm_helpdesk.py b/addons/crm_helpdesk/crm_helpdesk.py index 382818bcc14..85cb734a655 100644 --- a/addons/crm_helpdesk/crm_helpdesk.py +++ b/addons/crm_helpdesk/crm_helpdesk.py @@ -111,7 +111,7 @@ class crm_helpdesk(crm.crm_case, osv.osv): 'description': body, 'user_id': False, } - if msg.get('priority', False): + if priority: vals['priority'] = priority res = thread_pool.get_partner(cr, uid, msg.get('from', False)) diff --git a/addons/crm_helpdesk/report/crm_helpdesk_report.py b/addons/crm_helpdesk/report/crm_helpdesk_report.py index fb5efdcb115..d01f0934e51 100644 --- a/addons/crm_helpdesk/report/crm_helpdesk_report.py +++ b/addons/crm_helpdesk/report/crm_helpdesk_report.py @@ -97,7 +97,7 @@ class crm_helpdesk_report(osv.osv): c.planned_cost, count(*) as nbr, extract('epoch' from (c.date_closed-c.create_date))/(3600*24) as delay_close, - (SELECT count(id) FROM email_message WHERE model='crm.helpdesk' AND res_id=c.id AND email_from IS NOT NULL) AS email, + (SELECT count(id) FROM mail_message WHERE model='crm.helpdesk' AND res_id=c.id AND email_from IS NOT NULL) AS email, abs(avg(extract('epoch' from (c.date_deadline - c.date_closed)))/(3600*24)) as delay_expected from crm_helpdesk c diff --git a/addons/crm_helpdesk/wizard/email_compose_message.py b/addons/crm_helpdesk/wizard/email_compose_message.py index ad754793044..8b147023bb3 100644 --- a/addons/crm_helpdesk/wizard/email_compose_message.py +++ b/addons/crm_helpdesk/wizard/email_compose_message.py @@ -24,15 +24,21 @@ from osv import fields import tools class email_compose_message(osv.osv_memory): - _inherit = 'email.compose.message' + _inherit = 'mail.compose.message' def get_value(self, cr, uid, model, resource_id, context=None): ''' - To get values of the resource_id for the model - @param model: Object - @param resource_id: id of a record for which values to be read + """Returns a defaults-like dict with initial values for the composition + wizard when sending an email related to the document record identified + by ``model`` and ``res_id``. - @return: Returns a dictionary + Overrides the default implementation to provide more default field values + related to the corresponding CRM case. + + :param str model: model name of the document record this mail is related to. + :param int res_id: id of the document record this mail is related to. + :param dict context: several context values will modify the behavior + of the wizard, cfr. the class description. ''' if context is None: context = {} diff --git a/addons/event/event.py b/addons/event/event.py index 246aee6980b..b87d5afc7a7 100644 --- a/addons/event/event.py +++ b/addons/event/event.py @@ -281,7 +281,7 @@ class event_registration(osv.osv): """Event Registration""" _name= 'event.registration' _description = __doc__ - _inherit = 'email.thread' + _inherit = 'mail.thread' def _amount_line(self, cr, uid, ids, field_name, arg, context=None): cur_obj = self.pool.get('res.currency') @@ -314,8 +314,8 @@ class event_registration(osv.osv): 'create_date': fields.datetime('Creation Date', readonly=True), 'write_date': fields.datetime('Write Date', readonly=True), 'description': fields.text('Description', states={'done': [('readonly', True)]}), - 'message_ids': fields.one2many('email.message', 'res_id', 'Messages', domain=[('model','=',_name)]), - 'log_ids': fields.one2many('email.message', 'res_id', 'Logs', domain=[('history', '=', False),('model','=',_name)]), + 'message_ids': fields.one2many('mail.message', 'res_id', 'Messages', domain=[('model','=',_name)]), + 'log_ids': fields.one2many('mail.message', 'res_id', 'Logs', domain=[('email_from', '=', False),('model','=',_name)]), 'date_deadline': fields.related('event_id','date_end', type='datetime', string="End Date", readonly=True), 'date': fields.related('event_id', 'date_begin', type='datetime', string="Start Date", readonly=True), 'user_id': fields.many2one('res.users', 'Responsible', states={'done': [('readonly', True)]}), @@ -522,7 +522,7 @@ class event_registration(osv.osv): """ Send email to user """ - email_message_obj = self.pool.get('email.message') + mail_message = self.pool.get('mail.message') for regestration in self.browse(cr, uid, ids, context=context): src = regestration.event_id.reply_to or False email_to = [] @@ -546,7 +546,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.schedule_with_attach(cr, uid, src, email_to, subject, body, model='event.registration', email_cc=email_cc, openobject_id=regestration.id) + mail_message.schedule_with_attach(cr, uid, src, email_to, subject, body, model='event.registration', email_cc=email_cc, res_id=regestration.id) return True diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml index 05eb55f067f..18c5c29f2e5 100644 --- a/addons/event/event_view.xml +++ b/addons/event/event_view.xml @@ -391,9 +391,8 @@ <field name="message_ids" colspan="4" nolabel="1" mode="tree,form"> <tree string="History"> <field name="display_text" string="History Information"/> - <field name="history" invisible="1"/> <button - string="Reply" attrs="{'invisible': [('history', '!=', True)]}" + string="Reply" attrs="{'invisible': [('email_from', '=', False)]}" name="%(mail.action_email_compose_message_wizard)d" context="{'mail':'reply', 'message_id':active_id}" icon="terp-mail-replied" type="action" /> @@ -405,18 +404,17 @@ <field name="email_to" widget="char" size="512"/> <field name="email_cc" widget="char" size="512"/> <field name="subject" colspan="4" widget="char" size="512"/> - <field name="history" invisible="1"/> </group> <notebook colspan="4"> <page string="Details"> - <group attrs="{'invisible': [('history', '!=', True)]}"> - <field name="body" colspan="4" nolabel="1" height="250"/> + <group attrs="{'invisible': [('email_from', '=', False)]}"> + <field name="body_text" colspan="4" nolabel="1" height="250"/> <button colspan="4" string="Reply" name="%(mail.action_email_compose_message_wizard)d" context="{'mail':'reply', 'message_id':active_id}" icon="terp-mail-replied" type="action"/> </group> - <group attrs="{'invisible': [('history', '=', True)]}"> + <group attrs="{'invisible': [('email_from', '!=', False)]}"> <field name="display_text" colspan="4" nolabel="1" height="250"/> </group> </page> diff --git a/addons/event/wizard/email_compose_message.py b/addons/event/wizard/email_compose_message.py index 94cd650c3f5..fc664a62f6f 100644 --- a/addons/event/wizard/email_compose_message.py +++ b/addons/event/wizard/email_compose_message.py @@ -24,7 +24,7 @@ from osv import fields import tools class email_compose_message(osv.osv_memory): - _inherit = 'email.compose.message' + _inherit = 'mail.compose.message' def get_value(self, cr, uid, model, resource_id, context=None): ''' @@ -44,13 +44,11 @@ class email_compose_message(osv.osv_memory): 'subject' : data.event_id.name or False, 'email_to' : data.email_from or False, 'email_from' : data.user_id and data.user_id.address_id and data.user_id.address_id.email or False, - 'body' : '\n' + (tools.ustr(data.user_id.signature or '')), + 'body_text' : '\n' + (tools.ustr(data.user_id.signature or '')), 'email_cc' : tools.ustr(data.email_cc or ''), 'model': model, 'res_id': resource_id, }) return result -email_compose_message() - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/fetchmail/fetchmail.py b/addons/fetchmail/fetchmail.py index 3fe296c50bf..f201ff7560d 100644 --- a/addons/fetchmail/fetchmail.py +++ b/addons/fetchmail/fetchmail.py @@ -149,7 +149,7 @@ class email_server(osv.osv): def fetch_mail(self, cr, uid, ids, context=None): if context is None: context = {} - thread_pool = self.pool.get('email.thread') + thread_pool = self.pool.get('mail.thread') action_pool = self.pool.get('ir.actions.server') context.update({'get_server': True}) for server in self.browse(cr, uid, ids, context=context): @@ -201,9 +201,9 @@ class email_server(osv.osv): email_server() -class email_message(osv.osv): +class mail_message(osv.osv): - _inherit = "email.message" + _inherit = "mail.message" _columns = { 'server_id': fields.many2one('email.server', "Mail Server", readonly=True, select=True), @@ -215,7 +215,7 @@ class email_message(osv.osv): server_id = context.get('server_id',False) if server_id: values['server_id'] = server_id - res = super(email_message,self).create(cr, uid, values, context=context) + res = super(mail_message,self).create(cr, uid, values, context=context) return res def write(self, cr, uid, ids, values, context=None): @@ -224,9 +224,8 @@ class email_message(osv.osv): server_id = context.get('server_id',False) if server_id: values['server_id'] = server_id - res = super(email_message,self).write(cr, uid, ids, values, context=context) + res = super(mail_message,self).write(cr, uid, ids, values, context=context) return res -email_message() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/fetchmail/fetchmail_view.xml b/addons/fetchmail/fetchmail_view.xml index bdf25b40f74..d3470cec6eb 100644 --- a/addons/fetchmail/fetchmail_view.xml +++ b/addons/fetchmail/fetchmail_view.xml @@ -109,8 +109,8 @@ /> <record model="ir.ui.view" id="email_message_tree_view"> - <field name="name">email.message.tree</field> - <field name="model">email.message</field> + <field name="name">mail.message.tree</field> + <field name="model">mail.message</field> <field name="type">tree</field> <field name="inherit_id" ref="mail.view_email_message_tree"/> <field name="arch" type="xml"> @@ -121,8 +121,8 @@ </record> <record model="ir.ui.view" id="email_message_search_view"> - <field name="name">email.message.inherit.search</field> - <field name="model">email.message</field> + <field name="name">mail.message.inherit.search</field> + <field name="model">mail.message</field> <field name="type">search</field> <field name="inherit_id" ref="mail.view_email_message_search"/> <field name="arch" type="xml"> @@ -134,7 +134,7 @@ <record id="action_view_mail_message_emails" model="ir.actions.act_window"> <field name="name">Messages</field> - <field name="res_model">email.message</field> + <field name="res_model">mail.message</field> <field name="view_type">form</field> <field name="view_mode">tree,form</field> <field name="context">{'search_default_emails': 1}</field> @@ -143,8 +143,8 @@ <act_window context="{'search_default_server_id': [active_id], 'default_server_id': active_id}" - id="act_server_history" name="Messages" domain="[('history', '=', True), ('server_id', '=', active_id)]" - res_model="email.message" src_model="email.server"/> + id="act_server_history" name="Messages" domain="[('email_from', '!=', False), ('server_id', '=', active_id)]" + res_model="mail.message" src_model="email.server"/> </data> </openerp> diff --git a/addons/hr_evaluation/hr_evaluation.py b/addons/hr_evaluation/hr_evaluation.py index 6455b72837a..7634052704c 100644 --- a/addons/hr_evaluation/hr_evaluation.py +++ b/addons/hr_evaluation/hr_evaluation.py @@ -192,7 +192,7 @@ class hr_evaluation(osv.osv): return {'value': {'plan_id':evaluation_plan_id}} def button_plan_in_progress(self, cr, uid, ids, context=None): - email_message_obj = self.pool.get('email.message') + mail_message = self.pool.get('mail.message') hr_eval_inter_obj = self.pool.get('hr.evaluation.interview') if context is None: context = {} @@ -229,7 +229,7 @@ class hr_evaluation(osv.osv): sub = phase.email_subject dest = [child.work_email] if dest: - email_message_obj.schedule_with_attach(cr, uid, evaluation.employee_id.work_email, dest, sub, body, model='hr_evaluation.evaluation') + mail_message.schedule_with_attach(cr, uid, evaluation.employee_id.work_email, dest, sub, body, context=context) self.write(cr, uid, ids, {'state':'wait'}, context=context) return True diff --git a/addons/hr_evaluation/hr_evaluation_view.xml b/addons/hr_evaluation/hr_evaluation_view.xml index 723036f2269..3b1a4ce94e9 100644 --- a/addons/hr_evaluation/hr_evaluation_view.xml +++ b/addons/hr_evaluation/hr_evaluation_view.xml @@ -412,7 +412,7 @@ <!-- Email Compose message Action--> <act_window id="evaluation_reminders" name="Evaluation Reminders" - res_model="email.compose.message" + res_model="mail.compose.message" src_model="hr.evaluation.interview" view_type="form" view_mode="form" target="new" multi="True" diff --git a/addons/hr_evaluation/wizard/email_compose_message.py b/addons/hr_evaluation/wizard/email_compose_message.py index c8e055928f6..7b4c1b69164 100644 --- a/addons/hr_evaluation/wizard/email_compose_message.py +++ b/addons/hr_evaluation/wizard/email_compose_message.py @@ -24,8 +24,8 @@ from osv import fields import tools from tools.translate import _ -class email_compose_message(osv.osv_memory): - _inherit = 'email.compose.message' +class mail_compose_message(osv.osv_memory): + _inherit = 'mail.compose.message' def get_value(self, cr, uid, model, resource_id, context=None): ''' @@ -37,7 +37,7 @@ class email_compose_message(osv.osv_memory): ''' if context is None: context = {} - result = super(email_compose_message, self).get_value(cr, uid, model, resource_id, context=context) + result = super(mail_compose_message, self).get_value(cr, uid, model, resource_id, context=context) if model == 'hr.evaluation.interview' and resource_id: model_pool = self.pool.get(model) record_data = model_pool.browse(cr, uid, resource_id, context) @@ -47,7 +47,7 @@ class email_compose_message(osv.osv_memory): 'email_from': tools.config.get('email_from',''), 'email_to': record_data.user_to_review_id.work_email or False, 'subject': _("Reminder to fill up Survey"), - 'body': msg, + 'body_text': msg, 'res_id': resource_id, 'model': model, 'email_cc': False, @@ -56,6 +56,5 @@ class email_compose_message(osv.osv_memory): }) return result -email_compose_message() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_evaluation/wizard/hr_evaluation_mail.py b/addons/hr_evaluation/wizard/hr_evaluation_mail.py index 37696ad465b..35c54a4cca3 100644 --- a/addons/hr_evaluation/wizard/hr_evaluation_mail.py +++ b/addons/hr_evaluation/wizard/hr_evaluation_mail.py @@ -23,22 +23,20 @@ import tools class hr_evaluation_reminder(osv.osv_memory): _name = "hr.evaluation.reminder" - _description = "Sends Reminders to employess to fill the evaluations" + _description = "Sends Reminders to employees to fill the evaluations" _columns = { 'evaluation_id': fields.many2one('hr.evaluation.interview', 'Interview', required=True) } def send_mail(self, cr, uid, ids, context=None): - email_message_obj = self.pool.get('email.message') + mail_message = self.pool.get('mail.message') hr_evaluation_interview_obj = self.pool.get('hr.evaluation.interview') evaluation_data = self.read(cr, uid, ids, context=context)[0] 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.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') + mail_message.schedule_with_attach(cr, uid, tools.config['email_from'], [current_interview.user_to_review_id.work_email],\ + 'Reminder to fill up Survey', msg, context=context) return {'type': 'ir.actions.act_window_close'} -hr_evaluation_reminder() - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index dd36394bf88..1113aa2fbc6 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -80,7 +80,7 @@ class hr_applicant(crm.crm_case, osv.osv): _name = "hr.applicant" _description = "Applicant" _order = "id desc" - _inherit = ['email.thread'] + _inherit = ['mail.thread'] def _compute_day(self, cr, uid, ids, fields, args, context=None): """ @@ -118,7 +118,7 @@ class hr_applicant(crm.crm_case, osv.osv): _columns = { 'name': fields.char('Name', size=128, required=True), - 'message_ids': fields.one2many('email.message', 'res_id', 'Messages', domain=[('model','=',_name)]), + 'message_ids': fields.one2many('mail.message', 'res_id', 'Messages', domain=[('model','=',_name)]), 'active': fields.boolean('Active', help="If the active field is set to false, it will allow you to hide the case without removing it."), 'description': fields.text('Description'), 'email_from': fields.char('Email', size=128, help="These people will receive email."), @@ -298,11 +298,11 @@ class hr_applicant(crm.crm_case, osv.osv): value = self.pool.get("survey").action_print_survey(cr, uid, ids, context=context) return value - def message_new(self, cr, uid, msg, context=None): - """Automatically calls when new email message arrives""" + def message_new(self, cr, uid, msg, custom_values=None, context=None): + """Automatically called when new email message arrives""" thread_pool = self.pool.get('mail.thread') subject = msg.get('subject') or _("No Subject") - body = msg.get('body') + body = msg.get('body_text') msg_from = msg.get('from') priority = msg.get('priority') @@ -313,47 +313,23 @@ class hr_applicant(crm.crm_case, osv.osv): 'description': body, 'user_id': False, } - if msg.get('priority', False): + if priority: vals['priority'] = priority res = thread_pool.get_partner(cr, uid, msg.get('from')) if res: vals.update(res) res_id = self.create(cr, uid, vals, context) - - attachments = msg.get('attachments', {}) - self.history(cr, uid, [res_id], _('receive'), history=True, - subject = msg.get('subject'), - email = msg.get('to'), - details = msg.get('body'), - email_from = msg.get('from'), - email_cc = msg.get('cc'), - message_id = msg.get('message-id'), - references = msg.get('references', False) or msg.get('in-reply-to', False), - attach = attachments, - email_date = msg.get('date'), - body_html= msg.get('body_html'), - sub_type = msg.get('sub_type'), - headers = msg.get('headers'), - priority = msg.get('priority'), - context = context) - + self.append_mail(cr, uid, ids, msg, context=context) return res_id def message_update(self, cr, uid, ids, msg, vals={}, default_act='pending', context=None): - """ - @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 - """ - if isinstance(ids, (str, int, long)): ids = [ids] msg_from = msg['from'] vals.update({ - 'description': msg['body'] + 'description': msg['body_text'] }) if msg.get('priority', False): vals['priority'] = msg.get('priority') @@ -364,7 +340,7 @@ class hr_applicant(crm.crm_case, osv.osv): 'probability':'probability' } vls = { } - for line in msg['body'].split('\n'): + for line in msg['body_text'].split('\n'): line = line.strip() res = tools.misc.command_re.match(line) if res and maps.get(res.group(1).lower(), False): @@ -373,23 +349,7 @@ class hr_applicant(crm.crm_case, osv.osv): vals.update(vls) res = self.write(cr, uid, ids, vals, context=context) - - attachments = msg.get('attachments', {}) - self.history(cr, uid, ids, _('receive'), history=True, - subject = msg.get('subject'), - email = msg.get('to'), - details = msg.get('body'), - email_from = msg.get('from'), - email_cc = msg.get('cc'), - message_id = msg.get('message-id'), - references = msg.get('references', False) or msg.get('in-reply-to', False), - attach = attachments, - email_date = msg.get('date'), - body_html= msg.get('body_html'), - sub_type = msg.get('sub_type'), - headers = msg.get('headers'), - priority = msg.get('priority'), - context = context) + self.append_mail(cr, uid, ids, msg, context=context) return res def case_open(self, cr, uid, ids, *args): diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml index a014508a91a..e9951143dbc 100644 --- a/addons/hr_recruitment/hr_recruitment_view.xml +++ b/addons/hr_recruitment/hr_recruitment_view.xml @@ -144,9 +144,8 @@ <field name="message_ids" colspan="4" nolabel="1" mode="tree,form"> <tree string="History"> <field name="display_text" string="History Information"/> - <field name="history" invisible="1"/> <button - string="Reply" attrs="{'invisible': [('history', '!=', True)]}" + string="Reply" attrs="{'invisible': [('email_from', '=', False)]}" name="%(mail.action_email_compose_message_wizard)d" context="{'mail':'reply', 'message_id':active_id}" icon="terp-mail-replied" type="action" /> @@ -158,18 +157,17 @@ <field name="email_to" widget="char" size="512"/> <field name="email_cc" widget="char" size="512"/> <field name="subject" colspan="4" widget="char" size="512"/> - <field name="history" invisible="1"/> </group> <notebook colspan="4"> <page string="Details"> - <group attrs="{'invisible': [('history', '!=', True)]}"> + <group attrs="{'invisible': [('email_from', '=', False)]}"> <field name="body" colspan="4" nolabel="1" height="250"/> <button colspan="4" string="Reply" name="%(mail.action_email_compose_message_wizard)d" context="{'mail':'reply', 'message_id':active_id}" icon="terp-mail-replied" type="action"/> </group> - <group attrs="{'invisible': [('history', '=', True)]}"> + <group attrs="{'invisible': [('email_from', '!=', False)]}"> <field name="display_text" colspan="4" nolabel="1" height="250"/> </group> </page> diff --git a/addons/hr_recruitment/wizard/email_compose_message.py b/addons/hr_recruitment/wizard/email_compose_message.py index f5cc4883ef3..b2890de02a6 100644 --- a/addons/hr_recruitment/wizard/email_compose_message.py +++ b/addons/hr_recruitment/wizard/email_compose_message.py @@ -25,7 +25,7 @@ import tools class email_compose_message(osv.osv_memory): - _inherit = 'email.compose.message' + _inherit = 'mail.compose.message' def get_value(self, cr, uid, model, resource_id, context=None): ''' @@ -45,13 +45,12 @@ class email_compose_message(osv.osv_memory): 'subject' : data.name or False, 'email_to' : data.email_from or False, 'email_from' : data.user_id and data.user_id.address_id and data.user_id.address_id.email or False, - 'body' : '\n' + (tools.ustr(data.user_id.signature or '')), + 'body_text' : '\n' + (tools.ustr(data.user_id.signature or '')), 'email_cc' : tools.ustr(data.email_cc or ''), 'model': model, 'res_id': resource_id, }) return result -email_compose_message() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py b/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py index e07e1442700..cd9cbea52f7 100644 --- a/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py +++ b/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py @@ -50,7 +50,7 @@ class job2phonecall(osv.osv_memory): return categ_id and categ_id[0] or case.categ_id and case.categ_id.id or False def _get_note(self, cr, uid, context=None): - msg_obj = self.pool.get('email.message') + mail_message = self.pool.get('mail.message') if context is None: context = {} if context.get('active_id'): @@ -58,9 +58,9 @@ class job2phonecall(osv.osv_memory): if case.description: return case.description else: - msg_ids = msg_obj.search(cr, uid, [('model', '=', 'hr.applicant'), ('res_id', '=', case.id), ('email_from', '!=', ''), ('email_to', '!=', '')], limit=1) + msg_ids = mail_message.search(cr, uid, [('model', '=', 'hr.applicant'), ('res_id', '=', case.id), ('email_from', '!=', ''), ('email_to', '!=', '')], limit=1) if msg_ids: - return msg_obj.browse(cr, uid, msg_ids[0], context=context).description + return mail_message.browse(cr, uid, msg_ids[0], context=context).body_text return False diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index dfc71c4f4f7..056f83ab898 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -77,7 +77,7 @@ class mail_message_common(osv.osv_memory): 'email_to': fields.char('To', size=256, help='Message recipients'), 'email_cc': fields.char('Cc', size=256, help='Carbon copy message recipients'), 'email_bcc': fields.char('Bcc', size=256, help='Blind carbon copy message recipients'), - 'reply_to':fields.char('Reply-To', size=256, help='Response address for the message'), + 'reply_to':fields.char('Reply-To', size=256, help='Preferred response address for the message'), 'headers': fields.text('Message headers', help="Full message headers, e.g. SMTP session headers", readonly=1), 'message_id': fields.char('Message-Id', size=256, help='Message unique identifier', select=1, readonly=1), 'references': fields.text('References', help='Message references, such as identifiers of previous messages', readonly=1), @@ -205,7 +205,7 @@ class mail_message(osv.osv): :param string subtype: optional mime subtype for the text body (usually 'plain' or 'html'), must match the format of the ``body`` parameter. Default is 'plain', making the content part of the mail "text/plain". - :param list attachments: list of (filename, filecontents) pairs, where filecontents is a string + :param dict attachments: map of filename to filecontents, where filecontents is a string containing the bytes of the attachment :param dict headers: optional map of headers to set on the outgoing mail (may override the other headers, including Subject, Reply-To, Message-Id, etc.) @@ -245,7 +245,7 @@ class mail_message(osv.osv): } email_msg_id = self.create(cr, uid, msg_vals, context) attachment_ids = [] - for fname, fcontent in attachments.items(): + for fname, fcontent in attachments.iteritems(): attachment_data = { 'name': fname, 'datas_fname': fname, @@ -381,6 +381,7 @@ class mail_message(osv.osv): msg['in-reply-to'] = msg_txt.get('In-Reply-To') msg['headers'] = {} + msg['subtype'] = 'plain' for item in msg_txt.items(): if item[0].startswith('X-'): msg['headers'].update({item[0]: item[1]}) @@ -391,8 +392,6 @@ class mail_message(osv.osv): msg['body_html'] = body msg['subtype'] = 'html' body = tools.html2plaintext(body) - else: - msg['subtype'] = 'plain' msg['body_text'] = tools.ustr(body, encoding) attachments = {} @@ -415,6 +414,7 @@ class mail_message(osv.osv): content = tools.ustr(content, encoding) if part.get_content_subtype() == 'html': msg['body_html'] = content + msg['subtype'] = 'html' # html version prevails body = tools.ustr(tools.html2plaintext(content)) elif part.get_content_subtype() == 'plain': body = content @@ -426,7 +426,11 @@ class mail_message(osv.osv): body += tools.ustr(res, encoding) msg['body_text'] = body - msg['attachments'] = attachments + msg['attachments'] = attachments + + # for backwards compatibility: + msg['body'] = msg['body_text'] + msg['sub_type'] = msg['subtype'] or 'plain' return msg def send(self, cr, uid, ids, auto_commit=False, context=None): diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 22f21677379..a1ef9de9627 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -111,7 +111,7 @@ class mail_thread(osv.osv): if custom_values and isinstance(custom_values, dict): data.update(custom_values) res_id = model_pool.create(cr, uid, data, context=context) - self.append_mail(cr, uid, ids, msg_dict, context=context) + self.append_mail(cr, uid, [res_id], msg_dict, context=context) return res_id def message_update(self, cr, uid, ids, msg_dict, vals={}, default_act=None, context=None): diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py index 0cdd5a8b7ba..b92db46857d 100644 --- a/addons/mail/wizard/mail_compose_message.py +++ b/addons/mail/wizard/mail_compose_message.py @@ -218,8 +218,8 @@ class mail_compose_message(osv.osv_memory): def render_template(self, cr, uid, template, model, res_id, context=None): """Render the given template text, replace mako-like expressions ``${expr}`` - with the result of passing these expressions ``through safe_eval()`` with - an evaluation context containing: + with the result of evaluating these expressions with an evaluation context + containing: * ``user``: browse_record of the current user * ``object``: browse_record of the document record this mail is diff --git a/addons/outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py b/addons/outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py index 4bafe893704..cbd9482b1ae 100644 --- a/addons/outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py +++ b/addons/outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py @@ -181,14 +181,14 @@ class XMLRpcConn(object): model = rec[0]
res_id = rec[1]
#Check if mail installed
- object_id = execute ( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=','email.message')])
+ object_id = execute ( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=','mail.message')])
if not object_id:
win32ui.MessageBox("Mail is not installed on your configured database '%s' !!\n\nPlease install it to archive the mail."%(self._dbname),"Mail not installed",win32con.MB_ICONERROR)
return
object_ids = execute ( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=',model)])
object_name = execute( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','read',object_ids,['name'])[0]['name']
#Reading the Object ir.model Name
- ext_ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.message','search',[('message_id','=',message_id),('model','=',model),('res_id','=',res_id)])
+ ext_ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'mail.message','search',[('message_id','=',message_id),('model','=',model),('res_id','=',res_id)])
if ext_ids:
name = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,model,'read',res_id,['name'])['name']
ext_msg += """This mail is already archived to {0} '{1}'.\n""".format(object_name,name)
@@ -208,14 +208,25 @@ class XMLRpcConn(object): context['thread_model'] = model
if attachments:
result = self.MakeAttachment([rec], mail)
- execute(conn,'execute',self._dbname,int(self._uid),self._pwd, \
- 'email.thread','history', [res_id], 'receive', \
- True, msg.get('subject',False),\
- msg.get('to'), msg.get('body', False),\
- msg.get('from'), msg.get('message-id'),\
- msg.get('references', False), result,\
- msg.get('cc'), False,\
- msg.get('date'), context)
+ execute(conn, 'execute', self. _dbname, int(self._uid), self._pwd,
+ 'mail.thread','history',[res_id],
+ msg.get('subject', False),
+ msg.get('body', False),
+ msg.get('to', False),
+ msg.get('from', False),
+ msg.get('cc', False),
+ False, # BCC
+ False, #reply-to
+ msg.get('date', False),
+ msg.get('message-id'),\
+ msg.get('references', False),
+ result, #attachments
+ #FIXME: properly handle plaintext/html body variants?
+ False, #body_html
+ False, #subtype
+ False, #headers
+ False, #original
+ context)
new_msg += """- {0} : {1}\n""".format(object_name,str(rec[2]))
flag = True
@@ -306,7 +317,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.thread','process_email',section, str(email))
+ id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'mail.thread','process_email',section, str(email))
if id > 0:
flag = True
return flag
@@ -453,17 +464,17 @@ class XMLRpcConn(object): import win32ui
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
res_vals = []
- mail_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'email.message', 'search', [('message_id','=',message_id)])
+ mail_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'mail.message', 'search', [('message_id','=',message_id)])
ref_mail_id = None
if not mail_id:
- ref_mail_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'email.message', 'search', [('references','=',message_id)])
+ ref_mail_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'mail.message', 'search', [('references','like','%'+message_id+'%')])
if ref_mail_id:
- address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'email.message','read',ref_mail_id[0],['model','res_id'])
+ address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'mail.message','read',ref_mail_id[0],['model','res_id'])
for key, vals in address.items():
res_vals.append([key,vals])
return res_vals
return None
- address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'email.message','read',mail_id[0],['model','res_id'])
+ address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'mail.message','read',mail_id[0],['model','res_id'])
for key, vals in address.items():
res_vals.append([key,vals])
return res_vals
diff --git a/addons/project/wizard/email_compose_message.py b/addons/project/wizard/email_compose_message.py index 921cbf1b081..2eee75c22b1 100644 --- a/addons/project/wizard/email_compose_message.py +++ b/addons/project/wizard/email_compose_message.py @@ -24,7 +24,7 @@ from osv import fields from tools.translate import _ class email_compose_message(osv.osv_memory): - _inherit = 'email.compose.message' + _inherit = 'mail.compose.message' def get_value(self, cr, uid, model, resource_id, context=None): ''' @@ -34,8 +34,6 @@ class email_compose_message(osv.osv_memory): @return: Returns a dictionary ''' - if context is None: - context = {} result = super(email_compose_message, self).get_value(cr, uid, model, resource_id, context=context) if model == 'project.task' and resource_id: task_pool = self.pool.get('project.task') @@ -61,7 +59,7 @@ class email_compose_message(osv.osv_memory): if partner and len(partner.address): result.update({'email_to': result.get('email_to',False) and result.get('email_to') + ',' + partner.address[0].email}) result.update({ - 'body': description or False, + 'body_text': description or False, 'email_to': task_data.project_id.user_id and task_data.project_id.user_id.user_email or False, 'subject': _("Task '%s' Closed") % task_data.name, 'model': model, @@ -70,6 +68,5 @@ class email_compose_message(osv.osv_memory): return result -email_compose_message() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project/wizard/project_task_close.py b/addons/project/wizard/project_task_close.py index a0710d288b3..fddc8e46f2f 100644 --- a/addons/project/wizard/project_task_close.py +++ b/addons/project/wizard/project_task_close.py @@ -68,7 +68,7 @@ class project_task_close(osv.osv_memory): if context is None: context = {} - email_message_obj = self.pool.get('email.message') + mail_message = self.pool.get('mail.message') task_pool = self.pool.get('project.task') task_id = context.get('active_id', False) if not task_id: @@ -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.schedule_with_attach(cr, uid, from_adr, to_adr, subject, tools.ustr(body), model='project.task.close', email_bcc=[from_adr]) + mail_id = mail_message.schedule_with_attach(cr, uid, from_adr, to_adr, subject, tools.ustr(body), email_bcc=[from_adr], context=context) if not mail_id: raise osv.except_osv(_('Error'), _("Couldn't send mail! Check the email ids and smtp configuration settings")) return {'type': 'ir.actions.act_window_close'} diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 484802f8638..d799d60d5db 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -44,7 +44,7 @@ class project_issue(crm.crm_case, osv.osv): _name = "project.issue" _description = "Project Issue" _order = "priority, create_date desc" - _inherit = ['email.thread'] + _inherit = ['mail.thread'] def case_open(self, cr, uid, ids, *args): """ @@ -383,20 +383,14 @@ class project_issue(crm.crm_case, osv.osv): self.history(cr, uid, cases, _('Escalate')) return True - def message_new(self, cr, uid, msg, context=None): - """ - Automatically calls when new email message arrives - - @param self: The object pointer - @param cr: the current row, from the database cursor, - @param uid: the current user’s ID for security checks - """ + def message_new(self, cr, uid, msg, custom_values=None, context=None): + """Automatically called when new email message arrives""" if context is None: context = {} - thread_pool = self.pool.get('email.thread') + thread_pool = self.pool.get('mail.thread') subject = msg.get('subject') or _('No Title') - body = msg.get('body') + body = msg.get('body_text') msg_from = msg.get('from') priority = msg.get('priority') @@ -407,7 +401,7 @@ class project_issue(crm.crm_case, osv.osv): 'description': body, 'user_id': False, } - if msg.get('priority', False): + if priority: vals['priority'] = priority res = thread_pool.get_partner(cr, uid, msg.get('from')) @@ -415,34 +409,15 @@ class project_issue(crm.crm_case, osv.osv): vals.update(res) context.update({'state_to' : 'draft'}) - res_id = self.create(cr, uid, vals, context) + if custom_values and isinstance(custom_values, dict): + vals.update(custom_values) - attachments = msg.get('attachments', {}) - self.history(cr, uid, [res_id], _('receive'), history=True, - subject = msg.get('subject'), - email = msg.get('to'), - details = msg.get('body'), - email_from = msg.get('from'), - email_cc = msg.get('cc'), - message_id = msg.get('message-id'), - references = msg.get('references', False) or msg.get('in-reply-to', False), - attach = attachments, - email_date = msg.get('date'), - body_html= msg.get('body_html'), - sub_type = msg.get('sub_type'), - headers = msg.get('headers'), - priority = msg.get('priority'), - context = context) + res_id = self.create(cr, uid, vals, context) + self.append_mail(cr, uid, [res_id], msg, context=context) self.convert_to_bug(cr, uid, [res_id], context=context) return res_id def message_update(self, cr, uid, ids, msg, vals=None, default_act='pending', context=None): - """ - @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 - """ if vals is None: vals = {} @@ -451,7 +426,7 @@ class project_issue(crm.crm_case, osv.osv): ids = [ids] vals.update({ - 'description': msg['body'] + 'description': msg['body_text'] }) if msg.get('priority', False): vals['priority'] = msg.get('priority') @@ -468,7 +443,7 @@ class project_issue(crm.crm_case, osv.osv): record.write({'state' : 'open'}) vls = { } - for line in msg['body'].split('\n'): + for line in msg['body_text'].split('\n'): line = line.strip() res = tools.misc.command_re.match(line) if res and maps.get(res.group(1).lower(), False): @@ -477,23 +452,7 @@ class project_issue(crm.crm_case, osv.osv): vals.update(vls) res = self.write(cr, uid, ids, vals) - - attachments = msg.get('attachments', {}) - self.history(cr, uid, ids, _('receive'), history=True, - subject = msg.get('subject'), - email = msg.get('to'), - details = msg.get('body'), - email_from = msg.get('from'), - email_cc = msg.get('cc'), - message_id = msg.get('message-id'), - references = msg.get('references', False) or msg.get('in-reply-to', False), - attach = attachments, - email_date = msg.get('date'), - body_html= msg.get('body_html'), - sub_type = msg.get('sub_type'), - headers = msg.get('headers'), - priority = msg.get('priority'), - context = context) + self.append_mail(cr, uid, [res_id], msg, context=context) return res def copy(self, cr, uid, id, default=None, context=None): diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index b60fd4f0c6b..ffe5110e6a9 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -100,9 +100,8 @@ <field name="message_ids" colspan="4" nolabel="1" mode="tree,form"> <tree string="History"> <field name="display_text" string="History Information"/> - <field name="history" invisible="1"/> <button - string="Reply" attrs="{'invisible': [('history', '!=', True)]}" + string="Reply" attrs="{'invisible': [('email_from', '=', False)]}" name="%(mail.action_email_compose_message_wizard)d" context="{'mail':'reply', 'message_id':active_id}" icon="terp-mail-replied" type="action" /> @@ -114,18 +113,17 @@ <field name="email_to" widget="char" size="512"/> <field name="email_cc" widget="char" size="512"/> <field name="subject" colspan="4" widget="char" size="512"/> - <field name="history" invisible="1"/> </group> <notebook colspan="4"> <page string="Details"> - <group attrs="{'invisible': [('history', '!=', True)]}"> - <field name="body" colspan="4" nolabel="1" height="250"/> + <group attrs="{'invisible': [('email_from', '=', False)]}"> + <field name="body_text" colspan="4" nolabel="1" height="250"/> <button colspan="4" string="Reply" name="%(mail.action_email_compose_message_wizard)d" context="{'mail':'reply', 'message_id':active_id}" icon="terp-mail-replied" type="action"/> </group> - <group attrs="{'invisible': [('history', '=', True)]}"> + <group attrs="{'invisible': [('email_from', '!=', False)]}"> <field name="display_text" colspan="4" nolabel="1" height="250"/> </group> </page> diff --git a/addons/project_issue/report/project_issue_report.py b/addons/project_issue/report/project_issue_report.py index 6b56a254a4a..a199d1c9d57 100644 --- a/addons/project_issue/report/project_issue_report.py +++ b/addons/project_issue/report/project_issue_report.py @@ -102,7 +102,7 @@ class project_issue_report(osv.osv): date_trunc('day',c.create_date) as create_date, extract('epoch' from (c.date_open-c.create_date))/(3600*24) as delay_open, extract('epoch' from (c.date_closed-c.date_open))/(3600*24) as delay_close, - (SELECT count(id) FROM email_message WHERE model='project.issue' AND res_id=c.id) AS email + (SELECT count(id) FROM mail_message WHERE model='project.issue' AND res_id=c.id) AS email FROM project_issue c diff --git a/addons/project_issue/wizard/email_compose_message.py b/addons/project_issue/wizard/email_compose_message.py index df1133245d2..ffb708ebe35 100644 --- a/addons/project_issue/wizard/email_compose_message.py +++ b/addons/project_issue/wizard/email_compose_message.py @@ -24,7 +24,7 @@ from osv import fields import tools class email_compose_message(osv.osv_memory): - _inherit = 'email.compose.message' + _inherit = 'mail.compose.message' def get_value(self, cr, uid, model, resource_id, context=None): ''' @@ -44,13 +44,12 @@ class email_compose_message(osv.osv_memory): 'subject' : data.name or False, 'email_to' : data.email_from or False, 'email_from' : data.user_id and data.user_id.address_id and data.user_id.address_id.email or False, - 'body' : '\n' + (tools.ustr(data.user_id.signature or '')), + 'body_text' : '\n' + (tools.ustr(data.user_id.signature or '')), 'email_cc' : tools.ustr(data.email_cc or ''), 'model': model, 'res_id': resource_id, }) return result -email_compose_message() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project_mailgate/project_mailgate.py b/addons/project_mailgate/project_mailgate.py index 808eede3b3c..7e794c7f75b 100644 --- a/addons/project_mailgate/project_mailgate.py +++ b/addons/project_mailgate/project_mailgate.py @@ -33,20 +33,11 @@ class project_tasks(osv.osv): 'message_ids': fields.one2many('mail.message', 'res_id', 'Messages', domain=[('model','=',_name)], readonly=True), } - def message_new(self, cr, uid, msg, context=None): -# """ -# Automatically calls when new email message arrives -# -# @param self: The object pointer -# @param cr: the current row, from the database cursor, -# @param uid: the current user’s ID for security checks -# """ - thread_obj = self.pool.get('email.thread') + def message_new(self, cr, uid, msg, custom_values=None, context=None): + thread_obj = self.pool.get('mail.thread') subject = msg.get('subject') - body = msg.get('body') + body = msg.get('body_text') msg_from = msg.get('from') - #TODO map email priority with openerp task priority - priority = msg.get('priority') data = { 'name': subject, @@ -56,34 +47,11 @@ class project_tasks(osv.osv): res = thread_obj.get_partner(cr, uid, msg_from) if res: data.update(res) - res_id = self.create(cr, uid, data, context) - attachments = msg.get('attachments', {}) - for attachment in attachments: - data_attach = { - 'name': attachment, - 'datas': binascii.b2a_base64(str(attachments.get(attachment))), - 'datas_fname': attachment, - 'description': 'Mail attachment', - 'res_model': self._name, - 'res_id': res, - } - self.pool.get('ir.attachment').create(cr, uid, data_attach, context) - self.history(cr, uid, [res_id], _('receive'), history=True, - subject = msg.get('subject'), - email = msg.get('to'), - details = msg.get('body'), - email_from = msg.get('from'), - email_cc = msg.get('cc'), - message_id = msg.get('message-id'), - references = msg.get('references', False) or msg.get('in-reply-to', False), - attach = attachments, - email_date = msg.get('date'), - body_html= msg.get('body_html'), - sub_type = msg.get('sub_type'), - headers = msg.get('headers'), - priority = msg.get('priority'), - context = context) + if custom_values and isinstance(custom_values, dict): + data.update(custom_values) + res_id = self.create(cr, uid, data, context) + self.append_mail(cr, uid, [res_id], msg, context=context) return res_id def message_update(self, cr, uid, ids, msg, data={}, default_act='pending'): @@ -95,7 +63,7 @@ class project_tasks(osv.osv): maps = { 'cost':'planned_hours', } - for line in msg['body'].split('\n'): + for line in msg['body_text'].split('\n'): line = line.strip() res = tools.misc.command_re.match(line) if res: @@ -112,23 +80,7 @@ class project_tasks(osv.osv): self.write(cr, uid, ids, data, context=context) getattr(self,act)(cr, uid, ids, context=context) - - attachments = msg.get('attachments', {}) - self.history(cr, uid, ids, _('receive'), history=True, - subject = msg.get('subject'), - email = msg.get('to'), - details = msg.get('body'), - email_from = msg.get('from'), - email_cc = msg.get('cc'), - message_id = msg.get('message-id'), - references = msg.get('references', False) or msg.get('in-reply-to', False), - attach = attachments, - email_date = msg.get('date'), - body_html= msg.get('body_html'), - sub_type = msg.get('sub_type'), - headers = msg.get('headers'), - priority = msg.get('priority'), - context = context) + self.append_mail(cr, uid, [res_id], msg, context=context) return True def thread_followers(self, cr, uid, ids, context=None): diff --git a/addons/project_mailgate/project_mailgate_view.xml b/addons/project_mailgate/project_mailgate_view.xml index 8c8816ebbd5..f2c8c7006e3 100644 --- a/addons/project_mailgate/project_mailgate_view.xml +++ b/addons/project_mailgate/project_mailgate_view.xml @@ -19,15 +19,14 @@ <field name="date"/> <field name="email_to" widget="char" size="512"/> <field name="email_cc" widget="char" size="512"/> - <field name="name" colspan="4" widget="char" size="512"/> - <field name="history" invisible="1"/> + <field name="subject" colspan="4" widget="char" size="512"/> </group> <notebook colspan="4"> <page string="Details"> - <group attrs="{'invisible': [('history', '!=', True)]}"> - <field name="description" colspan="4" nolabel="1" height="250"/> + <group attrs="{'invisible': [('email_from', '=', False)]}"> + <field name="body_text" colspan="4" nolabel="1" height="250"/> </group> - <group attrs="{'invisible': [('history', '=', True)]}"> + <group attrs="{'invisible': [('email_from', '!=', False)]}"> <field name="display_text" colspan="4" nolabel="1" height="250"/> </group> </page> diff --git a/addons/project_planning/wizard/email_compose_message.py b/addons/project_planning/wizard/email_compose_message.py index 6fd89bea634..fc905462b33 100644 --- a/addons/project_planning/wizard/email_compose_message.py +++ b/addons/project_planning/wizard/email_compose_message.py @@ -24,7 +24,7 @@ from osv import fields import tools class email_compose_message(osv.osv_memory): - _inherit = 'email.compose.message' + _inherit = 'mail.compose.message' def get_value(self, cr, uid, model, resource_id, context=None): ''' @@ -44,12 +44,11 @@ class email_compose_message(osv.osv_memory): 'subject' : data.name or False, 'email_to' : data.user_id.user_email or False, 'email_from' : data.user_id and data.user_id.address_id and data.user_id.address_id.email or False, - 'body' : '\n' + (tools.ustr(data.user_id.signature or '')), + 'body_text' : '\n' + (tools.ustr(data.user_id.signature or '')), 'model': model, 'res_id': resource_id, }) return result -email_compose_message() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project_scrum/project_scrum.py b/addons/project_scrum/project_scrum.py index bbd1963d50a..f0db98294e7 100644 --- a/addons/project_scrum/project_scrum.py +++ b/addons/project_scrum/project_scrum.py @@ -317,7 +317,7 @@ class project_scrum_meeting(osv.osv): return True def email_send(self, cr, uid, ids, email, context=None): - email_message_obj = self.pool.get('email.message') + mail_message_obj = self.pool.get('mail.message') meeting_id = self.browse(cr, uid, ids, context=context)[0] user = self.pool.get('res.users').browse(cr, uid, uid, context=context) user_email = user.user_email or tools.config.get('email_from', False) @@ -325,7 +325,7 @@ class project_scrum_meeting(osv.osv): body += _('\n* Tasks since yesterday:\n_______________________\n%s\n\n* Task for Today:\n_______________________ \n%s\n\n* Blocks encountered:\n_______________________ \n\n%s') %(meeting_id.question_yesterday,meeting_id.question_today, meeting_id.question_blocks or _('No Blocks')) body += _("\n\nThank you,\n%s") % user.name sub_name = meeting_id.name or _('Scrum Meeting of %s') % meeting_id.date - flag = email_message_obj.schedule_with_attach(cr, uid, user_email , [email], sub_name, body, model='project.scrum.meeting', reply_to=None, openobject_id=str(meeting_id.id)) + flag = mail_message_obj.schedule_with_attach(cr, uid, user_email , [email], sub_name, body, model='project.scrum.meeting', res_id=meeting_id.id, context=context) if not flag: return False return True diff --git a/addons/project_scrum/wizard/email_compose_message.py b/addons/project_scrum/wizard/email_compose_message.py index 0eee41ae894..d3d23f42c45 100644 --- a/addons/project_scrum/wizard/email_compose_message.py +++ b/addons/project_scrum/wizard/email_compose_message.py @@ -24,7 +24,7 @@ from osv import fields from tools.translate import _ class email_compose_message(osv.osv_memory): - _inherit = 'email.compose.message' + _inherit = 'mail.compose.message' def get_value(self, cr, uid, model, resource_id, context=None): ''' @@ -55,12 +55,11 @@ class email_compose_message(osv.osv_memory): message = _("Hello , \nI am sending you Scrum Meeting : %s for the Sprint '%s' of Project '%s'") %(meeting.date, sprint.name, sprint.project_id.name) result.update({ 'subject': subject, - 'body': message, + 'body_text': message, 'model': model, 'res_id': resource_id }) return result -email_compose_message() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project_scrum/wizard/project_scrum_email.py b/addons/project_scrum/wizard/project_scrum_email.py index 63764c48794..f1d5b6665f7 100644 --- a/addons/project_scrum/wizard/project_scrum_email.py +++ b/addons/project_scrum/wizard/project_scrum_email.py @@ -69,7 +69,7 @@ class project_scrum_email(osv.osv_memory): if context is None: context = {} - email_message_obj = self.pool.get('email.message') + mail_message = self.pool.get('mail.message') active_id = context.get('active_id', False) scrum_meeting_pool = self.pool.get('project.scrum.meeting') user_pool = self.pool.get('res.users') @@ -101,8 +101,7 @@ 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.schedule_with_attach(cr, uid, user_email, [data.scrum_master_email], data.subject, body, model='project.scrum.email', reply_to=user_email) + mail_message.schedule_with_attach(cr, uid, user_email, [data.scrum_master_email], data.subject, body, reply_to=user_email, context=context) if data.product_owner_email: - email_message_obj.schedule_with_attach(cr, uid, user_email, [data.product_owner_email], data.subject, body, model='project.scrum.email', reply_to=user_email) + mail_message.schedule_with_attach(cr, uid, user_email, [data.product_owner_email], data.subject, body, reply_to=user_email, context=context) return {'type': 'ir.actions.act_window_close'} -project_scrum_email() diff --git a/addons/survey/wizard/survey_answer.py b/addons/survey/wizard/survey_answer.py index c42ddde157c..471290af2cb 100644 --- a/addons/survey/wizard/survey_answer.py +++ b/addons/survey/wizard/survey_answer.py @@ -61,7 +61,7 @@ class survey_question_wiz(osv.osv_memory): sur_response_obj = self.pool.get('survey.response') que_col_head = self.pool.get('survey.question.column.heading') user_obj = self.pool.get('res.users') - email_message_obj = self.pool.get('email.message') + mail_message = self.pool.get('mail.message') if context is None: context = {} if view_type in ['form']: @@ -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.schedule_with_attach(cr, uid, user_email, [resp_email], "Survey Answer Of " + str(user_name) , mail, model='survey.question.wiz', attach = attachments) + mail_message.schedule_with_attach(cr, uid, user_email, [resp_email], "Survey Answer Of " + str(user_name) , mail, attachments=attachments, context=context) xml_form = etree.Element('form', {'string': _('Complete Survey Answer')}) etree.SubElement(xml_form, 'separator', {'string': 'Complete Survey', 'colspan': "4"}) diff --git a/addons/survey/wizard/survey_send_invitation.py b/addons/survey/wizard/survey_send_invitation.py index 950bf009e75..e57c8f91d8b 100644 --- a/addons/survey/wizard/survey_send_invitation.py +++ b/addons/survey/wizard/survey_send_invitation.py @@ -102,7 +102,7 @@ class survey_send_invitation(osv.osv_memory): partner_ids = record['partner_ids'] user_ref= self.pool.get('res.users') survey_ref= self.pool.get('survey') - email_message_obj = self.pool.get('email.message') + mail_message = self.pool.get('mail.message') model_data_obj = self.pool.get('ir.model.data') group_id = model_data_obj._get_id(cr, uid, 'base', 'group_survey_user') @@ -152,8 +152,8 @@ 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.schedule_with_attach(cr, uid, record['mail_from'], [addr.email] , \ - record['mail_subject_existing'] , mail, model='survey.send.invitation') + mail_message.schedule_with_attach(cr, uid, record['mail_from'], [addr.email] , \ + record['mail_subject_existing'] , mail, context=context) existing+= "- %s (Login: %s, Password: %s)\n" % (user.name, addr.email, \ user.password) continue @@ -163,8 +163,8 @@ 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.schedule_with_attach(cr, uid, record['mail_from'], [addr.email],\ - record['mail_subject_existing'], mail, model='survey.send.invitation') + mail_message.schedule_with_attach(cr, uid, record['mail_from'], [addr.email],\ + record['mail_subject_existing'], mail, context=context) res_user+= "- %s (Login: %s, Password: %s)\n" % \ (user_email.name, user_email.login, user_email.password) continue @@ -176,8 +176,8 @@ 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.schedule_with_attach(cr, uid, record['mail_from'], [addr.email], \ - record['mail_subject'], mail, model='survey.send.invitation', attach = attachments) + ans = mail_message.schedule_with_attach(cr, uid, record['mail_from'], [addr.email], \ + record['mail_subject'], mail, attachments=attachments, context=context) if ans: res_data = {'name': addr.name or 'Unknown', diff --git a/addons/thunderbird/partner/partner.py b/addons/thunderbird/partner/partner.py index 21b8dd94484..1f79116c113 100644 --- a/addons/thunderbird/partner/partner.py +++ b/addons/thunderbird/partner/partner.py @@ -45,11 +45,11 @@ 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.message').parse_message(msg)
+ mail_message = self.pool.get('mail.message')
+ msg = mail_message.parse_message(msg)
subject = msg.get('Subject', False)
- thread_pool = self.pool.get('email.thread')
+ thread_pool = self.pool.get('mail.thread')
message_id = msg.get('message-id', False)
- msg_pool = self.pool.get('email.message')
msg_ids = []
res = {}
res_ids = []
@@ -59,7 +59,7 @@ class thunderbird_partner(osv.osv_memory): model = ref[0]
res_id = int(ref[1])
if message_id:
- msg_ids = msg_pool.search(cr, uid, [('message_id','=',message_id),('res_id','=',res_id),('model','=',model)])
+ msg_ids = mail_message.search(cr, uid, [('message_id','=',message_id),('res_id','=',res_id),('model','=',model)])
if msg_ids and len(msg_ids):
continue
if model not in obj_list:
@@ -88,21 +88,22 @@ class thunderbird_partner(osv.osv_memory): res['res_id'] = res_id
obj_attch.create(cr, uid, res)
threads = self.pool.get(model).browse(cr, uid, res_id)
- thread_pool.history(cr, uid, [threads], _('receive'), history=True,
+
+ thread_pool.history(cr, uid,
+ [threads],
subject = msg.get('subject'),
- email = msg.get('to'),
- details = msg.get('body'),
+ details = msg.get('body_text'),
+ email_to = msg.get('to'),
email_from = msg.get('from'),
email_cc = msg.get('cc'),
message_id = msg.get('message-id'),
references = msg.get('references', False) or msg.get('in-reply-to', False),
- attach = msg.get('attachments', {}),
+ attachments = msg.get('attachments', {}),
email_date = msg.get('date'),
body_html= msg.get('body_html'),
- sub_type = msg.get('sub_type'),
+ subtype = msg.get('subtype'),
headers = msg.get('headers'),
- reply = msg.get('reply'),
- priority = msg.get('priority'),)
+ reply_to = msg.get('reply'))
res_ids.append(res_id)
return len(res_ids)
@@ -110,7 +111,7 @@ class thunderbird_partner(osv.osv_memory): dictcreate = dict(vals)
model = str(dictcreate.get('model'))
message = dictcreate.get('message')
- return self.pool.get('email.thread').process_email(cr, uid, model, message, attach=True, context=None)
+ return self.pool.get('mail.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
@@ -118,26 +119,26 @@ class thunderbird_partner(osv.osv_memory): references = []
dictcreate = dict(message)
msg = dictcreate.get('message')
- msg = self.pool.get('email.message').parse_message(msg)
+ msg = self.pool.get('mail.message').parse_message(msg)
message_id = msg.get('message-id')
refs = msg.get('references',False)
references = False
if refs:
references = refs.split()
- msg_pool = self.pool.get('email.message')
+ mail_message = self.pool.get('mail.message')
model = ''
res_id = 0
if message_id:
- msg_ids = msg_pool.search(cr, uid, [('message_id','=',message_id)])
+ msg_ids = mail_message.search(cr, uid, [('message_id','=',message_id)])
if msg_ids and len(msg_ids):
- msg = msg_pool.browse(cr, uid, msg_ids[0])
+ msg = mail_message.browse(cr, uid, msg_ids[0])
model = msg.model
res_id = msg.res_id
else:
if references :
- msg_ids = msg_pool.search(cr, uid, [('message_id','in',references)])
+ msg_ids = mail_message.search(cr, uid, [('message_id','in',references)])
if msg_ids and len(msg_ids):
- msg = msg_pool.browse(cr, uid, msg_ids[0])
+ msg = mail_message.browse(cr, uid, msg_ids[0])
model = msg.model
res_id = msg.res_id
return (model,res_id)
|
