Browse Source

[MIG] configuration_helper: Migration to 12.0

Related configuration fields have to be configured with 'readonly=False'.
12.0-mig-module_prototyper_last
sebalix 5 years ago
parent
commit
475de905de
  1. 2
      configuration_helper/__manifest__.py
  2. 3
      configuration_helper/models/config.py
  3. 2
      configuration_helper/readme/DESCRIPTION.rst
  4. 2
      configuration_helper/readme/ROADMAP.rst
  5. 6
      configuration_helper/readme/USAGE.rst

2
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',

3
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)

2
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

2
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 ?)

6
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_'
Loading…
Cancel
Save