Browse Source

publish muk_saas_branding - 11.0

11.0
MuK IT GmbH 5 years ago
parent
commit
2f8b1c2683
  1. 165
      muk_saas_branding/LICENSE
  2. 23
      muk_saas_branding/__init__.py
  3. 53
      muk_saas_branding/__manifest__.py
  4. 24
      muk_saas_branding/controllers/__init__.py
  5. 106
      muk_saas_branding/controllers/binary.py
  6. 75
      muk_saas_branding/controllers/database.py
  7. 4
      muk_saas_branding/doc/changelog.rst
  8. 126
      muk_saas_branding/doc/index.rst
  9. BIN
      muk_saas_branding/static/description/banner.png
  10. BIN
      muk_saas_branding/static/description/icon.png
  11. 1
      muk_saas_branding/static/description/icon.svg
  12. 133
      muk_saas_branding/static/description/index.html
  13. BIN
      muk_saas_branding/static/description/logo.png
  14. BIN
      muk_saas_branding/static/description/preview.png
  15. BIN
      muk_saas_branding/static/description/service_customization.png
  16. BIN
      muk_saas_branding/static/description/service_development.png
  17. BIN
      muk_saas_branding/static/description/service_implementation.png
  18. BIN
      muk_saas_branding/static/description/service_integration.png
  19. BIN
      muk_saas_branding/static/description/service_support.png
  20. BIN
      muk_saas_branding/static/src/img/favicon.ico
  21. BIN
      muk_saas_branding/static/src/img/logo.png
  22. BIN
      muk_saas_branding/static/src/img/nofavicon.ico
  23. BIN
      muk_saas_branding/static/src/img/nologo.png
  24. 369
      muk_saas_branding/templates/database_manager.html
  25. 23
      muk_saas_branding/tools/__init__.py
  26. 38
      muk_saas_branding/tools/utils.py

165
muk_saas_branding/LICENSE

@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

23
muk_saas_branding/__init__.py

@ -0,0 +1,23 @@
###################################################################################
#
# Copyright (c) 2017-2019 MuK IT GmbH.
#
# This file is part of MuK SaaS Branding
# (see https://mukit.at).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###################################################################################
from . import controllers

53
muk_saas_branding/__manifest__.py

@ -0,0 +1,53 @@
###################################################################################
#
# Copyright (c) 2017-2019 MuK IT GmbH.
#
# This file is part of MuK SaaS Branding
# (see https://mukit.at).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###################################################################################
{
"name": "MuK SaaS Branding",
"summary": """Branding and Debranding""",
"version": "12.0.1.0.0",
"category": "Extra Tools",
"license": "LGPL-3",
"website": "http://www.mukit.at",
'live_test_url': 'https://mukit.at/r/SgN',
"author": "MuK IT",
"contributors": [
"Mathias Markl <mathias.markl@mukit.at>",
],
"depends": [
"web",
],
"data": [
],
"qweb": [
"static/src/xml/*.xml",
],
"images": [
'static/description/banner.png'
],
"external_dependencies": {
"python": [],
"bin": [],
},
"auto_install": False,
"application": False,
"installable": True,
}

24
muk_saas_branding/controllers/__init__.py

@ -0,0 +1,24 @@
###################################################################################
#
# Copyright (c) 2017-2019 MuK IT GmbH.
#
# This file is part of MuK SaaS Branding
# (see https://mukit.at).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###################################################################################
from . import binary
from . import database

106
muk_saas_branding/controllers/binary.py

@ -0,0 +1,106 @@
###################################################################################
#
# Copyright (c) 2017-2019 MuK IT GmbH.
#
# This file is part of MuK SaaS Branding
# (see https://mukit.at).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###################################################################################
import io
import os
import base64
import mimetypes
import functools
from odoo import http, SUPERUSER_ID
from odoo.modules import registry, get_resource_path
from odoo.tools.mimetypes import guess_mimetype
from odoo.tools import config
from odoo.http import request
from odoo.addons.web.controllers.main import Binary
from odoo.addons.muk_saas_branding.tools.utils import safe_execute
class Binary(Binary):
def _get_company_image_placeholder(self):
if config.get("default_company_image_folder", False):
def get_path(filename):
return os.path.join(config.get("default_company_image_folder"), filename)
return get_path
return functools.partial(get_resource_path, 'muk_saas_branding', 'static', 'src', 'img')
def _get_company_image_data(self, dbname, uid, field, company=None):
try:
dbreg = registry.Registry(dbname)
with dbreg.cursor() as cr:
if company:
cr.execute("""
SELECT {0}, write_date
FROM res_company
WHERE id = %s
""".format(field), (company,))
else:
cr.execute("""
SELECT c.{0}, c.write_date
FROM res_users u
LEFT JOIN res_company c
ON c.id = u.company_id
WHERE u.id = %s
""".format(field), (uid,))
return cr.fetchone()
except Exception:
return None
def _get_company_image_response(self, dbname, field, placeholders, default_mimetype, company=None):
uid = request.session.uid if request.session.db else None
placeholder = self._get_company_image_placeholder()
if request.session.db:
dbname = request.session.db
elif dbname is None:
dbname = http.db_monodb()
if not dbname:
response = http.send_file(placeholder(placeholders[0]))
else:
uid = uid if uid else SUPERUSER_ID
company_data = self._get_company_image_data(dbname, uid, field, company)
if company_data and company_data[0]:
image_data = base64.b64decode(company_data[0])
mimetype = guess_mimetype(image_data, default=default_mimetype)
extension = mimetypes.guess_extension(mimetype)
response = http.send_file(
io.BytesIO(image_data), filename=('logo%s' % extension),
mimetype=mimetype, mtime=company_data[1]
)
else:
response = http.send_file(placeholder(placeholders[1]))
return response
@http.route(['/web/binary/company_logo', '/logo', '/logo.png'], type='http', auth="none")
def company_logo(self, dbname=None, **kw):
company = safe_execute(False, int, kw['company']) if kw and kw.get('company') else False
return self._get_company_image_response(
dbname, 'logo_web', ('logo.png', 'nologo.png'), 'image/png', company
)
@http.route(['/web/binary/company_favicon', '/favicon', '/favicon.ico'], type='http', auth="none")
def company_favicon(self, dbname=None, **kw):
company = safe_execute(False, int, kw['company']) if kw and kw.get('company') else False
return self._get_company_image_response(
dbname, 'favicon', ('favicon.ico', 'nofavicon.ico'), 'image/x-icon', company
)

75
muk_saas_branding/controllers/database.py

@ -0,0 +1,75 @@
###################################################################################
#
# Copyright (c) 2017-2019 MuK IT GmbH.
#
# This file is part of MuK SaaS Branding
# (see https://mukit.at).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###################################################################################
import os
import sys
import json
from odoo import http, tools, service
from odoo.http import request, db_monodb, db_list
from odoo.addons.web.controllers.main import DBNAME_PATTERN
from odoo.addons.web.controllers.main import jinja2, Database
if hasattr(sys, 'frozen'):
location = os.path.dirname(__file__)
path = os.path.join(location, '..', 'templates')
loader = jinja2.FileSystemLoader(os.path.realpath(path))
else:
loader = jinja2.PackageLoader('odoo.addons.muk_saas_branding', 'templates')
env = jinja2.Environment(loader=loader, autoescape=True)
env.filters["json"] = json.dumps
class Database(Database):
def _render_template(self, **d):
d.setdefault('manage', True)
d['insecure'] = tools.config.verify_admin_password('admin')
d['list_db'] = tools.config['list_db']
d['langs'] = service.db.exp_list_lang()
d['countries'] = service.db.exp_list_countries()
d['pattern'] = DBNAME_PATTERN
d['system_name'] = tools.config.get(
"database_manager_system_name", "Odoo"
)
d['system_logo'] = tools.config.get(
"database_manager_system_logo_url",
"/web/static/src/img/logo2.png"
)
d['system_favicon'] = tools.config.get(
"database_manager_system_favicon_url",
"/web/static/src/img/favicon.ico"
)
d['privacy_policy'] = tools.config.get(
"database_manager_privacy_policy_url",
"https://www.odoo.com/privacy"
)
d['databases'] = []
try:
d['databases'] = db_list()
d['incompatible_databases'] = service.db.list_db_incompatible(d['databases'])
except odoo.exceptions.AccessDenied:
monodb = db_monodb()
if monodb:
d['databases'] = [monodb]
return env.get_template("database_manager.html").render(d)

4
muk_saas_branding/doc/changelog.rst

@ -0,0 +1,4 @@
`1.0.0`
-------
- Init version

126
muk_saas_branding/doc/index.rst

@ -0,0 +1,126 @@
================
MuK SaaS Branding
================
This module complements the Branding Module. It introduces a new route to recive the
favicon and adapts the existing route to receive the company logo to. You can also
use parameters in the configuration file to specify the images and links on the
database manager page.
Installation
============
To install this module, you need to:
Download the module and add it to your Odoo addons folder. Afterward, log on to
your Odoo server and go to the Apps menu. Trigger the debug mode and update the
list by clicking on the "Update Apps List" link. Now install the module by
clicking on the install button.
Another way to install this module is via the package management for Python
(`PyPI <https://pypi.org/project/pip/>`_).
To install our modules using the package manager make sure
`odoo-autodiscover <https://pypi.org/project/odoo-autodiscover/>`_ is installed
correctly. Then open a console and install the module by entering the following
command:
``pip install --extra-index-url https://nexus.mukit.at/repository/odoo/simple <module>``
The module name consists of the Odoo version and the module name, where
underscores are replaced by a dash.
**Module:**
``odoo<version>-addon-<module_name>``
**Example:**
``sudo -H pip3 install --extra-index-url https://nexus.mukit.at/repository/odoo/simple odoo11-addon-muk-utils``
Once the installation has been successfully completed, the app is already in the
correct folder. Log on to your Odoo server and go to the Apps menu. Trigger the
debug mode and update the list by clicking on the "Update Apps List" link. Now
install the module by clicking on the install button.
The biggest advantage of this variant is that you can now also update the app
using the "pip" command. To do this, enter the following command in your console:
``pip install --upgrade --extra-index-url https://nexus.mukit.at/repository/odoo/simple <module>``
When the process is finished, restart your server and update the application in
Odoo. The steps are the same as for the installation only the button has changed
from "Install" to "Upgrade".
You can also view available Apps directly in our `repository <https://nexus.mukit.at/#browse/browse:odoo>`_
and find a more detailed installation guide on our `website <https://mukit.at/page/open-source>`_.
For modules licensed under OPL-1, you will receive access data when you purchase
the module. If the modules were not purchased directly from
`MuK IT <https://www.mukit.at/>`_ please contact our support (support@mukit.at)
with a confirmation of purchase to receive the corresponding access data.
Upgrade
============
To upgrade this module, you need to:
Download the module and add it to your Odoo addons folder. Restart the server
and log on to your Odoo server. Select the Apps menu and upgrade the module by
clicking on the upgrade button.
If you installed the module using the "pip" command, you can also update the
module in the same way. Just type the following command into the console:
``pip install --upgrade --extra-index-url https://nexus.mukit.at/repository/odoo/simple <module>``
When the process is finished, restart your server and update the application in
Odoo, just like you would normally.
Configuration
=============
Since this module need to be activated even if no database is selected it should
be loaded right at the server start. This can be done by editing the configuration
file or passing a load parameter to the start script.
Parameter: ``--load=web,muk_saas_branding``
The following fields can be modified in the config file:
* database_manager_system_name
* database_manager_system_logo_url
* database_manager_system_favicon_url
* database_manager_privacy_policy_url
Usage
=============
After setting the parameters, the system is automatically branded.
Credits
=======
Contributors
------------
* Mathias Markl <mathias.markl@mukit.at>
Images
------------
Some pictures are based on or inspired by the icon set of Font Awesome:
* `Font Awesome <https://fontawesome.com>`_
Author & Maintainer
-------------------
This module is maintained by the `MuK IT GmbH <https://www.mukit.at/>`_.
MuK IT is an Austrian company specialized in customizing and extending Odoo.
We develop custom solutions for your individual needs to help you focus on
your strength and expertise to grow your business.
If you want to get in touch please contact us via mail
(sale@mukit.at) or visit our website (https://mukit.at).

BIN
muk_saas_branding/static/description/banner.png

After

Width: 880  |  Height: 440  |  Size: 43 KiB

BIN
muk_saas_branding/static/description/icon.png

After

Width: 250  |  Height: 250  |  Size: 12 KiB

1
muk_saas_branding/static/description/icon.svg
File diff suppressed because it is too large
View File

133
muk_saas_branding/static/description/index.html

@ -0,0 +1,133 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">MuK Branding</h2>
<h3 class="oe_slogan">Branding Features</h3>
<h4 class="oe_slogan" style="font-size: 23px;">MuK IT GmbH -
www.mukit.at</h4>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="text-justify" style="max-width: 84%; margin: 16px 8%;">
<h3 class="oe_slogan">Overview</h3>
<p class="oe_mt32">This module complements the Branding Module.
It introduces a new route to recive the favicon and adapts the
existing route to receive the company logo to. You can also use
parameters in the configuration file to specify the images and links
on the database manager page.</p>
<p>Since this module need to be activated even if no database is
selected it should be loaded right at the server start. This can be
done by editing the configuration file or passing a load parameter
to the start script.</p>
<p>
Parameter:
<code>--load=web,muk_saas_branding</code>
</p>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<h3 class="oe_slogan">Our Services</h3>
<div
style="display: flex; padding-top: 20px; justify-content: space-between;">
<div style="flex-basis: 18%;">
<a href="https://mukit.at/r/MQ5" target="_blank">
<div
style="width: 75px; height: 75px; border-radius: 100%; margin: auto;">
<img src="service_implementation.png"
style="width: 100%; border-radius: 100%;">
</div>
<h3 class="oe_slogan"
style="text-align: center; font-size: 14px; width: 100%; margin: 0; margin-top: 14px; color: #000 !important; margin-top: 5px; opacity: 1 !important; line-height: 17px;">
Odoo <br>Implementation
</h3>
</a>
</div>
<div style="flex-basis: 18%;">
<a href="https://mukit.at/r/u7c" target="_blank">
<div
style="width: 75px; height: 75px; border-radius: 100%; margin: auto;">
<img src="service_integration.png"
style="width: 100%; border-radius: 100%;">
</div>
<h3 class="oe_slogan"
style="text-align: center; font-size: 14px; width: 100%; margin: 0; margin-top: 14px; color: #000 !important; margin-top: 5px; opacity: 1 !important; line-height: 17px;">
Odoo <br>Integration
</h3>
</a>
</div>
<div style="flex-basis: 18%;">
<a href="https://mukit.at/r/xDJ" target="_blank">
<div
style="width: 75px; height: 75px; border-radius: 100%; margin: auto;">
<img src="service_customization.png"
style="width: 100%; border-radius: 100%;">
</div>
<h3 class="oe_slogan"
style="text-align: center; font-size: 14px; width: 100%; margin: 0; margin-top: 14px; color: #000 !important; margin-top: 5px; opacity: 1 !important; line-height: 17px;">
Odoo <br>Customization
</h3>
</a>
</div>
<div style="flex-basis: 18%;">
<a href=" https://mukit.at/r/J3A" target="_blank">
<div
style="width: 75px; height: 75px; border-radius: 100%; margin: auto;">
<img src="service_development.png"
style="width: 100%; border-radius: 100%;">
</div>
<h3 class="oe_slogan"
style="text-align: center; font-size: 14px; width: 100%; margin: 0; margin-top: 14px; color: #000 !important; margin-top: 5px; opacity: 1 !important; line-height: 17px;">
Odoo <br>Development
</h3>
</a>
</div>
<div style="flex-basis: 18%;">
<a href=" https://mukit.at/r/R1v" target="_blank">
<div
style="width: 75px; height: 75px; border-radius: 100%; margin: auto;">
<img src="service_support.png"
style="width: 100%; border-radius: 100%;">
</div>
<h3 class="oe_slogan"
style="text-align: center; font-size: 14px; width: 100%; margin: 0; margin-top: 14px; color: #000 !important; margin-top: 5px; opacity: 1 !important; line-height: 17px;">
Odoo <br>Support
</h3>
</a>
</div>
</div>
</div>
</section>
<section class="oe_container" style="padding: 32px 0;">
<div class="oe_row oe_spaced" style="margin: auto;">
<div class="oe_demo oe_picture oe_screenshot">
<a href="https://mukit.at/r/SgN" target="_blank"> <img
src="preview.png">
</a>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<h3 class="oe_slogan">Help and Support</h3>
<h5 class="oe_slogan" style="font-size: 20px;">Feel free to
contact us, if you need any help with your Odoo integration or
addiontal features.</h5>
<div class="oe_slogan">
<a class="btn btn-primary btn-lg mt8" href="https://mukit.at"
target="_blank"> <i class="fa fa-globe"></i> Website
</a> <a class="btn btn-primary btn-lg mt8" href="mailto:sale@mukit.at">
<i class="fa fa-envelope"></i> Contact Us
</a> <a class="btn btn-primary btn-lg mt8"
href="https://github.com/muk-it" target="_blank"> <i
class="fa fa-github"></i> Issues
</a>
</div>
<img src="logo.png"
style="width: 200px; margin-bottom: 20px; display: block;"
class="mx-auto center-block">
</section>

BIN
muk_saas_branding/static/description/logo.png

After

Width: 500  |  Height: 500  |  Size: 37 KiB

BIN
muk_saas_branding/static/description/preview.png

After

Width: 1000  |  Height: 200  |  Size: 32 KiB

BIN
muk_saas_branding/static/description/service_customization.png

After

Width: 250  |  Height: 250  |  Size: 27 KiB

BIN
muk_saas_branding/static/description/service_development.png

After

Width: 250  |  Height: 250  |  Size: 28 KiB

BIN
muk_saas_branding/static/description/service_implementation.png

After

Width: 250  |  Height: 250  |  Size: 26 KiB

BIN
muk_saas_branding/static/description/service_integration.png

After

Width: 250  |  Height: 250  |  Size: 24 KiB

BIN
muk_saas_branding/static/description/service_support.png

After

Width: 250  |  Height: 250  |  Size: 24 KiB

BIN
muk_saas_branding/static/src/img/favicon.ico

BIN
muk_saas_branding/static/src/img/logo.png

After

Width: 500  |  Height: 500  |  Size: 37 KiB

BIN
muk_saas_branding/static/src/img/nofavicon.ico

BIN
muk_saas_branding/static/src/img/nologo.png

After

Width: 500  |  Height: 500  |  Size: 37 KiB

369
muk_saas_branding/templates/database_manager.html

@ -0,0 +1,369 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>{{ system_name }}</title>
<link rel="shortcut icon" href="{{ system_favicon }}" type="image/x-icon">
<link rel="stylesheet" href="/web/static/lib/fontawesome/css/font-awesome.css">
<link rel="stylesheet" href="/web/static/lib/bootstrap/css/bootstrap.css">
<script src="/web/static/lib/jquery/jquery.js" type="text/javascript"></script>
<script type="text/javascript" src="/web/static/lib/popper/popper.js"></script>
<script type="text/javascript" src="/web/static/lib/bootstrap/js/index.js"></script>
<script type="text/javascript" src="/web/static/lib/bootstrap/js/util.js"></script>
<script type="text/javascript" src="/web/static/lib/bootstrap/js/alert.js"></script>
<script type="text/javascript" src="/web/static/lib/bootstrap/js/button.js"></script>
<script type="text/javascript" src="/web/static/lib/bootstrap/js/carousel.js"></script>
<script type="text/javascript" src="/web/static/lib/bootstrap/js/collapse.js"></script>
<script type="text/javascript" src="/web/static/lib/bootstrap/js/dropdown.js"></script>
<script type="text/javascript" src="/web/static/lib/bootstrap/js/modal.js"></script>
<script type="text/javascript" src="/web/static/lib/bootstrap/js/tooltip.js"></script>
<script type="text/javascript" src="/web/static/lib/bootstrap/js/popover.js"></script>
<script type="text/javascript" src="/web/static/lib/bootstrap/js/scrollspy.js"></script>
<script type="text/javascript" src="/web/static/lib/bootstrap/js/tab.js"></script>
<script type="text/javascript">
$(function() {
// Little eye
$('body').on('mousedown mouseup', '.o_little_eye', function (ev) {
$(ev.target).closest('.input-group').find('.form-control').prop('type', ev.type === 'mousedown' ? 'text' : 'password');
});
// db modal
$('body').on('click', '.o_database_action', function (ev) {
ev.preventDefault();
var db = $(ev.currentTarget).data('db');
var target = $(ev.currentTarget).data('target');
$(target).find('input[name=name]').val(db);
$(target).modal();
});
// close modal on submit
$('.modal').on('submit', 'form', function (ev) {
var modal = $(this).parentsUntil('body', '.modal');
if (modal.hasClass('o_database_backup')) {
$(modal).modal('hide');
if (!$('.alert-backup-long').length) {
$('.list-group').before("<div class='alert alert-info alert-backup-long'>The backup may take some time before being ready</div>");
}
}
});
});
</script>
</head>
{% macro master_input() -%}
<div class="form-group">
{% if insecure %}
<input type="hidden" name="master_pwd" class="form-control" value="admin"/>
{% else %}
<label for="master_pwd" class="col-form-label">Master Password</label>
<input id="master_pwd" type="password" name="master_pwd" class="form-control" required="required" autofocus="autofocus"/>
{% endif %}
</div>
{%- endmacro %}
{% macro create_form() -%}
{{ master_input() }}
<div class="form-group row">
<label for="name" class="col-md-4 col-form-label">Database Name</label>
<div class="col-md-8">
<input id="name" type="text" name="name" class="form-control" required="required" autocomplete="off" pattern="{{ pattern }}" title="Only alphanumerical characters, underscore, hyphen and dot are allowed"/>
</div>
</div>
<div class="form-group row">
<label for="login" class="col-md-4 col-form-label">Email</label>
<div class="col-md-8">
<input id="login" type="text" name="login" class="form-control" required="required" autocomplete="off"/>
</div>
</div>
<div class="form-group row">
<label for="password" class="col-md-4 col-form-label">Password</label>
<div class="col-md-8 input-group">
<input id="password" type="password" name="password" class="form-control" required="required" autocomplete="off"/>
<div class="input-group-append">
<span class="fa fa-eye o_little_eye input-group-text" aria-hidden="true" style="cursor: pointer;"></span>
</div>
</div>
</div>
<div class="form-group row">
<label for="phone" class="col-md-4 col-form-label">Phone number</label>
<div class="col-md-8 input-group">
<input id="phone" type="tel" name="phone" class="form-control" autocomplete="off"/>
</div>
</div>
<div class="form-group row">
<label for="lang" class="col-md-4 col-form-label">Language</label>
<div class="col-md-8">
<select id="lang" name="lang" class="form-control" required="required" autocomplete="off">
{% for lang in langs %}
<option {% if lang[0] == "en_US" %}selected="selected" {% endif %}value="{{ lang[0] }}">{{ lang[1] }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-group row">
<label for="country" class="col-md-4 col-form-label ">Country</label>
<div class="col-md-8">
<select id="country" name="country_code" class="form-control" autocomplete="off">
<option value=""></option>
{% for country in countries %}
<option value="{{ country[0] }}">{{ country[1] }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-group row">
<label for="demo" class="col-md-4 col-form-label">Demo data</label>
<div class="col-md-8">
<input type="checkbox" id="load_demo_checkbox" class="form-control-sm" name="demo" value="1">
</div>
</div>
{%- endmacro %}
<body>
<div class="container">
<!-- Database List -->
<div class="row">
<div class="col-lg-6 offset-lg-3 o_database_list">
<img src="{{ system_logo }}" class="img-fluid d-block mx-auto"/>
{% if not list_db %}
<div class="alert alert-danger text-center">The database manager has been disabled by the administrator</div>
{% elif insecure and databases %}
<div class="alert alert-warning">
Warning, your {{ system_name }} database manager is not protected.<br/>
Please <a href="#" data-toggle="modal" data-target=".o_database_master">set a master password</a> to secure it.
</div>
{% endif %}
{% if error %}
<div class="alert alert-danger">{{ error }}</div>
{% endif %}
{% if list_db and databases %}
<div class="list-group">
{% for db in databases %}
<div class="list-group-item d-flex align-items-center">
<a href="/web?db={{ db }}" class="d-block flex-grow-1">
{% if db in incompatible_databases %}
<i class="icon fa fa-warning float-right text-warning" title="This database may not be compatible"></i>
{% endif %}
{{ db }}
</a>
{% if manage %}
<div class="btn-group btn-group-sm float-right">
<button type="button" data-db="{{ db }}" data-target=".o_database_backup" class="o_database_action btn btn-primary">
<i class="fa fa-floppy-o fa-fw"></i> Backup
</button>
<button type="button" data-db="{{ db }}" data-target=".o_database_duplicate" class="o_database_action btn btn-secondary">
<i class="fa fa-files-o fa-fw"></i> Duplicate
</button>
<button type="button" data-db="{{ db }}" data-target=".o_database_delete" class="o_database_action btn btn-danger">
<i class="fa fa-trash-o fa-fw"></i> Delete
</button>
</div>
{% endif %}
</div>
{% endfor %}
</div>
{% if manage %}
<div class="d-flex mt-2">
<button type="button" data-toggle="modal" data-target=".o_database_create" class="btn btn-primary flex-grow-1">Create Database</button>
<button type="button" data-toggle="modal" data-target=".o_database_restore" class="btn btn-primary flex-grow-1 ml-2">Restore Database</button>
<button type="button" data-toggle="modal" data-target=".o_database_master" class="btn btn-primary flex-grow-1 ml-2">Set Master Password</button>
</div>
{% else %}
<div class="text-center mt-2">
<a href="/web/database/manager">Manage databases</a>
</div>
{% endif %}
{% elif list_db %}
<form role="form" action="/web/database/create" method="post">
{{ create_form() }}
<input type="submit" value="Create database" class="btn btn-primary float-left"/>
</form>
<a role="button" data-toggle="modal" data-target=".o_database_restore" class="btn btn-link">or restore a database</a>
{% endif %}
</div>
</div>
</div>
<!-- Create -->
<div class="modal fade o_database_create" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<form role="form" action="/web/database/create" method="post">
<div class="modal-header">
<h4 class="modal-title">Create Database</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div>
<div class="modal-body">
{{ create_form() }}
<small class="text-muted">
To enhance your experience, some data may be sent to {{ system_name }} online services. See our <a href="{{ system_name }}">Privacy Policy</a>.
</small>
</div>
<div class="modal-footer">
<input type="submit" value="Continue" class="btn btn-primary float-right"/>
</div>
</form>
</div>
</div>
</div>
<!-- Restore -->
<div class="modal fade o_database_restore" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Restore Database</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div>
<form id="form_restore_db" role="form" action="/web/database/restore" method="post" enctype="multipart/form-data">
<div class="modal-body">
{{ master_input() }}
<div class="form-group">
<label for="backup_file" class="col-form-label">File</label>
<input id="backup_file" type="file" name="backup_file" class="required"/>
</div>
<div class="form-group">
<label for="name" class="col-form-label">Database Name</label>
<input id="name" type="text" name="name" class="form-control" required="required" pattern="{{ pattern }}" title="Only alphanumerical characters, underscore, hyphen and dot are allowed"/>
</div>
<div class="form-group">
<label for="copy">This database might have been moved or copied.</label>
<p class="form-text">
In order to avoid conflicts between databases, {{ system_name }} needs to know if this database was moved or copied.<br/>
If you don't know, answer "This database is a copy".
</p>
<div class="custom-control custom-radio">
<input id="radio_copy_true" name="copy" type="radio" class="custom-control-input" value="true" checked="1">
<label for="radio_copy_true" class="custom-control-label">This database is a copy</label>
</div>
<div class="custom-control custom-radio">
<input id="radio_copy_false" name="copy" type="radio" class="custom-control-input" value="false">
<label for="radio_copy_false" class="custom-control-label">This database was moved</label>
</div>
</div>
</div>
<div class="modal-footer">
<input type="submit" value="Continue" class="btn btn-primary float-right"/>
</div>
</form>
</div>
</div>
</div>
<!-- Master password -->
<div class="modal fade o_database_master" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Set Master Password</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div>
<form id="form_change_pwd" role="form" action="/web/database/change_password" method="post">
<div class="modal-body">
<p>The master password is required to create, delete, dump or restore databases.</p>
{{ master_input() }}
<div class="form-group">
<label for="master_pwd_new" class="col-form-label">New Master Password</label>
<div class="input-group">
<input id="master_pwd_new" type="password" name="master_pwd_new" class="form-control" required="required" autocomplete="off"/>
<div class="input-group-append">
<span class="fa fa-eye o_little_eye input-group-text" aria-hidden="true" style="cursor: pointer;"></span>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<input type="submit" value="Continue" class="btn btn-primary float-right"/>
</div>
</form>
</div>
</div>
</div>
<!-- Duplicate DB -->
<div class="modal fade o_database_duplicate" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Duplicate Database</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div>
<form id="form-duplicate-db" role="form" action="/web/database/duplicate" method="post">
<div class="modal-body">
{{ master_input() }}
<div class="form-group">
<label for="name" class="col-form-label">Database Name</label>
<input id="name" type="text" name="name" class="form-control" required="required" readonly="readonly"/>
</div>
<div class="form-group">
<label for="new_name" class="col-form-label">New Name</label>
<input id="new_name" type="text" name="new_name" class="form-control" required="required" pattern="{{ pattern }}" title="Only alphanumerical characters, underscore, hyphen and dot are allowed"/>
</div>
</div>
<div class="modal-footer">
<input type="submit" value="Continue" class="btn btn-primary float-right"/>
</div>
</form>
</div>
</div>
</div>
<!-- Drop DB -->
<div class="modal fade o_database_delete" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Delete Database</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div>
<form id="form_drop_db" role="form" action="/web/database/drop" method="post">
<div class="modal-body">
{{ master_input() }}
<div class="form-group">
<label for="name" class="col-form-label">Database</label>
<input id="name" type="text" name="name" class="form-control" required="required" readonly="readonly"/>
</div>
</div>
<div class="modal-footer">
<input type="submit" value="Delete" class="btn btn-primary float-right"/>
</div>
</form>
</div>
</div>
</div>
<!-- Backup DB -->
<div class="modal fade o_database_backup" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Backup Database</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div>
<form id="form_backup_db" role="form" action="/web/database/backup" method="post">
<div class="modal-body">
{{ master_input() }}
<div class="form-group">
<label for="name" class="col-form-label">Database Name</label>
<input id="name" type="text" name="name" class="form-control" required="required" readonly="readonly"/>
</div>
<div class="form-group">
<label for="backup_format" class="col-form-label">Backup Format</label>
<select id="backup_format" name="backup_format" class="form-control" required="required">
<option value="zip">zip (includes filestore)</option>
<option value="dump">pg_dump custom format (without filestore)</option>
</select>
</div>
</div>
<div class="modal-footer">
<input type="submit" value="Backup" class="btn btn-primary float-right"/>
</div>
</form>
</div>
</div>
</div>
</body>
</html>

23
muk_saas_branding/tools/__init__.py

@ -0,0 +1,23 @@
###################################################################################
#
# Copyright (c) 2017-2019 MuK IT GmbH.
#
# This file is part of MuK Branding
# (see https://mukit.at).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###################################################################################
from . import utils

38
muk_saas_branding/tools/utils.py

@ -0,0 +1,38 @@
###################################################################################
#
# Copyright (c) 2017-2019 MuK IT GmbH.
#
# This file is part of MuK Utils
# (see https://mukit.at).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###################################################################################
import logging
_logger = logging.getLogger(__name__)
#----------------------------------------------------------
# Safe Execute
#----------------------------------------------------------
def safe_execute_exception(default, exception, function, *args, **kwargs):
try:
return function(*args, **kwargs)
except exception:
return default
def safe_execute(default, function, *args, **kwargs):
return safe_execute_exception(default, Exception, function, *args, **kwargs)
Loading…
Cancel
Save