[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 <jco@odoo.com>
This commit is contained in:
dbkosky
2022-03-18 00:22:51 +01:00
committed by dbkosky
parent aa9f7a8c48
commit b19021b047
3 changed files with 6 additions and 10 deletions
@@ -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')
@@ -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',
}
@@ -1,9 +0,0 @@
<?xml version="1.0" ?>
<odoo>
<record id="account_edi_proxy_client_demo" model="ir.config_parameter">
<field name="key">account_edi_proxy_client.demo</field>
<field name="value">demo</field>
</record>
</odoo>