onboarding.py 892 B

1234567891011121314151617181920212223
  1. # -*- coding: utf-8 -*-
  2. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  3. from odoo import http
  4. from odoo.http import request
  5. class OnboardingController(http.Controller):
  6. @http.route('/onboarding/<string:route_name>', auth='user', type='json')
  7. def get_onboarding_data(self, route_name=None):
  8. if not request.env.user.has_group('base.group_system'):
  9. return {}
  10. onboarding = request.env['onboarding.onboarding'].search([('route_name', '=', route_name)])
  11. if onboarding and not onboarding._search_or_create_progress().is_onboarding_closed:
  12. # JS implementation of the onboarding panel expects this data structure
  13. return {
  14. 'html': request.env['ir.qweb']._render(
  15. 'onboarding.onboarding_panel', onboarding._prepare_rendering_values())
  16. }
  17. return {}