[FIX] Solve some mail issues which are currently present in 7.0

This commit is contained in:
Anand-Dharampuriya 2014-07-01 15:54:23 +05:30 committed by Thibault Delavallée
parent e6b6392f3a
commit 5cbc611361
3 changed files with 11 additions and 4 deletions

View File

@ -24,7 +24,7 @@ import openerp.tools as tools
from openerp.osv import osv
from openerp.osv import fields
from openerp import SUPERUSER_ID
from openerp.tools.translate import _
class mail_group(osv.Model):
""" A mail_group is a collection of users sharing messages in a discussion
@ -172,6 +172,12 @@ class mail_group(osv.Model):
mail_alias = self.pool.get('mail.alias')
alias_ids = [group.alias_id.id for group in groups if group.alias_id]
# Delete mail_group
try:
all_emp_group = self.pool['ir.model.data'].get_object_reference(cr, uid, 'mail', 'group_all_employees')[1]
except ValueError:
all_emp_group = None
if all_emp_group and all_emp_group in ids:
raise osv.except_osv(_('Warning!'), _('You cannot delete those groups, as the Whole Company group is required by other modules.'))
res = super(mail_group, self).unlink(cr, uid, ids, context=context)
# Delete alias
mail_alias.unlink(cr, SUPERUSER_ID, alias_ids, context=context)

View File

@ -951,7 +951,7 @@ class mail_thread(osv.AbstractModel):
return result
if partner and partner in obj.message_follower_ids: # recipient already in the followers -> skip
return result
if partner and partner in [val[0] for val in result[obj.id]]: # already existing partner ID -> skip
if partner and partner.id in [val[0] for val in result[obj.id]]: # already existing partner ID -> skip
return result
if partner and partner.email: # complete profile: id, name <email>
result[obj.id].append((partner.id, '%s<%s>' % (partner.name, partner.email), reason))

View File

@ -211,10 +211,11 @@ def html2plaintext(html, body_id=None, encoding='utf-8'):
html = re.sub('<br\s*/?>', '\n', html)
html = re.sub('<.*?>', ' ', html)
html = html.replace(' ' * 2, ' ')
html = html.replace('&gt;', '>')
html = html.replace('&lt;', '<')
# strip all lines
html = '\n'.join([x.strip() for x in html.splitlines()])
html = html.replace('\n' * 2, '\n')
html = ''.join([x.strip() for x in html.splitlines(True)])
for i, url in enumerate(url_index):
if i == 0: