diff options
Diffstat (limited to 'odoo/tools/misc.py')
| -rw-r--r-- | odoo/tools/misc.py | 11 |
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 |
