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 @@ 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, 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 = '
'.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 similarity index 95% rename from addons/crm/wizard/email_compose_message.py rename to 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 @@ -