summaryrefslogtreecommitdiff
path: root/odoo/addons/base/models
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-11-02 10:52:55 +0100
committerChristophe Simonis <chs@odoo.com>2018-11-02 10:52:55 +0100
commit5e055a2afd23bd4e6a29c18c86d1978dcd98fc9f (patch)
tree058c2cef359de70f7bbabacaa63446fa189af12e /odoo/addons/base/models
parent486777654009aa372a21e9d6dd52e8c22173ee16 (diff)
parentf6ca72b3ce9ecc9007ae5825d2c648e3b26b098e (diff)
[MERGE] forward port branch saas-11.4 up to f6ca72b3ce9
Diffstat (limited to 'odoo/addons/base/models')
-rw-r--r--odoo/addons/base/models/ir_module.py7
-rw-r--r--odoo/addons/base/models/res_config.py15
2 files changed, 13 insertions, 9 deletions
diff --git a/odoo/addons/base/models/ir_module.py b/odoo/addons/base/models/ir_module.py
index 627edf53c50..350b4d7a489 100644
--- a/odoo/addons/base/models/ir_module.py
+++ b/odoo/addons/base/models/ir_module.py
@@ -695,11 +695,10 @@ class Module(models.Model):
mod.write(updated_values)
else:
mod_path = modules.get_module_path(mod_name)
- if not mod_path:
+ if not mod_path or not terp:
continue
- if not terp or not terp.get('installable', True):
- continue
- mod = self.create(dict(name=mod_name, state='uninstalled', **values))
+ state = "uninstalled" if terp.get('installable', True) else "uninstallable"
+ mod = self.create(dict(name=mod_name, state=state, **values))
res[1] += 1
mod._update_dependencies(terp.get('depends', []))
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::