diff options
| author | Xavier Morel <xmo@odoo.com> | 2018-06-22 15:33:25 +0200 |
|---|---|---|
| committer | Xavier Morel <xmo@odoo.com> | 2018-07-16 11:44:33 +0200 |
| commit | e89131381015e0ca155f64500d077a7a7bfff9c8 (patch) | |
| tree | ab71505096477a4cfb7023bd193332e75c33319a /odoo/modules/graph.py | |
| parent | 93c0d7e811da0e64d03bfea0f131c6ace1fbde05 (diff) | |
[IMP] base: disable demo data if they can't install
Task 1856935
Currently, if installing a module's demo data fails (because the
module was uninstalled and some were left over and can't be
reinstalled, or because they're broken, or…) the installation of the
module fails and further installations are skipped (?).
Since demo data are non-essential (though required to run tests),
rather than fail everything if they fail just roll them back and
notify the user.
This change generates a warning log *and* shows a notification popup
to the end user.
Diffstat (limited to 'odoo/modules/graph.py')
| -rw-r--r-- | odoo/modules/graph.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/odoo/modules/graph.py b/odoo/modules/graph.py index 0f2e329fab9..33846fbd1ec 100644 --- a/odoo/modules/graph.py +++ b/odoo/modules/graph.py @@ -176,3 +176,17 @@ class Node(object): for c in self.children: s += '%s`-> %s' % (' ' * depth, c._pprint(depth+1)) return s + + def should_have_demo(self): + return (hasattr(self, 'demo') or (self.dbdemo and self.state != 'installed')) and all(p.dbdemo for p in self.parents) + + @property + def parents(self): + if self.depth == 0: + return [] + + return ( + node for node in self.graph.values() + if node.depth < self.depth + if self in node.children + ) |
