diff options
| author | Adrian Torres <adt@odoo.com> | 2018-07-11 13:06:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-11 13:06:00 +0200 |
| commit | c002e2eb379e8a3db90b45269f8ff2b7e246c8b2 (patch) | |
| tree | c4f737ce584d60d73cceadbc7e21ab06ab9c3997 /addons/web_settings_dashboard/controllers | |
| parent | 5bf5d45b7d1ac381a1419c010352e56b79515599 (diff) | |
[IMP] allow installing demo data post db init
Intended for demo / throwaway databases only
Task-ID: 1856493
Diffstat (limited to 'addons/web_settings_dashboard/controllers')
| -rw-r--r-- | addons/web_settings_dashboard/controllers/main.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/addons/web_settings_dashboard/controllers/main.py b/addons/web_settings_dashboard/controllers/main.py index 21423ec902d..d2a23fc7c65 100644 --- a/addons/web_settings_dashboard/controllers/main.py +++ b/addons/web_settings_dashboard/controllers/main.py @@ -53,6 +53,12 @@ class WebSettingsDashboard(http.Controller): enterprise_users = request.env['res.users'].search_count([("login_date", ">=", fields.Datetime.to_string(limit_date)), ('share', '=', False)]) expiration_date = request.env['ir.config_parameter'].sudo().get_param('database.expiration_date') + + # We assume that if there's at least one module with demo data active, then the db was + # initialized with demo=True or it has been force-activated by the `Load demo data` button + # in the settings dashboard. + demo_active = bool(request.env['ir.module.module'].search_count([('demo', '=', True)])) + return { 'apps': { 'installed_apps': installed_apps, @@ -68,6 +74,7 @@ class WebSettingsDashboard(http.Controller): 'server_version': release.version, 'expiration_date': expiration_date, 'debug': request.debug, + 'demo_active': demo_active, }, 'company': { 'company_id': request.env.user.company_id.id, |
