diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /addons/account/controllers/onboarding.py | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/account/controllers/onboarding.py')
| -rw-r--r-- | addons/account/controllers/onboarding.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/addons/account/controllers/onboarding.py b/addons/account/controllers/onboarding.py new file mode 100644 index 00000000..3c0afa38 --- /dev/null +++ b/addons/account/controllers/onboarding.py @@ -0,0 +1,41 @@ +from odoo import http +from odoo.http import request + + +class OnboardingController(http.Controller): + + @http.route('/account/account_invoice_onboarding', auth='user', type='json') + def account_invoice_onboarding(self): + """ Returns the `banner` for the account invoice 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.account_invoice_onboarding_state == 'closed': + return {} + + return { + 'html': request.env.ref('account.account_invoice_onboarding_panel')._render({ + 'company': company, + 'state': company.get_and_update_account_invoice_onboarding_state() + }) + } + + @http.route('/account/account_dashboard_onboarding', auth='user', type='json') + def account_dashboard_onboarding(self): + """ Returns the `banner` for the account dashboard 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.account_dashboard_onboarding_state == 'closed': + return {} + + return { + 'html': request.env.ref('account.account_dashboard_onboarding_panel')._render({ + 'company': company, + 'state': company.get_and_update_account_dashboard_onboarding_state() + }) + } |
