Browse Source

crm_deduplicate_by_website

===============================
Deduplicate Contacts by website
===============================

This module extends the criteria to match duplicated contacts using the field
website.

Usage
=====

To use this module, you need to:

* Go to *Sales > Tools > Deduplicate Contacts*.
* Mark "Website" in the section "Search duplicates based on duplicated data
  in".
* This criteria will be used for deduplicating.
12.0
Pedro M. Baeza 8 years ago
committed by OCA-git-bot
parent
commit
f0e9426c72
  1. 60
      partner_deduplicate_by_website/README.rst
  2. 4
      partner_deduplicate_by_website/__init__.py
  3. 20
      partner_deduplicate_by_website/__openerp__.py
  4. 22
      partner_deduplicate_by_website/i18n/es.po
  5. BIN
      partner_deduplicate_by_website/static/description/icon.png
  6. 111
      partner_deduplicate_by_website/static/description/icon.svg
  7. 4
      partner_deduplicate_by_website/tests/__init__.py
  8. 33
      partner_deduplicate_by_website/tests/test_crm_deduplicate_by_website.py
  9. 5
      partner_deduplicate_by_website/wizards/__init__.py
  10. 29
      partner_deduplicate_by_website/wizards/partner_merge.py
  11. 22
      partner_deduplicate_by_website/wizards/partner_merge_view.xml

60
partner_deduplicate_by_website/README.rst

@ -0,0 +1,60 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
===============================
Deduplicate Contacts by website
===============================
This module extends the criteria to match duplicated contacts using the field
website.
Usage
=====
To use this module, you need to:
#. Go to *Sales > Tools > Deduplicate Contacts*.
#. Mark "Website" in the section "Search duplicates based on duplicated data
in".
#. This criteria will be used for deduplicating.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/111/8.0
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/crm/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.
Credits
=======
Images
------
* `Arrow <https://openclipart.org/detail/131875/convergent>`_.
Contributors
------------
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.

4
partner_deduplicate_by_website/__init__.py

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import wizards

20
partner_deduplicate_by_website/__openerp__.py

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Pedro M. Baeza <pedro.baeza@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Deduplicate Contacts by Website",
"version": "8.0.1.0.0",
"category": "Tools",
"website": "https://www.tecnativa.com",
"author": "Tecnativa, "
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": [
"crm",
],
"data": [
'wizards/partner_merge_view.xml',
],
}

22
partner_deduplicate_by_website/i18n/es.po

@ -0,0 +1,22 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_deduplicate_by_website
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-06-09 08:13+0000\n"
"PO-Revision-Date: 2016-06-09 08:13+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: crm_deduplicate_by_website
#: field:base.partner.merge.automatic.wizard,group_by_website:0
msgid "Website"
msgstr "Sitio web"

BIN
partner_deduplicate_by_website/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 11 KiB

111
partner_deduplicate_by_website/static/description/icon.svg
File diff suppressed because it is too large
View File

4
partner_deduplicate_by_website/tests/__init__.py

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_crm_deduplicate_by_website

33
partner_deduplicate_by_website/tests/test_crm_deduplicate_by_website.py

@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Pedro M. Baeza <pedro.baeza@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests import common
from openerp.tools.safe_eval import safe_eval
class TestDeduplicateByWebsite(common.TransactionCase):
def setUp(self):
super(TestDeduplicateByWebsite, self).setUp()
self.partner_1 = self.env['res.partner'].create({
'name': 'Partner 1',
'website': 'www.test-deduplicate.com',
})
self.partner_2 = self.env['res.partner'].create({
'name': 'Partner 2',
'website': 'www.test-deduplicate.com',
})
def test_deduplicate_by_website(self):
wizard = self.env['base.partner.merge.automatic.wizard'].create({
'group_by_website': True,
})
wizard.start_process_cb()
found_match = False
for line in wizard.line_ids:
match_ids = safe_eval(line.aggr_ids)
if (self.partner_1.id in match_ids and
self.partner_2.id in match_ids):
found_match = True
break
self.assertTrue(found_match)

5
partner_deduplicate_by_website/wizards/__init__.py

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import partner_merge

29
partner_deduplicate_by_website/wizards/partner_merge.py

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Pedro M. Baeza <pedro.baeza@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import fields, models
class BasePartnerMergeAutomaticWizard(models.TransientModel):
_inherit = "base.partner.merge.automatic.wizard"
group_by_website = fields.Boolean('Website')
def _generate_query(self, fields, maximum_group=100):
"""Inject the additional criteria 'website IS NOT NULL' when needed.
There's no better way to do it, as there are no hooks for adding
this criteria regularly.
"""
query = super(BasePartnerMergeAutomaticWizard, self)._generate_query(
fields, maximum_group=maximum_group)
if 'website' in fields:
if 'WHERE' in query:
index = query.find('WHERE')
query = (query[:index + 6] + "website IS NOT NULL AND " +
query[index + 6:])
else:
index = query.find(' GROUP BY')
query = (query[:index] + " WHERE website IS NOT NULL" +
query[index:])
return query

22
partner_deduplicate_by_website/wizards/partner_merge_view.xml

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2016 Pedro M. Baeza <pedro.baeza@tecnativa.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<openerp>
<data>
<record id="base_partner_merge_automatic_wizard_form" model="ir.ui.view">
<field name="model">base.partner.merge.automatic.wizard</field>
<field name="inherit_id" ref="crm.base_partner_merge_automatic_wizard_form"/>
<field name="arch" type="xml">
<field name="group_by_parent_id" position="after">
<field name="group_by_website"/>
</field>
<xpath expr="//field[@name='partner_ids']/tree//field[@name='country_id']" position="after">
<field name="website"/>
</xpath>
</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save