[MERGE] Fwd-port 7.0 up to 783b9e1

This commit is contained in:
Olivier Dony 2014-07-11 11:51:06 +02:00
commit a9d2b65da5
6 changed files with 19 additions and 6 deletions

View File

@ -78,7 +78,11 @@ class sale_order_line(osv.osv):
if product:
product_res = self.pool.get('product.product').browse(cr, uid, product, context=context)
if product_res.event_ok:
res['value'].update({'event_type_id': product_res.event_type_id.id, 'event_ok':product_res.event_ok})
res['value'].update(event_type_id=product_res.event_type_id.id,
event_ok=product_res.event_ok)
else:
res['value'].update(event_type_id=False,
event_ok=False)
return res
def button_confirm(self, cr, uid, ids, context=None):

View File

@ -260,6 +260,7 @@ class hr_employee(osv.osv):
resource_ids = []
for employee in self.browse(cr, uid, ids, context=context):
resource_ids.append(employee.resource_id.id)
super(hr_employee, self).unlink(cr, uid, ids, context=context)
return self.pool.get('resource.resource').unlink(cr, uid, resource_ids, context=context)
def onchange_address_id(self, cr, uid, ids, address, context=None):

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
@ -166,6 +166,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

@ -1300,7 +1300,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

@ -3037,7 +3037,8 @@ class BaseModel(object):
m2m_tbl, col1, col2 = f._sql_names(self)
# do not create relations for custom fields as they do not belong to a module
# they will be automatically removed when dropping the corresponding ir.model.field
if not f.string.startswith('x_'):
# table name for custom relation all starts with x_, see __init__
if not m2m_tbl.startswith('x_'):
self._save_relation_table(cr, m2m_tbl)
cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (m2m_tbl,))
if not cr.dictfetchall():

View File

@ -498,10 +498,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: