From b19021b047d1f0e19bebab35db1491bf79ff9a2f Mon Sep 17 00:00:00 2001 From: dbkosky Date: Wed, 16 Mar 2022 14:29:06 +0000 Subject: [PATCH] [FIX] account_edi_proxy_client: don't update the demo state The issue is that the config param is data, which means that when the module is updated, the config parameter will be updated (i.e. reset to the 'demo' state), which will cause havoc on client databases. Even if we set the record to 'noupdate=1', the existing clients will have the record updated. The solution is to remove the config param from the data entirely, thus preventing it from being updated when updating the module, and instead have a 'post_init_hook' that sets the parameter to 'demo' (this will only happen when the module is installed, and never again). closes odoo/odoo#86607 X-original-commit: 1d3cd7ee32caede10cd4ffd496ffd59a4103b04f Signed-off-by: Josse Colpaert --- addons/account_edi_proxy_client/__init__.py | 5 +++++ addons/account_edi_proxy_client/__manifest__.py | 2 +- addons/account_edi_proxy_client/data/config_demo.xml | 9 --------- 3 files changed, 6 insertions(+), 10 deletions(-) delete mode 100644 addons/account_edi_proxy_client/data/config_demo.xml diff --git a/addons/account_edi_proxy_client/__init__.py b/addons/account_edi_proxy_client/__init__.py index 0650744f6bc..4f57a3eb957 100644 --- a/addons/account_edi_proxy_client/__init__.py +++ b/addons/account_edi_proxy_client/__init__.py @@ -1 +1,6 @@ from . import models +from odoo import api, SUPERUSER_ID + +def _create_demo_config_param(cr, registry): + env = api.Environment(cr, SUPERUSER_ID, {}) + env['ir.config_parameter'].set_param('account_edi_proxy_client.demo', 'demo') diff --git a/addons/account_edi_proxy_client/__manifest__.py b/addons/account_edi_proxy_client/__manifest__.py index 5d20df4a13f..fd9e470872c 100644 --- a/addons/account_edi_proxy_client/__manifest__.py +++ b/addons/account_edi_proxy_client/__manifest__.py @@ -17,9 +17,9 @@ Odoo database. }, 'data': [ 'security/ir.model.access.csv', - 'data/config_demo.xml', ], 'installable': True, 'application': False, 'license': 'LGPL-3', + 'post_init_hook': '_create_demo_config_param', } diff --git a/addons/account_edi_proxy_client/data/config_demo.xml b/addons/account_edi_proxy_client/data/config_demo.xml deleted file mode 100644 index ea4b802d62c..00000000000 --- a/addons/account_edi_proxy_client/data/config_demo.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - account_edi_proxy_client.demo - demo - - -