diff options
| author | mcm-odoo <mcm@odoo.com> | 2019-08-08 09:09:48 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2019-08-12 15:40:36 +0000 |
| commit | 2ab0bd3236c178bdec60bb050bda87f3090fe4b6 (patch) | |
| tree | 585d96b127592c8875f2094eb4b837bd19818198 /addons/website_slides/controllers/main.py | |
| parent | 9554e9d3f8bc11d681111fff113c64469001b837 (diff) | |
[IMP] website_slides: add button to install Surveys application in Slide Upload modal
PURPOSE
Ease discovering of eLearning features by allowing to install surveys
directly from frontend in order to allow certification.
SPECIFICATIONS
Add a button in Upload a document to install Surveys. This button only
appears if surveys is not installed.
When button is clicked, ask for confirmation before installing survey.
LImitate this feature to group system: system people should see the button
and use standard ACLS about module installation.
LINK
Task ID 2026846
Diffstat (limited to 'addons/website_slides/controllers/main.py')
| -rw-r--r-- | addons/website_slides/controllers/main.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/addons/website_slides/controllers/main.py b/addons/website_slides/controllers/main.py index a3cf6d99c78..592675e7729 100644 --- a/addons/website_slides/controllers/main.py +++ b/addons/website_slides/controllers/main.py @@ -418,6 +418,8 @@ class WebsiteSlides(WebsiteProfile): 'user': request.env.user, 'pager': pager, 'is_public_user': request.website.is_public_user(), + # display upload modal + 'enable_slide_upload': 'enable_slide_upload' in kw, } if not request.env.user._is_public(): last_message_values = request.env['mail.message'].search([ @@ -451,6 +453,17 @@ class WebsiteSlides(WebsiteProfile): offset=pager['offset']) values['channel_progress'] = self._get_channel_progress(channel, include_quiz=True) + # for sys admins: prepare data to install directly modules from eLearning when + # uploading slides. Currently supporting only survey, because why not. + if request.env.user.has_group('base.group_system'): + module = request.env.ref('base.module_survey') + if module.state != 'installed': + values['modules_to_install'] = [{ + 'id': module.id, + 'name': module.shortdesc, + 'motivational': _('Evaluate and certificate your students.'), + }] + values = self._prepare_additional_channel_values(values, **kw) return request.render('website_slides.course_main', values) |
