From 475de905de5202936dc83465592507dd220cbc0c Mon Sep 17 00:00:00 2001 From: sebalix Date: Mon, 18 Nov 2019 17:08:28 +0100 Subject: [PATCH] [MIG] configuration_helper: Migration to 12.0 Related configuration fields have to be configured with 'readonly=False'. --- configuration_helper/__manifest__.py | 2 +- configuration_helper/models/config.py | 3 ++- configuration_helper/readme/DESCRIPTION.rst | 2 +- configuration_helper/readme/ROADMAP.rst | 2 +- configuration_helper/readme/USAGE.rst | 6 +++--- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/configuration_helper/__manifest__.py b/configuration_helper/__manifest__.py index e34b1276b..ffe4eadee 100644 --- a/configuration_helper/__manifest__.py +++ b/configuration_helper/__manifest__.py @@ -1,7 +1,7 @@ # Copyright 2014 David BEAL Akretion # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). {'name': 'Configuration Helper', - 'version': '11.0.1.0.0', + 'version': '12.0.1.0.0', 'author': "Akretion,Odoo Community Association (OCA)", 'maintainer': 'Akretion', 'category': 'server', diff --git a/configuration_helper/models/config.py b/configuration_helper/models/config.py index 10433a949..67bfbb198 100644 --- a/configuration_helper/models/config.py +++ b/configuration_helper/models/config.py @@ -28,7 +28,7 @@ class AbstractConfigSettings(models.AbstractModel): @api.model def _setup_base(self): cls = type(self) - super(AbstractConfigSettings, self)._setup_base() + super()._setup_base() comp_fields = filter( lambda f: (f[0].startswith(self._prefix) and @@ -40,6 +40,7 @@ class AbstractConfigSettings(models.AbstractModel): for field_key, field in comp_fields: kwargs = field.args.copy() kwargs['related'] = 'company_id.' + field_key + kwargs['readonly'] = False field_key = re.sub('^' + self._prefix, '', field_key) self._add_field(field_key, field.new(**kwargs)) cls._proper_fields = set(cls._fields) diff --git a/configuration_helper/readme/DESCRIPTION.rst b/configuration_helper/readme/DESCRIPTION.rst index 7d420e61a..198accb53 100644 --- a/configuration_helper/readme/DESCRIPTION.rst +++ b/configuration_helper/readme/DESCRIPTION.rst @@ -4,7 +4,7 @@ It helps to create `config.settings` by providing an abstract Class. This class: - * creates automatically related fields in 'whatiwant.config.settings' + * creates automatically related fields in 'res.config.settings' using those defined in 'res.company': it avoids duplicated field definitions. * company_id field with default value is created * onchange_company_id is defined to update all related fields diff --git a/configuration_helper/readme/ROADMAP.rst b/configuration_helper/readme/ROADMAP.rst index 71d14010e..b02cae040 100644 --- a/configuration_helper/readme/ROADMAP.rst +++ b/configuration_helper/readme/ROADMAP.rst @@ -1,2 +1,2 @@ * support (or check support) for these field types : o2m, m2m, reference, property, selection - * automatically generate a default view for 'whatiwant.config.settings' (in --debug ?) + * automatically generate a default view for 'res.config.settings' (in --debug ?) diff --git a/configuration_helper/readme/USAGE.rst b/configuration_helper/readme/USAGE.rst index 231d01be0..e62038d85 100644 --- a/configuration_helper/readme/USAGE.rst +++ b/configuration_helper/readme/USAGE.rst @@ -2,12 +2,12 @@ from . company import ResCompany - class WhatiwantClassSettings(orm.TransientModel): + class WhatiwantConfigSettings(models.TransientModel): _inherit = ['res.config.settings', 'abstract.config.settings'] - _name = 'whatiwant.config.settings' + _name = 'res.config.settings' # fields must be defined in ResCompany class # related fields are automatically generated from previous definitions _companyObject = ResCompany - # all prefixed field with _prefix in res.company, will be available in 'whatiwant.config.settings' model + # all prefixed field with _prefix in res.company, will be available in 'res.config.settings' model _prefix = 'prefixyouchoose_'