onboarding.py 929 B

123456789101112131415161718192021222324252627
  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('/sales/sale_quotation_onboarding_panel', auth='user', type='json')
  7. def sale_quotation_onboarding(self):
  8. """ Returns the `banner` for the sale onboarding panel.
  9. It can be empty if the user has closed it or if he doesn't have
  10. the permission to see it. """
  11. company = request.env.company
  12. if not request.env.is_admin() or \
  13. company.sale_quotation_onboarding_state == 'closed':
  14. return {}
  15. return {
  16. 'html': request.env['ir.qweb']._render('sale.sale_quotation_onboarding_panel', {
  17. 'company': company,
  18. 'state': company.get_and_update_sale_quotation_onboarding_state()
  19. })
  20. }