From a93472a4b21fd1349691ecbcfdfea2b75b34589b Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Mon, 3 Jul 2023 11:36:33 +0000 Subject: [PATCH] [FIX] l10n_ch: Unlink res.config.settings after init Purpose ======= If not unlinked, it could make it impossible to create a not null constraint on columns that are installed after l10n_ch before the garbage collector dropped the existing wizard, leading to an error like the following: Table 'res_config_settings': unable to set NOT NULL on column 'ebay_currency' Part-of: odoo/odoo#105119 --- addons/l10n_ch/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/l10n_ch/__init__.py b/addons/l10n_ch/__init__.py index 5c088ee515f..1b49e3521b8 100644 --- a/addons/l10n_ch/__init__.py +++ b/addons/l10n_ch/__init__.py @@ -11,13 +11,13 @@ def init_settings(env): ''' # The cash rounding is activated by default only if the company is localized in Switzerland or Liechtenstein. for company in env['res.company'].search([('partner_id.country_id.code', 'in', ["CH", "LI"])]): - res_config_id = env['res.config.settings'].create({ + config_wizard = env['res.config.settings'].create({ 'company_id': company.id, 'group_cash_rounding': True }) # We need to call execute, otherwise the "implied_group" in fields are not processed. - res_config_id.execute() - + config_wizard.execute() + config_wizard.unlink() def post_init(env): init_settings(env)