diff --git a/partner_ref_unique/README.rst b/partner_ref_unique/README.rst index e4a903827..8ee806ba5 100644 --- a/partner_ref_unique/README.rst +++ b/partner_ref_unique/README.rst @@ -19,7 +19,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/134/9.0 + :target: https://runbot.odoo-community.org/runbot/134/11.0 Bug Tracker =========== diff --git a/partner_ref_unique/__init__.py b/partner_ref_unique/__init__.py index 5a5c25ccb..83e553ac4 100644 --- a/partner_ref_unique/__init__.py +++ b/partner_ref_unique/__init__.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -# Copyright 2016 Antiun Ingenieria S.L. - Antonio Espinosa # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models diff --git a/partner_ref_unique/__openerp__.py b/partner_ref_unique/__manifest__.py similarity index 77% rename from partner_ref_unique/__openerp__.py rename to partner_ref_unique/__manifest__.py index 0b8490f6f..b75c8dfb1 100644 --- a/partner_ref_unique/__openerp__.py +++ b/partner_ref_unique/__manifest__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016 Antiun Ingenieria S.L. - Antonio Espinosa # Copyright 2017 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -6,11 +5,10 @@ { "name": "Partner unique reference", "summary": "Add an unique constraint to partner ref field", - "version": "9.0.1.0.0", + "version": "11.0.1.0.0", "category": "Customer Relationship Management", - "website": "http://www.antiun.com", - "author": "Antiun Ingeniería S.L., " - "Tecnativa, " + "website": "https://github.com/OCA/partner-contact/", + "author": "Tecnativa, " "Odoo Community Association (OCA)", "license": "AGPL-3", "application": False, diff --git a/partner_ref_unique/models/__init__.py b/partner_ref_unique/models/__init__.py index f33d10808..f84abb8e9 100644 --- a/partner_ref_unique/models/__init__.py +++ b/partner_ref_unique/models/__init__.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -# Copyright 2016 Antiun Ingenieria S.L. - Antonio Espinosa # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import res_company diff --git a/partner_ref_unique/models/res_company.py b/partner_ref_unique/models/res_company.py index 0cae5c203..4537424d1 100644 --- a/partner_ref_unique/models/res_company.py +++ b/partner_ref_unique/models/res_company.py @@ -1,8 +1,7 @@ -# -*- coding: utf-8 -*- -# Copyright 2016 Antiun Ingenieria S.L. - Antonio Espinosa +# Copyright 2016 Antonio Espinosa # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import models, fields +from odoo import fields, models class ResCompany(models.Model): diff --git a/partner_ref_unique/models/res_partner.py b/partner_ref_unique/models/res_partner.py index 14adeb0e6..c7fc7af23 100644 --- a/partner_ref_unique/models/res_partner.py +++ b/partner_ref_unique/models/res_partner.py @@ -1,9 +1,8 @@ -# -*- coding: utf-8 -*- -# Copyright 2016 Antiun Ingenieria S.L. - Antonio Espinosa +# Copyright 2016 Antonio Espinosa # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import models, api, _ -from openerp.exceptions import ValidationError +from odoo import _, api, models +from odoo.exceptions import ValidationError class ResPartner(models.Model): @@ -20,7 +19,6 @@ class ResPartner(models.Model): domain = [ ('id', '!=', partner.id), ('ref', '=', partner.ref), - ('customer', '=', True), ] if mode == 'companies': domain.append(('is_company', '=', True)) diff --git a/partner_ref_unique/readme/CONFIGURE.rst b/partner_ref_unique/readme/CONFIGURE.rst new file mode 100755 index 000000000..5a93bcb84 --- /dev/null +++ b/partner_ref_unique/readme/CONFIGURE.rst @@ -0,0 +1,5 @@ +To configure this module, you need to: + +#. Go to **Settings > Companies**. +#. Select a company. +#. Choose an option on section *Partners*. \ No newline at end of file diff --git a/partner_ref_unique/readme/CONTRIBUTORS.rst b/partner_ref_unique/readme/CONTRIBUTORS.rst new file mode 100755 index 000000000..c64159a09 --- /dev/null +++ b/partner_ref_unique/readme/CONTRIBUTORS.rst @@ -0,0 +1,10 @@ + + +* `Tecnativa `__: + + * Antonio Espinosa + * Pedro M. Baeza + * Rafael Blasco + * Jairo Llopis + * Vicent Cubells + * Cristina Martín diff --git a/partner_ref_unique/readme/DESCRIPTION.rst b/partner_ref_unique/readme/DESCRIPTION.rst new file mode 100755 index 000000000..d3e5b152c --- /dev/null +++ b/partner_ref_unique/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module allows add an unique constraint to partner ref field. \ No newline at end of file diff --git a/partner_ref_unique/readme/USAGE.rst b/partner_ref_unique/readme/USAGE.rst new file mode 100755 index 000000000..239792b42 --- /dev/null +++ b/partner_ref_unique/readme/USAGE.rst @@ -0,0 +1,6 @@ +#. Go to any partner in **Contacts > Contacts** +#. Try to create two partners with the same ref. + +* If you selcted the option 'All partners' you can't create two partners with the same ref. +* If you selcted the option 'Only companies' you can't create two companies with the same ref. +* If you selcted the option 'None' you can create two partners with the same ref. \ No newline at end of file diff --git a/partner_ref_unique/tests/__init__.py b/partner_ref_unique/tests/__init__.py index 00432e6ea..d3f5108ed 100644 --- a/partner_ref_unique/tests/__init__.py +++ b/partner_ref_unique/tests/__init__.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -# Copyright 2017 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import test_res_partner_ref diff --git a/partner_ref_unique/tests/test_res_partner_ref.py b/partner_ref_unique/tests/test_res_partner_ref.py index 32ff32e0c..f61ee8682 100644 --- a/partner_ref_unique/tests/test_res_partner_ref.py +++ b/partner_ref_unique/tests/test_res_partner_ref.py @@ -1,9 +1,8 @@ -# -*- coding: utf-8 -*- # Copyright 2017 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp.tests import common -from openerp.exceptions import ValidationError +from odoo.tests import common +from odoo.exceptions import ValidationError class TestResPartnerRefUnique(common.SavepointCase): diff --git a/partner_ref_unique/views/res_company_view.xml b/partner_ref_unique/views/res_company_view.xml index c8cb6f485..4091186bb 100644 --- a/partner_ref_unique/views/res_company_view.xml +++ b/partner_ref_unique/views/res_company_view.xml @@ -1,5 +1,5 @@ - @@ -9,13 +9,11 @@ res.company - - - - - + + + - +