You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
724 B

8 years ago
8 years ago
  1. # -*- coding: utf-8 -*-
  2. # © 2017 Sunflower IT <http://sunflowerweb.nl>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from openerp import models, api
  5. class ResPartnerChanges(models.Model):
  6. _inherit = 'res.partner'
  7. @api.model
  8. def deduplicate_on_fields(self, fields_list, domain=None):
  9. """ Merge contacts """
  10. wizard_obj = self.env['base.partner.merge.automatic.wizard']
  11. if domain:
  12. wizard_obj = wizard_obj.with_context(partner_merge_domain=domain)
  13. params = {'state': 'option'}
  14. for field in fields_list:
  15. params['group_by_%s' % (field,)] = True
  16. wizard = wizard_obj.create(params)
  17. wizard.automatic_process_cb()