From 3751379f1e9a4c215fb6eb898b4ccc67659b9ace Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 10 May 2022 21:51:50 +0700 Subject: initial commit 2 --- addons/sale/controllers/onboarding.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 addons/sale/controllers/onboarding.py (limited to 'addons/sale/controllers/onboarding.py') diff --git a/addons/sale/controllers/onboarding.py b/addons/sale/controllers/onboarding.py new file mode 100644 index 00000000..8b54c0d3 --- /dev/null +++ b/addons/sale/controllers/onboarding.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import http +from odoo.http import request + + +class OnboardingController(http.Controller): + + @http.route('/sales/sale_quotation_onboarding_panel', auth='user', type='json') + def sale_quotation_onboarding(self): + """ Returns the `banner` for the sale onboarding panel. + It can be empty if the user has closed it or if he doesn't have + the permission to see it. """ + + company = request.env.company + if not request.env.is_admin() or \ + company.sale_quotation_onboarding_state == 'closed': + return {} + + return { + 'html': request.env.ref('sale.sale_quotation_onboarding_panel')._render({ + 'company': company, + 'state': company.get_and_update_sale_quotation_onboarding_state() + }) + } -- cgit v1.2.3