diff --git a/addons/crm/crm.py b/addons/crm/crm.py index cd3dd39a7e8..f25e4c1a0bf 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -440,6 +440,7 @@ class crm_case(object): @param context: A standard dictionary for contextual values """ + return self.remind_user(cr, uid, ids, context, attach, destination=False) @@ -448,50 +449,55 @@ class crm_case(object): @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 Remind user's IDs + @param ids: List of case's IDs to remind @param context: A standard dictionary for contextual values - """ for case in self.browse(cr, uid, ids, context=context): - if not case.section_id.reply_to: - raise osv.except_osv(_('Error!'), ("Reply To is not specified in the sales team")) - if not case.email_from: + if not destination and not case.email_from: raise osv.except_osv(_('Error!'), ("Partner Email is not specified in Case")) - if case.section_id.reply_to and case.email_from: - src = case.email_from - dest = case.section_id.reply_to - body = case.description or "" - if case.message_ids: - body = case.message_ids[0].description or "" - if not destination: - src, dest = dest, src - if body and case.user_id.signature: - if body: - body += '\n\n%s' % (case.user_id.signature) - else: - body = '\n\n%s' % (case.user_id.signature) + 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: + case_email = case.user_id.user_email - body = self.format_body(body) + src = case_email + dest = case.user_id + body = case.description or "" + if case.message_ids: + body = case.message_ids[0].description or "" + if not destination: + src, dest = dest, case.email_from + if body and case.user_id.signature: + if body: + body += '\n\n%s' % (case.user_id.signature) + else: + body = '\n\n%s' % (case.user_id.signature) - attach_to_send = None + body = self.format_body(body) - if attach: - attach_ids = self.pool.get('ir.attachment').search(cr, uid, [('res_model', '=', self._name), ('res_id', '=', case.id)]) - attach_to_send = self.pool.get('ir.attachment').read(cr, uid, attach_ids, ['datas_fname','datas']) - attach_to_send = map(lambda x: (x['datas_fname'], base64.decodestring(x['datas'])), attach_to_send) + attach_to_send = None + + if attach: + attach_ids = self.pool.get('ir.attachment').search(cr, uid, [('res_model', '=', self._name), ('res_id', '=', case.id)]) + attach_to_send = self.pool.get('ir.attachment').read(cr, uid, attach_ids, ['datas_fname', 'datas']) + attach_to_send = map(lambda x: (x['datas_fname'], base64.decodestring(x['datas'])), attach_to_send) # Send an email - subject = "Reminder: [%s] %s" % (str(case.id), case.name, ) - tools.email_send( - src, - [dest], - subject, - body, - reply_to=case.section_id.reply_to, - openobject_id=str(case.id), - attach=attach_to_send - ) - self._history(cr, uid, [case], _('Send'), history=True, subject=subject, email=dest, details=body, email_from=src) + subject = "Reminder: [%s] %s" % (str(case.id), case.name,) + tools.email_send( + src, + [dest], + subject, + body, + reply_to=case.section_id.reply_to or '', + openobject_id=str(case.id), + attach=attach_to_send + ) + self._history(cr, uid, [case], _('Send'), history=True, subject=subject, email=dest, details=body, email_from=src) + return True def _check(self, cr, uid, ids=False, context=None): diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 4507baad2f7..30547807f7e 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -411,15 +411,11 @@ class crm_lead(crm_case, osv.osv): """ return True - def on_chnage_optin(self, cr, uid, ids, optin): - if optin: - return {'value':{'optin':optin,'optout':False}} - return {} + def on_change_optin(self, cr, uid, ids, optin): + return {'value':{'optin':optin,'optout':False}} - def on_chnage_optout(self, cr, uid, ids, optout): - if optout: - return {'value':{'optout':optout,'optin':False}} - return {} + def on_change_optout(self, cr, uid, ids, optout): + return {'value':{'optout':optout,'optin':False}} crm_lead() diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 607a7fed9ff..2ea72155dbe 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -169,8 +169,8 @@ - - + + diff --git a/addons/crm/crm_opportunity_view.xml b/addons/crm/crm_opportunity_view.xml index db8bf7eeb0c..9b87c64483e 100644 --- a/addons/crm/crm_opportunity_view.xml +++ b/addons/crm/crm_opportunity_view.xml @@ -131,8 +131,8 @@ - - + +