From d9da8510a360169c2e9f1275716144aa04730b84 Mon Sep 17 00:00:00 2001 From: Akim Juillerat Date: Wed, 8 Jan 2020 15:56:23 +0100 Subject: [PATCH] fixup! Store partner_ref_unique to allow triggering the error updating res.company --- partner_ref_unique/hooks.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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"