diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-11-02 10:52:55 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-11-02 10:52:55 +0100 |
| commit | 5e055a2afd23bd4e6a29c18c86d1978dcd98fc9f (patch) | |
| tree | 058c2cef359de70f7bbabacaa63446fa189af12e /odoo/addons/base/models/res_config.py | |
| parent | 486777654009aa372a21e9d6dd52e8c22173ee16 (diff) | |
| parent | f6ca72b3ce9ecc9007ae5825d2c648e3b26b098e (diff) | |
[MERGE] forward port branch saas-11.4 up to f6ca72b3ce9
Diffstat (limited to 'odoo/addons/base/models/res_config.py')
| -rw-r--r-- | odoo/addons/base/models/res_config.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/odoo/addons/base/models/res_config.py b/odoo/addons/base/models/res_config.py index 7712904fcc0..32beb3b5742 100644 --- a/odoo/addons/base/models/res_config.py +++ b/odoo/addons/base/models/res_config.py @@ -387,8 +387,6 @@ class ResConfigSettings(models.TransientModel, ResConfigModuleInstallationMixin) def copy(self, values): raise UserError(_("Cannot duplicate configuration!"), "") - # TODO: Find replacement for 'onchange' attribute in view with dynamic - # api.onchange(...) and migrate the onchange_module(...) accordingly. @api.model def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False): @@ -410,9 +408,6 @@ class ResConfigSettings(models.TransientModel, ResConfigModuleInstallationMixin) modifiers = json.loads(node.get("modifiers")) modifiers['readonly'] = True node.set("modifiers", json.dumps(modifiers)) - if 'on_change' not in node.attrib: - node.set("on_change", - "onchange_module(%s, '%s')" % (field, field)) ret_val['arch'] = etree.tostring(doc, encoding='unicode') return ret_val @@ -436,6 +431,16 @@ class ResConfigSettings(models.TransientModel, ResConfigModuleInstallationMixin) } return {} + def _register_hook(self): + """ Add an onchange method for each module field. """ + def make_method(name): + return lambda self: self.onchange_module(self[name], name) + + for name in self._fields: + if name.startswith('module_'): + method = make_method(name) + self._onchange_methods[name].append(method) + @api.model def _get_classified_fields(self): """ return a dictionary with the fields classified by category:: |
