diff --git a/partner_deduplicate_filter/README.rst b/partner_deduplicate_filter/README.rst new file mode 100644 index 000000000..80a21c595 --- /dev/null +++ b/partner_deduplicate_filter/README.rst @@ -0,0 +1,91 @@ +====================================== +Exclude records from the deduplication +====================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpartner--contact-lightgray.png?logo=github + :target: https://github.com/OCA/partner-contact/tree/12.0/partner_deduplicate_filter + :alt: OCA/partner-contact +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/partner-contact-12-0/partner-contact-12-0-partner_deduplicate_filter + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/134/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the possibilities of the contact deduplication allowing +to filter the applicable set according to several criteria. + +For now, only the filter for restricting the deduplication to only companies or +only contacts is implemented. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +#. Go to *CRM/Sales > Tools > Deduplicate Contacts*. +#. Mark "'Is a company?' field selected", "Parent company not set" or + "Parent company set (Contacts)" in the section 'Exclude contacts having'. +#. This criteria will be used for excluding in the deduplication the selected + kind of records. + +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* Pedro M. Baeza +* Vicent Cubells +* Luis M. Ontalba +* Victor M.M. Torres + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +This module is part of the `OCA/partner-contact `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/partner_deduplicate_filter/__init__.py b/partner_deduplicate_filter/__init__.py new file mode 100644 index 000000000..2d2a05ce9 --- /dev/null +++ b/partner_deduplicate_filter/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import wizards diff --git a/partner_deduplicate_filter/__manifest__.py b/partner_deduplicate_filter/__manifest__.py new file mode 100644 index 000000000..a4d455b2e --- /dev/null +++ b/partner_deduplicate_filter/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2016 Pedro M. Baeza +# Copyright 2017 Vicent Cubells +# Copyright 2019 Victor M.M Torres +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "Exclude records from the deduplication", + "version": "12.0.1.0.0", + "category": "Tools", + "website": "https://github.com/OCA/partner-contact", + "author": "Tecnativa, " + "Odoo Community Association (OCA)", + "license": "AGPL-3", + "installable": True, + "depends": [ + "partner_deduplicate_acl", + ], + "data": [ + 'wizards/partner_merge_view.xml', + ], +} diff --git a/partner_deduplicate_filter/i18n/crm_deduplicate_filter.pot b/partner_deduplicate_filter/i18n/crm_deduplicate_filter.pot new file mode 100644 index 000000000..a93b58c2d --- /dev/null +++ b/partner_deduplicate_filter/i18n/crm_deduplicate_filter.pot @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_deduplicate_filter +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \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: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_is_company +msgid "'Is a company?' field selected" +msgstr "" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_not_parent +msgid "Parent company not set" +msgstr "" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_parent +msgid "Parent company set (Contacts)" +msgstr "" + +#. module: partner_deduplicate_filter +#: model:ir.model,name:partner_deduplicate_filter.model_base_partner_merge_automatic_wizard +msgid "base.partner.merge.automatic.wizard" +msgstr "" + diff --git a/partner_deduplicate_filter/i18n/de.po b/partner_deduplicate_filter/i18n/de.po new file mode 100644 index 000000000..3b01487ee --- /dev/null +++ b/partner_deduplicate_filter/i18n/de.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_deduplicate_filter +# +# Translators: +# Rudolf Schnapka , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-03-28 02:27+0000\n" +"PO-Revision-Date: 2017-03-28 02:27+0000\n" +"Last-Translator: Rudolf Schnapka , 2017\n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_is_company +msgid "'Is a company?' field selected" +msgstr "'Ist Unternehmen'-Feld ausgewählt" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_not_parent +msgid "Parent company not set" +msgstr "Übergeordnetes Unternehmen nicht gepflegt" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_parent +msgid "Parent company set (Contacts)" +msgstr "Übergeordnetes Unternehmen gesetzt (Kontakte)" + +#. module: partner_deduplicate_filter +#: model:ir.model,name:partner_deduplicate_filter.model_base_partner_merge_automatic_wizard +msgid "base.partner.merge.automatic.wizard" +msgstr "base.partner.merge.automatic.wizard" diff --git a/partner_deduplicate_filter/i18n/es.po b/partner_deduplicate_filter/i18n/es.po new file mode 100644 index 000000000..a1ee473a1 --- /dev/null +++ b/partner_deduplicate_filter/i18n/es.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_deduplicate_filter +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-03-28 02:27+0000\n" +"PO-Revision-Date: 2017-03-28 02:27+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_is_company +msgid "'Is a company?' field selected" +msgstr "El campo '¿Es una compañía?' seleccionado" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_not_parent +msgid "Parent company not set" +msgstr "La compañía padre no establecida" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_parent +msgid "Parent company set (Contacts)" +msgstr "La compañía padre establecida (Contactos)" + +#. module: partner_deduplicate_filter +#: model:ir.model,name:partner_deduplicate_filter.model_base_partner_merge_automatic_wizard +msgid "base.partner.merge.automatic.wizard" +msgstr "base.partner.merge.automatic.wizard" diff --git a/partner_deduplicate_filter/i18n/hr.po b/partner_deduplicate_filter/i18n/hr.po new file mode 100644 index 000000000..fcb307ebb --- /dev/null +++ b/partner_deduplicate_filter/i18n/hr.po @@ -0,0 +1,40 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_deduplicate_filter +# +# Translators: +# Bole , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-08 01:22+0000\n" +"PO-Revision-Date: 2017-07-08 01:22+0000\n" +"Last-Translator: Bole , 2017\n" +"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" +"Language: hr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_is_company +msgid "'Is a company?' field selected" +msgstr "" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_not_parent +msgid "Parent company not set" +msgstr "" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_parent +msgid "Parent company set (Contacts)" +msgstr "" + +#. module: partner_deduplicate_filter +#: model:ir.model,name:partner_deduplicate_filter.model_base_partner_merge_automatic_wizard +msgid "base.partner.merge.automatic.wizard" +msgstr "base.partner.merge.automatic.wizard" diff --git a/partner_deduplicate_filter/i18n/nl_NL.po b/partner_deduplicate_filter/i18n/nl_NL.po new file mode 100644 index 000000000..7e0c7229d --- /dev/null +++ b/partner_deduplicate_filter/i18n/nl_NL.po @@ -0,0 +1,40 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_deduplicate_filter +# +# Translators: +# Peter Hageman , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-09 08:00+0000\n" +"PO-Revision-Date: 2017-06-09 08:00+0000\n" +"Last-Translator: Peter Hageman , 2017\n" +"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/" +"teams/23907/nl_NL/)\n" +"Language: nl_NL\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_is_company +msgid "'Is a company?' field selected" +msgstr "'Is een bedrijf?' veld geselecteerd" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_not_parent +msgid "Parent company not set" +msgstr "Moederbedrijf niet ingesteld" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_parent +msgid "Parent company set (Contacts)" +msgstr "" + +#. module: partner_deduplicate_filter +#: model:ir.model,name:partner_deduplicate_filter.model_base_partner_merge_automatic_wizard +msgid "base.partner.merge.automatic.wizard" +msgstr "base.partner.merge.automatic.wizard" diff --git a/partner_deduplicate_filter/i18n/sk.po b/partner_deduplicate_filter/i18n/sk.po new file mode 100644 index 000000000..2fd7556ca --- /dev/null +++ b/partner_deduplicate_filter/i18n/sk.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_deduplicate_filter +# +# Translators: +# gebri , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-03-28 02:27+0000\n" +"PO-Revision-Date: 2017-03-28 02:27+0000\n" +"Last-Translator: gebri , 2017\n" +"Language-Team: Slovak (https://www.transifex.com/oca/teams/23907/sk/)\n" +"Language: sk\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_is_company +msgid "'Is a company?' field selected" +msgstr "" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_not_parent +msgid "Parent company not set" +msgstr "" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_parent +msgid "Parent company set (Contacts)" +msgstr "" + +#. module: partner_deduplicate_filter +#: model:ir.model,name:partner_deduplicate_filter.model_base_partner_merge_automatic_wizard +msgid "base.partner.merge.automatic.wizard" +msgstr "base.partner.merge.automatic.wizard" diff --git a/partner_deduplicate_filter/i18n/sl.po b/partner_deduplicate_filter/i18n/sl.po new file mode 100644 index 000000000..ab073d0a3 --- /dev/null +++ b/partner_deduplicate_filter/i18n/sl.po @@ -0,0 +1,40 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_deduplicate_filter +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-03-28 02:27+0000\n" +"PO-Revision-Date: 2017-03-28 02:27+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" +"%100==4 ? 2 : 3);\n" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_is_company +msgid "'Is a company?' field selected" +msgstr "Polje 'Je pravna oseba' izbrano" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_not_parent +msgid "Parent company not set" +msgstr "Nadrejena družba ni nastavljena." + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_parent +msgid "Parent company set (Contacts)" +msgstr "Nadrejena družba nastavljena (stiki)" + +#. module: partner_deduplicate_filter +#: model:ir.model,name:partner_deduplicate_filter.model_base_partner_merge_automatic_wizard +msgid "base.partner.merge.automatic.wizard" +msgstr "" diff --git a/partner_deduplicate_filter/i18n/tr.po b/partner_deduplicate_filter/i18n/tr.po new file mode 100644 index 000000000..e2902430a --- /dev/null +++ b/partner_deduplicate_filter/i18n/tr.po @@ -0,0 +1,40 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_deduplicate_filter +# +# Translators: +# OCA Transbot , 2017 +# Ediz Duman , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-10 03:36+0000\n" +"PO-Revision-Date: 2017-06-10 03:36+0000\n" +"Last-Translator: Ediz Duman , 2017\n" +"Language-Team: Turkish (https://www.transifex.com/oca/teams/23907/tr/)\n" +"Language: tr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_is_company +msgid "'Is a company?' field selected" +msgstr "' Bu bir şirket mi? ' Alanı seçili ise" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_not_parent +msgid "Parent company not set" +msgstr "Üst firma Ayarlanmamışsa" + +#. module: partner_deduplicate_filter +#: model:ir.model.fields,field_description:partner_deduplicate_filter.field_base_partner_merge_automatic_wizard_exclude_parent +msgid "Parent company set (Contacts)" +msgstr "" + +#. module: partner_deduplicate_filter +#: model:ir.model,name:partner_deduplicate_filter.model_base_partner_merge_automatic_wizard +msgid "base.partner.merge.automatic.wizard" +msgstr "base.partner.merge.automatic.wizard" diff --git a/partner_deduplicate_filter/readme/CONTRIBUTORS.rst b/partner_deduplicate_filter/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..2b4f7c7a9 --- /dev/null +++ b/partner_deduplicate_filter/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* Pedro M. Baeza +* Vicent Cubells +* Luis M. Ontalba +* Victor M.M. Torres diff --git a/partner_deduplicate_filter/readme/DESCRIPTION.rst b/partner_deduplicate_filter/readme/DESCRIPTION.rst new file mode 100644 index 000000000..5264f9b5a --- /dev/null +++ b/partner_deduplicate_filter/readme/DESCRIPTION.rst @@ -0,0 +1,5 @@ +This module extends the possibilities of the contact deduplication allowing +to filter the applicable set according to several criteria. + +For now, only the filter for restricting the deduplication to only companies or +only contacts is implemented. diff --git a/partner_deduplicate_filter/readme/USAGE.rst b/partner_deduplicate_filter/readme/USAGE.rst new file mode 100644 index 000000000..3e9f84b9c --- /dev/null +++ b/partner_deduplicate_filter/readme/USAGE.rst @@ -0,0 +1,7 @@ +To use this module, you need to: + +#. Go to *CRM/Sales > Tools > Deduplicate Contacts*. +#. Mark "'Is a company?' field selected", "Parent company not set" or + "Parent company set (Contacts)" in the section 'Exclude contacts having'. +#. This criteria will be used for excluding in the deduplication the selected + kind of records. diff --git a/partner_deduplicate_filter/static/description/icon.png b/partner_deduplicate_filter/static/description/icon.png new file mode 100644 index 000000000..49b724769 Binary files /dev/null and b/partner_deduplicate_filter/static/description/icon.png differ diff --git a/partner_deduplicate_filter/static/description/icon.svg b/partner_deduplicate_filter/static/description/icon.svg new file mode 100644 index 000000000..7ba20919f --- /dev/null +++ b/partner_deduplicate_filter/static/description/icon.svg @@ -0,0 +1,102 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/partner_deduplicate_filter/static/description/index.html b/partner_deduplicate_filter/static/description/index.html new file mode 100644 index 000000000..bd45cf39e --- /dev/null +++ b/partner_deduplicate_filter/static/description/index.html @@ -0,0 +1,437 @@ + + + + + + +Exclude records from the deduplication + + + +
+

Exclude records from the deduplication

+ + +

Beta License: AGPL-3 OCA/partner-contact Translate me on Weblate Try me on Runbot

+

This module extends the possibilities of the contact deduplication allowing +to filter the applicable set according to several criteria.

+

For now, only the filter for restricting the deduplication to only companies or +only contacts is implemented.

+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  1. Go to CRM/Sales > Tools > Deduplicate Contacts.
  2. +
  3. Mark “‘Is a company?’ field selected”, “Parent company not set” or +“Parent company set (Contacts)” in the section ‘Exclude contacts having’.
  4. +
  5. This criteria will be used for excluding in the deduplication the selected +kind of records.
  6. +
+
+
+

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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

This module is part of the OCA/partner-contact project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/partner_deduplicate_filter/tests/__init__.py b/partner_deduplicate_filter/tests/__init__.py new file mode 100644 index 000000000..074c33e2e --- /dev/null +++ b/partner_deduplicate_filter/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import test_partner_deduplicate_filter diff --git a/partner_deduplicate_filter/tests/test_partner_deduplicate_filter.py b/partner_deduplicate_filter/tests/test_partner_deduplicate_filter.py new file mode 100644 index 000000000..bf9d2dd8e --- /dev/null +++ b/partner_deduplicate_filter/tests/test_partner_deduplicate_filter.py @@ -0,0 +1,76 @@ +# Copyright 2016 Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo.tests import common +from odoo.tools.safe_eval import safe_eval + + +class TestDeduplicateFilter(common.TransactionCase): + def setUp(self): + super(TestDeduplicateFilter, self).setUp() + self.partner_1 = self.env['res.partner'].create({ + 'name': 'Partner 1', + 'email': 'partner1@example.org', + 'is_company': True, + 'parent_id': False, + }) + self.partner_1.copy() + self.partner_2 = self.env['res.partner'].create({ + 'name': 'Partner 2', + 'email': 'partner2@example.org', + 'is_company': False, + 'parent_id': self.partner_1.id, + }) + self.partner_2.copy() + self.partner_3 = self.env['res.partner'].create({ + 'name': 'Partner 3', + 'email': 'partner3@example.org', + 'is_company': False, + 'parent_id': False, + }) + self.partner_3.copy() + self.wizard = self.env['base.partner.merge.automatic.wizard'].create({ + 'group_by_email': True, + }) + + def test_deduplicate_exclude_is_company(self): + self.wizard.exclude_is_company = True + self.wizard.action_start_manual_process() + matched_founds = 0 + for line in self.wizard.line_ids: + match_ids = safe_eval(line.aggr_ids) + if self.partner_1.id in match_ids: + self.assertTrue(False, 'Partner with is company not excluded') + if self.partner_2.id in match_ids: + matched_founds += 1 + if self.partner_3.id in match_ids: + matched_founds += 1 + self.assertEqual(matched_founds, 2) + + def test_deduplicate_exclude_not_parent(self): + self.wizard.exclude_not_parent = True + self.wizard.action_start_manual_process() + matched_founds = 0 + for line in self.wizard.line_ids: + match_ids = safe_eval(line.aggr_ids) + if self.partner_1.id in match_ids: + self.assertTrue(False, 'Partner without parent not excluded') + if self.partner_3.id in match_ids: + self.assertTrue(False, 'Partner without parent not excluded') + if self.partner_2.id in match_ids: + matched_founds += 1 + self.assertEqual(matched_founds, 1) + + def test_deduplicate_exclude_parent(self): + self.wizard.exclude_parent = True + self.wizard.action_start_manual_process() + matched_founds = 0 + for line in self.wizard.line_ids: + match_ids = safe_eval(line.aggr_ids) + if self.partner_2.id in match_ids: + self.assertTrue(False, 'Partner with parent not excluded') + if self.partner_1.id in match_ids: + matched_founds += 1 + if self.partner_3.id in match_ids: + matched_founds += 1 + self.assertEqual(matched_founds, 2) diff --git a/partner_deduplicate_filter/wizards/__init__.py b/partner_deduplicate_filter/wizards/__init__.py new file mode 100644 index 000000000..fa92260c9 --- /dev/null +++ b/partner_deduplicate_filter/wizards/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import partner_merge diff --git a/partner_deduplicate_filter/wizards/partner_merge.py b/partner_deduplicate_filter/wizards/partner_merge.py new file mode 100644 index 000000000..beb1285fa --- /dev/null +++ b/partner_deduplicate_filter/wizards/partner_merge.py @@ -0,0 +1,34 @@ +# Copyright 2016 Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import api, fields, models + + +class BasePartnerMergeAutomaticWizard(models.TransientModel): + _inherit = "base.partner.merge.automatic.wizard" + + exclude_is_company = fields.Boolean("'Is a company?' field selected") + exclude_not_parent = fields.Boolean("Parent company not set") + exclude_parent = fields.Boolean("Parent company set (Contacts)") + + @api.multi + def _process_query(self, query): + if any([self.exclude_is_company, self.exclude_not_parent, + self.exclude_parent]): + filters = [] + if self.exclude_is_company: + filters.append("is_company = False") + if self.exclude_not_parent: + filters.append("parent_id IS NOT NULL") + if self.exclude_parent: + filters.append("parent_id IS NULL") + index_where = query.find('WHERE') + index_group_by = query.find('GROUP BY') + subquery = "%s" % ' AND '.join(filters) + if index_where > 0: + subquery = "AND (%s) " % subquery + else: # pragma: no cover + subquery = "WHERE %s " % subquery + query = query[:index_group_by] + subquery + query[index_group_by:] + return super(BasePartnerMergeAutomaticWizard, self)._process_query( + query) diff --git a/partner_deduplicate_filter/wizards/partner_merge_view.xml b/partner_deduplicate_filter/wizards/partner_merge_view.xml new file mode 100644 index 000000000..7d05cfcfb --- /dev/null +++ b/partner_deduplicate_filter/wizards/partner_merge_view.xml @@ -0,0 +1,21 @@ + + + + + + + base.partner.merge.automatic.wizard + + + + + + + + + + +