From 1ca3b3df3421961caec3b747a364071c80f5c7da Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 10 May 2022 17:14:58 +0700 Subject: initial commit --- backend_theme_v14/controllers/main.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 backend_theme_v14/controllers/main.py (limited to 'backend_theme_v14/controllers/main.py') diff --git a/backend_theme_v14/controllers/main.py b/backend_theme_v14/controllers/main.py new file mode 100644 index 0000000..9b586a3 --- /dev/null +++ b/backend_theme_v14/controllers/main.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Copyright 2016, 2019 Openworx +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). + +import base64 +from odoo.http import Controller, request, route +from werkzeug.utils import redirect + +DEFAULT_IMAGE = '/backend_theme_v14/static/src/img/material-background.png' + +class DasboardBackground(Controller): + + @route(['/dashboard'], type='http', auth='user', website=False) + def dashboard(self, **post): + user = request.env.user + company = user.company_id + if company.dashboard_background: + image = base64.b64decode(company.dashboard_background) + else: + return redirect(DEFAULT_IMAGE) + + return request.make_response( + image, [('Content-Type', 'image')]) -- cgit v1.2.3