diff --git a/partner_ref_unique/__manifest__.py b/partner_ref_unique/__manifest__.py index 9b58a6323..b9b7016ee 100644 --- a/partner_ref_unique/__manifest__.py +++ b/partner_ref_unique/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Partner unique reference", "summary": "Add an unique constraint to partner ref field", - "version": "12.0.1.0.1", + "version": "12.0.1.0.2", "category": "Customer Relationship Management", "website": "https://github.com/OCA/partner-contact/", "author": "Tecnativa, " diff --git a/partner_ref_unique/hooks.py b/partner_ref_unique/hooks.py index 8de3c4283..2a51c94f5 100644 --- a/partner_ref_unique/hooks.py +++ b/partner_ref_unique/hooks.py @@ -1,4 +1,4 @@ -# Copyright 2019 Camptocamp SA +# Copyright 2020 Camptocamp SA # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) import logging @@ -10,6 +10,15 @@ def pre_init_hook(cr): :param odoo.sql_db.Cursor cr: Database cursor. """ + _logger.info("Creating res.company.partner_ref_unique column") + cr.execute("ALTER TABLE res_company ADD partner_ref_unique varchar NULL;") + cr.execute( + "COMMENT ON COLUMN public.res_company.partner_ref_unique " + "IS 'Unique partner reference for';" + ) + cr.execute( + "UPDATE res_company SET partner_ref_unique = 'none';" + ) _logger.info( "Creating res.partner.partner_ref_unique column with value from " "res.company" diff --git a/partner_ref_unique/i18n/partner_ref_unique.pot b/partner_ref_unique/i18n/partner_ref_unique.pot index 1130f45b4..d0cefa2b8 100644 --- a/partner_ref_unique/i18n/partner_ref_unique.pot +++ b/partner_ref_unique/i18n/partner_ref_unique.pot @@ -44,13 +44,15 @@ msgid "Partners" msgstr "" #. module: partner_ref_unique -#: code:addons/partner_ref_unique/models/res_partner.py:31 +#: code:addons/partner_ref_unique/models/res_partner.py:37 #, python-format msgid "This reference is equal to partner '%s'" msgstr "" #. module: partner_ref_unique #: model:ir.model.fields,field_description:partner_ref_unique.field_res_company__partner_ref_unique +#: model:ir.model.fields,field_description:partner_ref_unique.field_res_partner__partner_ref_unique +#: model:ir.model.fields,field_description:partner_ref_unique.field_res_users__partner_ref_unique msgid "Unique partner reference for" msgstr ""