From 4f9bff9f69f329f1651f3bac0bf9f9de6c88cd65 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Thu, 9 Jun 2016 10:17:12 +0200 Subject: [PATCH] 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. --- partner_deduplicate_by_website/README.rst | 60 ++++++++++ partner_deduplicate_by_website/__init__.py | 4 + partner_deduplicate_by_website/__openerp__.py | 20 ++++ partner_deduplicate_by_website/i18n/es.po | 22 ++++ .../static/description/icon.png | Bin 0 -> 11304 bytes .../static/description/icon.svg | 111 ++++++++++++++++++ .../tests/__init__.py | 4 + .../tests/test_crm_deduplicate_by_website.py | 33 ++++++ .../wizards/__init__.py | 5 + .../wizards/partner_merge.py | 29 +++++ .../wizards/partner_merge_view.xml | 22 ++++ 11 files changed, 310 insertions(+) create mode 100644 partner_deduplicate_by_website/README.rst create mode 100644 partner_deduplicate_by_website/__init__.py create mode 100644 partner_deduplicate_by_website/__openerp__.py create mode 100644 partner_deduplicate_by_website/i18n/es.po create mode 100644 partner_deduplicate_by_website/static/description/icon.png create mode 100644 partner_deduplicate_by_website/static/description/icon.svg create mode 100644 partner_deduplicate_by_website/tests/__init__.py create mode 100644 partner_deduplicate_by_website/tests/test_crm_deduplicate_by_website.py create mode 100644 partner_deduplicate_by_website/wizards/__init__.py create mode 100644 partner_deduplicate_by_website/wizards/partner_merge.py create mode 100644 partner_deduplicate_by_website/wizards/partner_merge_view.xml diff --git a/partner_deduplicate_by_website/README.rst b/partner_deduplicate_by_website/README.rst new file mode 100644 index 000000000..58ea0d56d --- /dev/null +++ b/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 +`_. 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 `_. + +Contributors +------------ + +* Pedro M. Baeza + +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. diff --git a/partner_deduplicate_by_website/__init__.py b/partner_deduplicate_by_website/__init__.py new file mode 100644 index 000000000..f8944f05c --- /dev/null +++ b/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 diff --git a/partner_deduplicate_by_website/__openerp__.py b/partner_deduplicate_by_website/__openerp__.py new file mode 100644 index 000000000..811dc48f1 --- /dev/null +++ b/partner_deduplicate_by_website/__openerp__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 Pedro M. Baeza +# 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', + ], +} diff --git a/partner_deduplicate_by_website/i18n/es.po b/partner_deduplicate_by_website/i18n/es.po new file mode 100644 index 000000000..8df9a361a --- /dev/null +++ b/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" + diff --git a/partner_deduplicate_by_website/static/description/icon.png b/partner_deduplicate_by_website/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..1f1ca2b0ef723d3dbe1d1b228d067c8aed07a18b GIT binary patch literal 11304 zcmYLPWmFtZupL~2>!OP#5P}AGcP9|sEd+Oh2PZ5R+%1bsu*D_85(w^2Ah5W*zWv_& z@%o&Z9y>EN-Bq`4RdtM}x&kgXB{l#6xJrt$+K4{nzYP-|vF{bP7)Erc9@0uWn1~jD zX&sF?$8uFP@IX92_uqyj&64elxJcnCr|Y7hHii6laW`N|JY&I$_O4dh)l^bOa*vpNwCZ(95bqDD=){a zVas5(0kRulx+?<(s^(i80nL%1>)ag3pP3s& zo^MI;D+Mx&YV%P~uEh6pk<5tzq@GEeeWa>Ig+~pfjOyC+yIRV4G}mukcu4aA48_+P ze2I_bn$;C#)Z9v0f+DD8#))wP`=7xw=*bnAF|#D3eOLa}lV(FMClS)4lKf=zK1w@V*=$2;Q08{(WC&cemP@ za1Um=>K{RgTiXk^Lk8(?J^haHBkCzd^3~nTO=&UB^L3$A4)^IV1t6#=WFaGW?RM|W zeb_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iL{TxbTGn*2W3JN@%;HZ5w>gB6kS2L}%Mi(ntSDtN zI++OGp(@*MJC^qde>xhJ-0bZGHs6&`KbL5iD-)m|s-&@HzC{?ImDtz|lR2Bs!320R zv&K;p=6tIMGXe)zKf!6zqo3lry^#nBtssbHFoeIch+nyOHtf6vjwMK!AZrKR`bZqR_PbyWb7la3ljEwMF4d4jFb39nmhi?(8ixFh~iwm7P-_@k~an{I% zCNaE687lpPjICfZK_c&ct*OcHEq8K++C-fO1q`?$3bfr%UfpXP`S$T~B5QL*ShVSt^!J`KV>{S8Gto1)XQFX$t3-fFE}h zq!94HlRi9y@7*2gw(crAX5_Z)HkdlRmB)+;cNeNCFE8A$?KVYNuL&Z?$mE@;p_Cs> zx)gQU`~=U{+x_iah)6e#x43QYyfM4|@@LDvzsX^aR%o7vLjKqd@sZX4!VT*22{1c5 z`}F+0B4VWQw$5)Y%${XJHQH*7ZhmV7O&+fMTwb2vKJ~8M-Z4=zGP}wz;Wqm+g!k!>*N_}{4Z@SfB3y1VpT7o MB&RN0BW)h~KS#pPWB>pF literal 0 HcmV?d00001 diff --git a/partner_deduplicate_by_website/static/description/icon.svg b/partner_deduplicate_by_website/static/description/icon.svg new file mode 100644 index 000000000..39edf7d05 --- /dev/null +++ b/partner_deduplicate_by_website/static/description/icon.svg @@ -0,0 +1,111 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/partner_deduplicate_by_website/tests/__init__.py b/partner_deduplicate_by_website/tests/__init__.py new file mode 100644 index 000000000..fd9064d3e --- /dev/null +++ b/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 diff --git a/partner_deduplicate_by_website/tests/test_crm_deduplicate_by_website.py b/partner_deduplicate_by_website/tests/test_crm_deduplicate_by_website.py new file mode 100644 index 000000000..e34e1f0f6 --- /dev/null +++ b/partner_deduplicate_by_website/tests/test_crm_deduplicate_by_website.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 Pedro M. Baeza +# 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) diff --git a/partner_deduplicate_by_website/wizards/__init__.py b/partner_deduplicate_by_website/wizards/__init__.py new file mode 100644 index 000000000..c93eadfed --- /dev/null +++ b/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 diff --git a/partner_deduplicate_by_website/wizards/partner_merge.py b/partner_deduplicate_by_website/wizards/partner_merge.py new file mode 100644 index 000000000..2e5388eeb --- /dev/null +++ b/partner_deduplicate_by_website/wizards/partner_merge.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 Pedro M. Baeza +# 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 diff --git a/partner_deduplicate_by_website/wizards/partner_merge_view.xml b/partner_deduplicate_by_website/wizards/partner_merge_view.xml new file mode 100644 index 000000000..ad081ac89 --- /dev/null +++ b/partner_deduplicate_by_website/wizards/partner_merge_view.xml @@ -0,0 +1,22 @@ + + + + + + + + base.partner.merge.automatic.wizard + + + + + + + + + + + + +