summaryrefslogtreecommitdiff
path: root/odoo/tools
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-07-05 11:13:53 +0200
committerChristophe Simonis <chs@odoo.com>2019-07-05 11:13:53 +0200
commit039e6bae9916aaa9d82bc558817a7ed7d0ea3c68 (patch)
treefa0f0e71de1c077db86593704eb83fc1b2115e87 /odoo/tools
parent50d21df1561f660c184329cfc4cb567ea5d79ace (diff)
parent9c742d0c656412beba7201085abd4cecc81f5d27 (diff)
[MERGE] forward port branch 12.0 up to 9c742d0c656
Diffstat (limited to 'odoo/tools')
-rw-r--r--odoo/tools/misc.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/odoo/tools/misc.py b/odoo/tools/misc.py
index e1a16b574a3..a551d8d829b 100644
--- a/odoo/tools/misc.py
+++ b/odoo/tools/misc.py
@@ -1241,3 +1241,14 @@ def wrap_module(module, attr_list):
raise AttributeError(attrib)
# module and attr_list are in the closure
return WrappedModule()
+
+
+class DotDict(dict):
+ """Helper for dot.notation access to dictionary attributes
+ E.g.
+ foo = DotDict({'bar': False})
+ return foo.bar
+ """
+ def __getattr__(self, attrib):
+ val = self.get(attrib)
+ return DotDict(val) if type(val) is dict else val