diff --git a/addons/crm/base_partner_merge.py b/addons/crm/base_partner_merge.py index 84038986396..560de0ecc51 100644 --- a/addons/crm/base_partner_merge.py +++ b/addons/crm/base_partner_merge.py @@ -300,6 +300,12 @@ class MergePartnerAutomatic(osv.TransientModel): 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.")) + child_ids = set() + for partner_id in partner_ids: + child_ids = child_ids.union(set(proxy.search(cr, uid, [('id', 'child_of', [partner_id])])) - set([partner_id])) + if set(partner_ids).intersection(child_ids): + raise osv.except_osv(_('Error'), _("You cannot merge a contact with one of his parent.")) + 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.")) diff --git a/addons/crm/i18n/crm.pot b/addons/crm/i18n/crm.pot index 310f7e5f9ef..40e330490f0 100644 --- a/addons/crm/i18n/crm.pot +++ b/addons/crm/i18n/crm.pot @@ -3056,6 +3056,12 @@ msgid "You are already at the top level of your sales-team category.\n" "Therefore you cannot escalate furthermore." msgstr "" +#. module: crm +#: code:addons/crm/base_partner_merge.py:310 +#, python-format +msgid "You cannot merge a contact with one of his parent." +msgstr "" + #. module: crm #: code:addons/crm/base_partner_merge.py:446 #, python-format