[IMP] crm: partner merge wizard: prevent merging more than 3 contacts together + log note in partner history
bzr revid: odo@openerp.com-20130522115408-ef82getdyo2otg3q
This commit is contained in:
parent
a5bf0f3181
commit
8def4f274a
|
@ -286,6 +286,9 @@ class MergePartnerAutomatic(osv.TransientModel):
|
|||
if len(partner_ids) < 2:
|
||||
return
|
||||
|
||||
if len(partner_ids) > 3:
|
||||
raise osv.except_osv(_('Error'), _("For safety reasons, you cannot merge more than 3 contacts together. You can re-open the wizard several times if needed."))
|
||||
|
||||
if openerp.SUPERUSER_ID != uid and len(set(partner.email for partner in proxy.browse(cr, uid, partner_ids, context=context))) > 1:
|
||||
raise osv.except_osv(_('Error'), _("All contacts must have the same email. Only the Administrator can merge contacts with different emails."))
|
||||
|
||||
|
@ -309,7 +312,8 @@ class MergePartnerAutomatic(osv.TransientModel):
|
|||
call_it(self._update_values)
|
||||
|
||||
_logger.info('(uid = %s) merged the partners %r with %s', uid, list(map(operator.attrgetter('id'), src_partners)), dst_partner.id)
|
||||
|
||||
dst_partner.message_post(body='%s %s'%(_("Merged with the following partners:"), ", ".join('%s<%s>(ID %s)' % (p.name, p.email or 'n/a', p.id) for p in src_partners)))
|
||||
|
||||
for partner in src_partners:
|
||||
partner.unlink()
|
||||
|
||||
|
|
Loading…
Reference in New Issue