Browse Source

[MIG] crm_deduplicate_acl: Migration to 11.0

* Don't overwrite code, but use inheritance system
* Add tests
pull/721/head
Pedro M. Baeza 6 years ago
parent
commit
e4f6966500
  1. 2
      partner_deduplicate_acl/README.rst
  2. 1
      partner_deduplicate_acl/__init__.py
  3. 11
      partner_deduplicate_acl/__manifest__.py
  4. 18
      partner_deduplicate_acl/i18n/de.po
  5. 18
      partner_deduplicate_acl/i18n/es.po
  6. 62
      partner_deduplicate_acl/i18n/hr.po
  7. 54
      partner_deduplicate_acl/i18n/nl_NL.po
  8. 56
      partner_deduplicate_acl/i18n/pt_BR.po
  9. 17
      partner_deduplicate_acl/i18n/sk.po
  10. 18
      partner_deduplicate_acl/i18n/sl.po
  11. 57
      partner_deduplicate_acl/i18n/tr.po
  12. 3
      partner_deduplicate_acl/models/__init__.py
  13. 16
      partner_deduplicate_acl/models/res_partner.py
  14. 3
      partner_deduplicate_acl/tests/__init__.py
  15. 50
      partner_deduplicate_acl/tests/test_crm_deduplicate_acl.py
  16. 6
      partner_deduplicate_acl/views/base_partner_merge_view.xml
  17. 1
      partner_deduplicate_acl/wizards/__init__.py
  18. 94
      partner_deduplicate_acl/wizards/partner_merge.py
  19. 7
      partner_deduplicate_acl/wizards/partner_merge_view.xml

2
partner_deduplicate_acl/README.rst

@ -46,7 +46,7 @@ To use this module, you need to:
.. 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/10.0
:target: https://runbot.odoo-community.org/runbot/111/11.0
Known issues / Roadmap
======================

1
partner_deduplicate_acl/__init__.py

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

11
partner_deduplicate_acl/__manifest__.py

@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
# © 2016 Tecnativa, S.L. - Jairo Llopis
# © 2016 Tecnativa, S.L. - Vicent Cubells
# Copyright 2016 Tecnativa - Jairo Llopis
# Copyright 2016 Tecnativa - Vicent Cubells
# Copyright 2017-2018 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Deduplicate Contacts ACL",
"summary": "Contact deduplication with fine-grained permission control",
"version": "10.0.1.0.0",
"version": "11.0.1.0.0",
"category": "Tools",
"website": "http://www.tecnativa.com",
"website": "https://github.com/OCA/crm",
"author": "Tecnativa, "
"Odoo Community Association (OCA)",
"license": "AGPL-3",

18
partner_deduplicate_acl/i18n/de.po

@ -3,15 +3,14 @@
# * crm_deduplicate_acl
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
# Rudolf Schnapka <rs@techno-flex.de>, 2017
# OCA Transbot <transbot@odoo-community.org>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 11.0\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 <rs@techno-flex.de>, 2017\n"
"POT-Creation-Date: 2018-05-03 02:51+0000\n"
"PO-Revision-Date: 2018-05-03 02:51+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2018\n"
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -24,6 +23,11 @@ msgstr ""
msgid "Automatically"
msgstr "Automatisch"
#. module: crm_deduplicate_acl
#: model:ir.model,name:crm_deduplicate_acl.model_res_partner
msgid "Contact"
msgstr ""
#. module: crm_deduplicate_acl
#: model:ir.module.category,name:crm_deduplicate_acl.category
#: model:ir.ui.menu,name:crm_deduplicate_acl.partner_merge_automatic_menu
@ -36,7 +40,7 @@ msgid "Manually"
msgstr "Manuell"
#. module: crm_deduplicate_acl
#: model:ir.ui.menu,name:crm_deduplicate_acl.root_menu
#: model:ir.ui.menu,name:crm_deduplicate_acl.crm_tools
msgid "Tools"
msgstr "Werkzeuge"

18
partner_deduplicate_acl/i18n/es.po

@ -3,14 +3,15 @@
# * crm_deduplicate_acl
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
# Pedro M. Baeza <pedro.baeza@gmail.com>, 2018
# OCA Transbot <transbot@odoo-community.org>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-03-16 03:45+0000\n"
"PO-Revision-Date: 2017-03-16 03:45+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
"POT-Creation-Date: 2018-05-03 02:51+0000\n"
"PO-Revision-Date: 2018-05-03 02:51+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2018\n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -23,6 +24,11 @@ msgstr ""
msgid "Automatically"
msgstr "Automáticamente"
#. module: crm_deduplicate_acl
#: model:ir.model,name:crm_deduplicate_acl.model_res_partner
msgid "Contact"
msgstr "Contacto"
#. module: crm_deduplicate_acl
#: model:ir.module.category,name:crm_deduplicate_acl.category
#: model:ir.ui.menu,name:crm_deduplicate_acl.partner_merge_automatic_menu
@ -35,7 +41,7 @@ msgid "Manually"
msgstr "Manualmente"
#. module: crm_deduplicate_acl
#: model:ir.ui.menu,name:crm_deduplicate_acl.root_menu
#: model:ir.ui.menu,name:crm_deduplicate_acl.crm_tools
msgid "Tools"
msgstr "Herramientas"

62
partner_deduplicate_acl/i18n/hr.po

@ -3,15 +3,14 @@
# * crm_deduplicate_acl
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
# Bole <bole@dajmi5.com>, 2017
# OCA Transbot <transbot@odoo-community.org>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 11.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 <bole@dajmi5.com>, 2017\n"
"POT-Creation-Date: 2018-05-03 02:51+0000\n"
"PO-Revision-Date: 2018-05-03 02:51+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2018\n"
"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -19,62 +18,29 @@ msgstr ""
"Language: hr\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: crm_deduplicate_acl
#: code:addons/crm_deduplicate_acl/wizards/partner_merge.py:46
#, python-format
msgid ""
"All contacts must have the same email. Only the Administrator can merge "
"contacts with different emails."
msgstr ""
"Svi kontakti moraju imati isti e-mail, samo administrator može spajati "
"kontakte sa različitim mailovima."
#. module: crm_deduplicate_acl
#: model:res.groups,name:crm_deduplicate_acl.group_automatically
msgid "Automatically"
msgstr "Automatski"
#. module: crm_deduplicate_acl
#: model:ir.model,name:crm_deduplicate_acl.model_res_partner
msgid "Contact"
msgstr ""
#. module: crm_deduplicate_acl
#: model:ir.module.category,name:crm_deduplicate_acl.category
#: model:ir.ui.menu,name:crm_deduplicate_acl.partner_merge_automatic_menu
msgid "Deduplicate Contacts"
msgstr "Ukloni duple kontakte"
#. module: crm_deduplicate_acl
#: code:addons/crm_deduplicate_acl/wizards/partner_merge.py:28
#, python-format
msgid ""
"For safety reasons, you cannot merge more than 3 contacts together. You can "
"re-open the wizard several times if needed."
msgstr ""
"Iz sigurnosnih razloga nije moguće spajati više od 3 kontakta. Možete "
"pokrenuti čarobnjaka za spajanje više puta ukoliko je potrebno."
#. module: crm_deduplicate_acl
#: model:res.groups,name:crm_deduplicate_acl.group_manually
msgid "Manually"
msgstr "Ručno"
#. module: crm_deduplicate_acl
#: code:addons/crm_deduplicate_acl/wizards/partner_merge.py:81
#, python-format
msgid "Merged with the following partners:"
msgstr "Spojen sa sljedećim partnerima:"
#. module: crm_deduplicate_acl
#: code:addons/crm_deduplicate_acl/wizards/partner_merge.py:69
#, python-format
msgid ""
"Only the destination contact may be linked to existing Journal Items. Please"
" ask the Administrator if you need to merge several contacts linked to "
"existing Journal Items."
msgstr ""
"Samo odredišni kontakt može biti povezan sa postojećim stavkama dnevnika. "
"Molimo zamolite administratora ukoliko je potrebno spojiti nekoliko "
"kontakata povezanih sa postojećim stavkama dnevnika."
#. module: crm_deduplicate_acl
#: model:ir.ui.menu,name:crm_deduplicate_acl.root_menu
#: model:ir.ui.menu,name:crm_deduplicate_acl.crm_tools
msgid "Tools"
msgstr "Alati"
@ -83,12 +49,6 @@ msgstr "Alati"
msgid "Without restrictions"
msgstr "Bez ograničenja"
#. module: crm_deduplicate_acl
#: code:addons/crm_deduplicate_acl/wizards/partner_merge.py:38
#, python-format
msgid "You cannot merge a contact with one of his parent."
msgstr "Nije moguće spojiti kontakt sa svojim nadređenim."
#. module: crm_deduplicate_acl
#: model:ir.model,name:crm_deduplicate_acl.model_base_partner_merge_automatic_wizard
msgid "base.partner.merge.automatic.wizard"

54
partner_deduplicate_acl/i18n/nl_NL.po

@ -3,14 +3,14 @@
# * crm_deduplicate_acl
#
# Translators:
# Peter Hageman <hageman.p@gmail.com>, 2017
# OCA Transbot <transbot@odoo-community.org>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-04 15:47+0000\n"
"PO-Revision-Date: 2017-12-04 15:47+0000\n"
"Last-Translator: Peter Hageman <hageman.p@gmail.com>, 2017\n"
"POT-Creation-Date: 2018-05-03 02:51+0000\n"
"PO-Revision-Date: 2018-05-03 02:51+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2018\n"
"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/teams/23907/nl_NL/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -18,55 +18,29 @@ msgstr ""
"Language: nl_NL\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: crm_deduplicate_acl
#: code:addons/crm_deduplicate_acl/wizards/partner_merge.py:46
#, python-format
msgid ""
"All contacts must have the same email. Only the Administrator can merge "
"contacts with different emails."
msgstr ""
#. module: crm_deduplicate_acl
#: model:res.groups,name:crm_deduplicate_acl.group_automatically
msgid "Automatically"
msgstr "Automatisch"
#. module: crm_deduplicate_acl
#: model:ir.model,name:crm_deduplicate_acl.model_res_partner
msgid "Contact"
msgstr ""
#. module: crm_deduplicate_acl
#: model:ir.module.category,name:crm_deduplicate_acl.category
#: model:ir.ui.menu,name:crm_deduplicate_acl.partner_merge_automatic_menu
msgid "Deduplicate Contacts"
msgstr "Ontdubbel Relaties"
#. module: crm_deduplicate_acl
#: code:addons/crm_deduplicate_acl/wizards/partner_merge.py:28
#, python-format
msgid ""
"For safety reasons, you cannot merge more than 3 contacts together. You can "
"re-open the wizard several times if needed."
msgstr ""
#. module: crm_deduplicate_acl
#: model:res.groups,name:crm_deduplicate_acl.group_manually
msgid "Manually"
msgstr "Handmatig"
#. module: crm_deduplicate_acl
#: code:addons/crm_deduplicate_acl/wizards/partner_merge.py:81
#, python-format
msgid "Merged with the following partners:"
msgstr "Samengevoegd met de volgende contacten:"
#. module: crm_deduplicate_acl
#: code:addons/crm_deduplicate_acl/wizards/partner_merge.py:69
#, python-format
msgid ""
"Only the destination contact may be linked to existing Journal Items. Please"
" ask the Administrator if you need to merge several contacts linked to "
"existing Journal Items."
msgstr ""
#. module: crm_deduplicate_acl
#: model:ir.ui.menu,name:crm_deduplicate_acl.root_menu
#: model:ir.ui.menu,name:crm_deduplicate_acl.crm_tools
msgid "Tools"
msgstr ""
@ -75,12 +49,6 @@ msgstr ""
msgid "Without restrictions"
msgstr "Zonder beperkingen"
#. module: crm_deduplicate_acl
#: code:addons/crm_deduplicate_acl/wizards/partner_merge.py:38
#, python-format
msgid "You cannot merge a contact with one of his parent."
msgstr "Je kan geen relatie samenvoegen met één van haar ouders."
#. module: crm_deduplicate_acl
#: model:ir.model,name:crm_deduplicate_acl.model_base_partner_merge_automatic_wizard
msgid "base.partner.merge.automatic.wizard"

56
partner_deduplicate_acl/i18n/pt_BR.po

@ -3,15 +3,15 @@
# * crm_deduplicate_acl
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
# falexandresilva <falexandresilva@gmail.com>, 2017
# falexandresilva <falexandresilva@gmail.com>, 2018
# OCA Transbot <transbot@odoo-community.org>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-06-19 02:41+0000\n"
"PO-Revision-Date: 2017-06-19 02:41+0000\n"
"Last-Translator: falexandresilva <falexandresilva@gmail.com>, 2017\n"
"POT-Creation-Date: 2018-05-03 02:51+0000\n"
"PO-Revision-Date: 2018-05-03 02:51+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2018\n"
"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/23907/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -19,55 +19,29 @@ msgstr ""
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: crm_deduplicate_acl
#: code:addons/crm_deduplicate_acl/wizards/partner_merge.py:46
#, python-format
msgid ""
"All contacts must have the same email. Only the Administrator can merge "
"contacts with different emails."
msgstr ""
#. module: crm_deduplicate_acl
#: model:res.groups,name:crm_deduplicate_acl.group_automatically
msgid "Automatically"
msgstr "Automaticamente"
#. module: crm_deduplicate_acl
#: model:ir.model,name:crm_deduplicate_acl.model_res_partner
msgid "Contact"
msgstr "Contato"
#. module: crm_deduplicate_acl
#: model:ir.module.category,name:crm_deduplicate_acl.category
#: model:ir.ui.menu,name:crm_deduplicate_acl.partner_merge_automatic_menu
msgid "Deduplicate Contacts"
msgstr "Deduplicar contatos"
#. module: crm_deduplicate_acl
#: code:addons/crm_deduplicate_acl/wizards/partner_merge.py:28
#, python-format
msgid ""
"For safety reasons, you cannot merge more than 3 contacts together. You can "
"re-open the wizard several times if needed."
msgstr ""
#. module: crm_deduplicate_acl
#: model:res.groups,name:crm_deduplicate_acl.group_manually
msgid "Manually"
msgstr "Manualmente"
#. module: crm_deduplicate_acl
#: code:addons/crm_deduplicate_acl/wizards/partner_merge.py:81
#, python-format
msgid "Merged with the following partners:"
msgstr ""
#. module: crm_deduplicate_acl
#: code:addons/crm_deduplicate_acl/wizards/partner_merge.py:69
#, python-format
msgid ""
"Only the destination contact may be linked to existing Journal Items. Please"
" ask the Administrator if you need to merge several contacts linked to "
"existing Journal Items."
msgstr ""
#. module: crm_deduplicate_acl
#: model:ir.ui.menu,name:crm_deduplicate_acl.root_menu
#: model:ir.ui.menu,name:crm_deduplicate_acl.crm_tools
msgid "Tools"
msgstr "Ferramentas"
@ -76,12 +50,6 @@ msgstr "Ferramentas"
msgid "Without restrictions"
msgstr "Sem restrições"
#. module: crm_deduplicate_acl
#: code:addons/crm_deduplicate_acl/wizards/partner_merge.py:38
#, python-format
msgid "You cannot merge a contact with one of his parent."
msgstr ""
#. module: crm_deduplicate_acl
#: model:ir.model,name:crm_deduplicate_acl.model_base_partner_merge_automatic_wizard
msgid "base.partner.merge.automatic.wizard"

17
partner_deduplicate_acl/i18n/sk.po

@ -3,14 +3,14 @@
# * crm_deduplicate_acl
#
# Translators:
# gebri <gebri@inmail.sk>, 2016
# OCA Transbot <transbot@odoo-community.org>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-17 01:29+0000\n"
"PO-Revision-Date: 2016-12-17 01:29+0000\n"
"Last-Translator: gebri <gebri@inmail.sk>, 2016\n"
"POT-Creation-Date: 2018-05-03 02:51+0000\n"
"PO-Revision-Date: 2018-05-03 02:51+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2018\n"
"Language-Team: Slovak (https://www.transifex.com/oca/teams/23907/sk/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -23,6 +23,11 @@ msgstr ""
msgid "Automatically"
msgstr "Automaticky"
#. module: crm_deduplicate_acl
#: model:ir.model,name:crm_deduplicate_acl.model_res_partner
msgid "Contact"
msgstr ""
#. module: crm_deduplicate_acl
#: model:ir.module.category,name:crm_deduplicate_acl.category
#: model:ir.ui.menu,name:crm_deduplicate_acl.partner_merge_automatic_menu
@ -35,7 +40,7 @@ msgid "Manually"
msgstr "Manuálne"
#. module: crm_deduplicate_acl
#: model:ir.ui.menu,name:crm_deduplicate_acl.root_menu
#: model:ir.ui.menu,name:crm_deduplicate_acl.crm_tools
msgid "Tools"
msgstr "Nástroje"

18
partner_deduplicate_acl/i18n/sl.po

@ -3,15 +3,14 @@
# * crm_deduplicate_acl
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
# Matjaž Mozetič <m.mozetic@matmoz.si>, 2016
# OCA Transbot <transbot@odoo-community.org>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-07 03:39+0000\n"
"PO-Revision-Date: 2016-12-07 03:39+0000\n"
"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>, 2016\n"
"POT-Creation-Date: 2018-05-03 02:51+0000\n"
"PO-Revision-Date: 2018-05-03 02:51+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2018\n"
"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -24,6 +23,11 @@ msgstr ""
msgid "Automatically"
msgstr "Samodejno"
#. module: crm_deduplicate_acl
#: model:ir.model,name:crm_deduplicate_acl.model_res_partner
msgid "Contact"
msgstr ""
#. module: crm_deduplicate_acl
#: model:ir.module.category,name:crm_deduplicate_acl.category
#: model:ir.ui.menu,name:crm_deduplicate_acl.partner_merge_automatic_menu
@ -36,7 +40,7 @@ msgid "Manually"
msgstr "Ročno"
#. module: crm_deduplicate_acl
#: model:ir.ui.menu,name:crm_deduplicate_acl.root_menu
#: model:ir.ui.menu,name:crm_deduplicate_acl.crm_tools
msgid "Tools"
msgstr "Orodja"

57
partner_deduplicate_acl/i18n/tr.po

@ -3,15 +3,14 @@
# * crm_deduplicate_acl
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
# Ediz Duman <neps1192@gmail.com>, 2017
# OCA Transbot <transbot@odoo-community.org>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 11.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 <neps1192@gmail.com>, 2017\n"
"POT-Creation-Date: 2018-05-03 02:51+0000\n"
"PO-Revision-Date: 2018-05-03 02:51+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2018\n"
"Language-Team: Turkish (https://www.transifex.com/oca/teams/23907/tr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -19,57 +18,29 @@ msgstr ""
"Language: tr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: crm_deduplicate_acl
#: code:addons/crm_deduplicate_acl/wizards/partner_merge.py:46
#, python-format
msgid ""
"All contacts must have the same email. Only the Administrator can merge "
"contacts with different emails."
msgstr ""
#. module: crm_deduplicate_acl
#: model:res.groups,name:crm_deduplicate_acl.group_automatically
msgid "Automatically"
msgstr "Otomatikman"
#. module: crm_deduplicate_acl
#: model:ir.model,name:crm_deduplicate_acl.model_res_partner
msgid "Contact"
msgstr ""
#. module: crm_deduplicate_acl
#: model:ir.module.category,name:crm_deduplicate_acl.category
#: model:ir.ui.menu,name:crm_deduplicate_acl.partner_merge_automatic_menu
msgid "Deduplicate Contacts"
msgstr "Çift Kayıtlı Kontakları Birleştir"
#. module: crm_deduplicate_acl
#: code:addons/crm_deduplicate_acl/wizards/partner_merge.py:28
#, python-format
msgid ""
"For safety reasons, you cannot merge more than 3 contacts together. You can "
"re-open the wizard several times if needed."
msgstr ""
"Güvenlik nedeniyle, en fazla 3 kişiyi birleştirebilirsiniz. Gerekirse birkaç"
" kez sihirbazını yeniden açabilirsiniz."
#. module: crm_deduplicate_acl
#: model:res.groups,name:crm_deduplicate_acl.group_manually
msgid "Manually"
msgstr "Manuel"
#. module: crm_deduplicate_acl
#: code:addons/crm_deduplicate_acl/wizards/partner_merge.py:81
#, python-format
msgid "Merged with the following partners:"
msgstr "Aşağıdaki iş ortaklarla birleştirildi:"
#. module: crm_deduplicate_acl
#: code:addons/crm_deduplicate_acl/wizards/partner_merge.py:69
#, python-format
msgid ""
"Only the destination contact may be linked to existing Journal Items. Please"
" ask the Administrator if you need to merge several contacts linked to "
"existing Journal Items."
msgstr ""
#. module: crm_deduplicate_acl
#: model:ir.ui.menu,name:crm_deduplicate_acl.root_menu
#: model:ir.ui.menu,name:crm_deduplicate_acl.crm_tools
msgid "Tools"
msgstr "Araçlar"
@ -78,12 +49,6 @@ msgstr "Araçlar"
msgid "Without restrictions"
msgstr "Kısıtlama olmaksızın"
#. module: crm_deduplicate_acl
#: code:addons/crm_deduplicate_acl/wizards/partner_merge.py:38
#, python-format
msgid "You cannot merge a contact with one of his parent."
msgstr "Bir kontağın kendi üst kontağı ile birleştiremezsiniz."
#. module: crm_deduplicate_acl
#: model:ir.model,name:crm_deduplicate_acl.model_base_partner_merge_automatic_wizard
msgid "base.partner.merge.automatic.wizard"

3
partner_deduplicate_acl/models/__init__.py

@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import res_partner

16
partner_deduplicate_acl/models/res_partner.py

@ -0,0 +1,16 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, models
class ResPartner(models.Model):
_inherit = 'res.partner'
@api.returns('self', lambda value: value.id)
def message_post(self, *args, **kwargs):
"""Change user who is posting the message if set by context."""
if self.env.context.get('message_post_user'):
obj = self.sudo(self.env.context['message_post_user'])
else:
obj = self
return super(ResPartner, obj).message_post(*args, **kwargs)

3
partner_deduplicate_acl/tests/__init__.py

@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_crm_deduplicate_acl

50
partner_deduplicate_acl/tests/test_crm_deduplicate_acl.py

@ -0,0 +1,50 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import exceptions
from odoo.tests import common
class TestCrmDeduplicateAcl(common.TransactionCase):
def setUp(self):
super(TestCrmDeduplicateAcl, 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_2 = self.partner_1.copy()
self.partner_2.write({
'name': 'Partner 1',
'email': 'partner2@example.org'
})
self.user = self.env['res.users'].create({
'login': 'test_crm_deduplicate_acl',
'name': 'test_crm_deduplicate_acl',
'email': 'crm_deduplicate_acl@example.org',
'groups_id': [
(4, self.env.ref('base.group_user').id),
(4, self.env.ref('base.group_partner_manager').id),
]
})
self.wizard = self.env['base.partner.merge.automatic.wizard'].sudo(
self.user,
).create({
'group_by_name': True,
})
def test_same_email_restriction(self):
self.wizard.action_start_manual_process()
with self.assertRaises(exceptions.UserError):
self.wizard.action_merge()
self.user.groups_id = [
(4, self.env.ref('crm_deduplicate_acl.group_unrestricted').id),
]
# Now there shouldn't be error
self.wizard.action_merge()
# Check that the posted message has correct user
resulting_partner = (self.partner_1 + self.partner_2).exists()
self.assertEqual(
resulting_partner.message_ids[0].author_id,
self.user.partner_id,
)

6
partner_deduplicate_acl/views/base_partner_merge_view.xml

@ -4,11 +4,11 @@
Copyright 2017 Tecnativa - Pedro M. Baeza
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<odoo>
<menuitem id='root_menu' name='Tools'
parent='sales_team.menu_base_partner' sequence="25"/>
<menuitem id='crm_tools' name='Tools'
parent='crm.crm_menu_root' sequence="24"/>
<menuitem id='partner_merge_automatic_menu'
action='crm.action_partner_deduplicate'
groups='group_automatically'
parent='root_menu'
parent='crm_tools'
/>
</odoo>

1
partner_deduplicate_acl/wizards/__init__.py

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

94
partner_deduplicate_acl/wizards/partner_merge.py

@ -1,87 +1,27 @@
# -*- coding: utf-8 -*-
# © 2016 Tecnativa, S.L. - Jairo Llopis
# © 2016 Tecnativa, S.L. - Vicent Cubells
# Copyright 2016 Tecnativa - Jairo Llopis
# Copyright 2016 Tecnativa - Vicent Cubells
# Copyright 2017 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import _, SUPERUSER_ID, models
from odoo.exceptions import UserError
import logging
_logger = logging.getLogger('base.partner.merge')
from odoo import models
class BasePartnerMergeAutomaticWizard(models.TransientModel):
_inherit = "base.partner.merge.automatic.wizard"
def _merge(self, partner_ids, dst_partner=None):
""" private implementation of merge partner
:param partner_ids : ids of partner to merge
:param dst_partner : record of destination res.partner
"""Perform the operation as admin if you have unrestricted merge
rights to avoid the rise of exceptions. An special context key is
passed for preserving the message author.
"""
Partner = self.env['res.partner']
partner_ids = Partner.browse(partner_ids).exists()
if len(partner_ids) < 2:
return
if len(partner_ids) > 3:
raise UserError(_("For safety reasons, you cannot merge more than"
" 3 contacts together. You can re-open"
" the wizard several times if needed."))
# check if the list of partners to merge contains child/parent relation
child_ids = self.env['res.partner']
for partner_id in partner_ids:
child_ids |= Partner.search(
[('id', 'child_of', [partner_id.id])]) - partner_id
if partner_ids & child_ids:
raise UserError(_("You cannot merge a contact with one"
" of his parent."))
user = self.env.user
if SUPERUSER_ID != self.env.uid and not user.has_group(
'crm_deduplicate_acl.group_unrestricted') and\
len(set(partner.email for partner in partner_ids)) > 1:
raise UserError(_("All contacts must have the same email."
" Only the Administrator can merge contacts"
" with different emails."))
# remove dst_partner from partners to merge
if dst_partner and dst_partner in partner_ids:
src_partners = partner_ids - dst_partner
if self.env.user.has_group('crm_deduplicate_acl.group_unrestricted'):
obj = self.sudo().with_context(message_post_user=self.env.uid)
if dst_partner:
dst_partner = dst_partner.with_context(
message_post_user=self.env.uid,
)
else:
ordered_partners = self._get_ordered_partner(partner_ids.ids)
dst_partner = ordered_partners[-1]
src_partners = ordered_partners[:-1]
_logger.info("dst_partner: %s", dst_partner.id)
# FIXME: is it still required to make and exception for
# account.move.line since accounting v9.0 ?
if SUPERUSER_ID != self.env.uid and not user.has_group(
'crm_deduplicate_acl.group_unrestricted') and\
'account.move.line' in self.env and\
self.env[
'account.move.line'
].sudo().search([('partner_id', 'in', [partner.id for
partner in src_partners
])]):
raise UserError(_("Only the destination contact may be linked to"
" existing Journal Items. Please ask the"
" Administrator if you need to merge several"
" contacts linked to existing Journal Items."))
# call sub methods to do the merge
self._update_foreign_keys(src_partners, dst_partner)
self._update_reference_fields(src_partners, dst_partner)
self._update_values(src_partners, dst_partner)
_logger.info('(uid = %s) merged the partners %r with %s',
self._uid, src_partners.ids, dst_partner.id)
dst_partner.message_post(body='%s %s' % (_(
"Merged with the following partners:"), ", ".join(
'%s <%s> (ID %s)' % (p.name, p.email or 'n/a', p.id)
for p in src_partners)))
# delete source partner, since they are merged
src_partners.unlink()
obj = self
return super(BasePartnerMergeAutomaticWizard, obj)._merge(
partner_ids, dst_partner=dst_partner,
)

7
partner_deduplicate_acl/wizards/partner_merge_view.xml

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- © 2016 Tecnativa S.L. - Jairo Llopis
© 2016 Tecnativa S.L. - Vicent Cubells
<!-- Copyright 2016 Tecnativa - Jairo Llopis
Copyright 2016 Tecnativa - Vicent Cubells
Copyright 2018 Tecnativa - Pedro M. Baeza
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<odoo>
@ -19,7 +20,7 @@
</record>
<record id="crm.action_partner_merge" model="ir.actions.act_window">
<field name="groups_id">group_manually</field>
<field name="groups_id" eval="[(4, ref('crm_deduplicate_acl.group_manually'))]"/>
</record>
</odoo>
Loading…
Cancel
Save