diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 0ecfdca357e..491784682f2 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -248,7 +248,7 @@ and users by email"), def message_new(self, cr, uid, msg, context): """ 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 @@ -260,7 +260,7 @@ and users by email"), body = msg.get('body') msg_from = msg.get('from') priority = msg.get('priority') - + vals = { 'name': subject, 'email_from': msg_from, @@ -270,13 +270,13 @@ and users by email"), } if msg.get('priority', False): vals['priority'] = priority - - res = mailgate_pool.get_partner(cr, uid, msg.get('from')) + + res = mailgate_pool.get_partner(cr, uid, msg.get('from') or msg.get_unixfrom()) if res: vals.update(res) res = self.create(cr, uid, vals, context) - - + + attachents = msg.get('attachments', []) for attactment in attachents or []: data_attach = { @@ -292,21 +292,18 @@ and users by email"), return res def message_update(self, cr, uid, ids, vals={}, msg="", default_act='pending', context={}): - """ + """ @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'] - }) - if msg.get('priority', False): + if msg.get('priority'): vals['priority'] = msg.get('priority') maps = { @@ -314,14 +311,14 @@ and users by email"), 'revenue': 'planned_revenue', 'probability':'probability' } - vls = { } + vls = {} for line in msg['body'].split('\n'): line = line.strip() res = tools.misc.command_re.match(line) - if res and maps.get(res.group(1).lower(), False): + if res and maps.get(res.group(1).lower()): key = maps.get(res.group(1).lower()) vls[key] = res.group(2).lower() - + vals.update(vls) res = self.write(cr, uid, ids, vals) return res diff --git a/addons/crm/wizard/crm_send_email.py b/addons/crm/wizard/crm_send_email.py index 3f6aacc0f39..d48f56239e4 100644 --- a/addons/crm/wizard/crm_send_email.py +++ b/addons/crm/wizard/crm_send_email.py @@ -107,12 +107,13 @@ class crm_send_new_email(osv.osv_memory): body = obj.text body = case_pool.format_body(body) - email_from = getattr(obj, 'email_from', False) + email_from = getattr(obj, 'email_from', False) + x_headers = {} if message_id: x_headers['References'] = "%s" % (message_id) flag = False - + flag = tools.email_send( email_from, emails, diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index a015ef81418..0ca89a5bbb8 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -232,7 +232,7 @@ class email_template(osv.osv): template_obj = self.browse(cr, uid, ids)[0] src_obj = template_obj.object_name.model vals['ref_ir_act_window'] = self.pool.get('ir.actions.act_window').create(cr, uid, { - 'name': _("%s Mail Form") % template_obj.name, + 'name': template_obj.name, 'type': 'ir.actions.act_window', 'res_model': 'email_template.send.wizard', 'src_model': src_obj, diff --git a/addons/email_template/email_template_view.xml b/addons/email_template/email_template_view.xml index c6eb3757604..3346c6c6162 100644 --- a/addons/email_template/email_template_view.xml +++ b/addons/email_template/email_template_view.xml @@ -108,15 +108,18 @@ - - - - - + +