diff --git a/odoo-debrand/README.rst b/odoo-debrand/README.rst new file mode 100644 index 000000000..c077468eb --- /dev/null +++ b/odoo-debrand/README.rst @@ -0,0 +1,56 @@ +.. image:: https://img.shields.io/badge/licence-GPL--3-blue.svg + :target: http://www.gnu.org/licenses/gpl-3.0-standalone.html + :alt: License: GPL-3 + +=============== +Odoo Debranding +=============== + +Debranding of odoo with the given configurations under Website Admin -> Debranding Configurations. +Will replace: + - Page Title + - Odoo from Popups + - Settings Odoo branding Items + - User Drop down Odoo links + - Website Title, footer + - Powered By Odoo on Backend by your company name + - Odoo label from Dialogues + - Odoo Database Selector Logo, Labels + - Copyright @odoo with your company on website page + + + + +Installation +============ + +To install this module from odoo apps after updating the app list. + + +Usage +===== + +Fill the configuration under Website Admin. Clear Browser Image caches after installing the module. + +Known issues / Roadmap +====================== + +* ... + +Bug Tracker +=========== + +Contact odoo@cybrosys.com + + +Contributors +------------ + +* Tintuk Tomin + +Maintainer +---------- + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com. diff --git a/odoo-debrand/__init__.py b/odoo-debrand/__init__.py new file mode 100644 index 000000000..9e5827f90 --- /dev/null +++ b/odoo-debrand/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- +from . import controllers +from . import models diff --git a/odoo-debrand/__manifest__.py b/odoo-debrand/__manifest__.py new file mode 100644 index 000000000..7a1e4b235 --- /dev/null +++ b/odoo-debrand/__manifest__.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +{ + 'name': "Odoo Debranding", + 'version': "12.0.1.0", + 'summary': """Debrand Odoo""", + 'description': """Debrand Odoo""", + 'author': "Cybrosys Techno Solutions", + 'company': "Cybrosys Techno Solutions", + 'website': "https://cybrosys.com/", + 'category': 'Tools', + 'depends': ['base', 'im_livechat', 'website'], + 'data': [ + 'views/views.xml'], + 'demo': [], + 'qweb': ["static/src/xml/base.xml"], + 'images': ['static/description/banner.png'], + 'license': "LGPL-3", + 'installable': True, + 'application': False +} diff --git a/odoo-debrand/controllers/__init__.py b/odoo-debrand/controllers/__init__.py new file mode 100644 index 000000000..457bae27e --- /dev/null +++ b/odoo-debrand/controllers/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import controllers \ No newline at end of file diff --git a/odoo-debrand/controllers/controllers.py b/odoo-debrand/controllers/controllers.py new file mode 100644 index 000000000..2490cf78b --- /dev/null +++ b/odoo-debrand/controllers/controllers.py @@ -0,0 +1,109 @@ +# -*- coding: utf-8 -*- +import imghdr +import json +import io +import base64 +import functools +from odoo import http, tools +import odoo, os, sys, jinja2 +from odoo.addons.web.controllers.main import Database +from odoo.addons.web.controllers import main +from odoo.tools.mimetypes import guess_mimetype +from odoo.addons.web.controllers.main import Binary +from odoo.modules import get_resource_path +from io import StringIO +from odoo.http import request + +if hasattr(sys, 'frozen'): + # When running on compiled windows binary, we don't have access to package loader. + path = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', 'views')) + loader = jinja2.FileSystemLoader(path) +else: + loader = jinja2.PackageLoader('odoo.addons.odoo-debrand', "views") +env = main.jinja2.Environment(loader=loader, autoescape=True) +env.filters["json"] = json.dumps +db_monodb = http.db_monodb +DBNAME_PATTERN = '^[a-zA-Z0-9][a-zA-Z0-9_.-]+$' + + +class BinaryCustom(Binary): + @http.route([ + '/web/binary/company_logo', + '/logo', + '/logo.png', + ], type='http', auth="none") + def company_logo(self, dbname=None, **kw): + imgname = 'logo' + imgext = '.png' + placeholder = functools.partial(get_resource_path, 'web', 'static', 'src', 'img') + uid = None + if request.session.db: + dbname = request.session.db + uid = request.session.uid + elif dbname is None: + dbname = db_monodb() + + if not uid: + uid = odoo.SUPERUSER_ID + + if not dbname: + response = http.send_file(placeholder(imgname + imgext)) + else: + try: + # create an empty registry + registry = odoo.modules.registry.Registry(dbname) + with registry.cursor() as cr: + company = int(kw['company']) if kw and kw.get('company') else False + if company: + cr.execute("""SELECT logo_web, write_date + FROM res_company + WHERE id = %s + """, (company,)) + else: + cr.execute("""SELECT c.logo_web, c.write_date + FROM res_users u + LEFT JOIN res_company c + ON c.id = u.company_id + WHERE u.id = %s + """, (uid,)) + row = cr.fetchone() + if row and row[0]: + image_base64 = base64.b64decode(row[0]) + image_data = io.BytesIO(image_base64) + mimetype = guess_mimetype(image_base64, default='image/png') + imgext = '.' + mimetype.split('/')[1] + if imgext == '.svg+xml': + imgext = '.svg' + response = http.send_file(image_data, filename=imgname + imgext, mimetype=mimetype, + mtime=row[1]) + else: + response = http.send_file(placeholder('nologo.png')) + except Exception: + response = http.send_file(placeholder(imgname + imgext)) + + return response + + +class OdooDebrand(Database): + def _render_template(self, **d): + d.setdefault('manage', True) + d['insecure'] = odoo.tools.config.verify_admin_password('admin') + d['list_db'] = odoo.tools.config['list_db'] + d['langs'] = odoo.service.db.exp_list_lang() + d['countries'] = odoo.service.db.exp_list_countries() + d['pattern'] = DBNAME_PATTERN + website_id = request.env['website'].sudo().search([]) + d['website_name'] = website_id and website_id[0].name or '' + d['favicon']= website_id and website_id[0].favicon_url or '' + d['company_logo_url'] = website_id and website_id[0].company_logo_url or '' + + # databases list + d['databases'] = [] + try: + d['databases'] = http.db_list() + d['incompatible_databases'] = odoo.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_extend.html").render(d) diff --git a/odoo-debrand/doc/changelog.rst b/odoo-debrand/doc/changelog.rst new file mode 100644 index 000000000..4d4886673 --- /dev/null +++ b/odoo-debrand/doc/changelog.rst @@ -0,0 +1,7 @@ +Changelog +========= + +`12.0.1.0.0` +------------ +- Initial commit + diff --git a/odoo-debrand/models/__init__.py b/odoo-debrand/models/__init__.py new file mode 100644 index 000000000..cde864bae --- /dev/null +++ b/odoo-debrand/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models diff --git a/odoo-debrand/models/models.py b/odoo-debrand/models/models.py new file mode 100644 index 000000000..51a371293 --- /dev/null +++ b/odoo-debrand/models/models.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +import base64 +import os +from odoo import models, fields, api, tools + + +class OdooDebrand(models.Model): + _inherit = "website" + + + def get_company_logo(self): + id = self.env.user.company_id.id + self.company_logo_url ="/web/image/res.company/%s/logo"%(id) + + def get_favicon(self): + id = self.env['website'].sudo().search([]) + + self.favicon_url ="/web/image/website/%s/favicon"%(id[0].id) + print("Wesite = ", self.favicon_url) + + company_logo = fields.Binary() + favicon_url = fields.Text("Url", compute='get_favicon') + company_logo_url = fields.Text("Url", compute='get_company_logo') diff --git a/odoo-debrand/security/ir.model.access.csv b/odoo-debrand/security/ir.model.access.csv new file mode 100644 index 000000000..abb2b62ff --- /dev/null +++ b/odoo-debrand/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_odoo-debrand_odoo-debrand,odoo-debrand.odoo-debrand,model_odoo-debrand_odoo-debrand,,1,1,1,1 \ No newline at end of file diff --git a/odoo-debrand/static/description/banner.png b/odoo-debrand/static/description/banner.png new file mode 100644 index 000000000..9e58fd6d2 Binary files /dev/null and b/odoo-debrand/static/description/banner.png differ diff --git a/odoo-debrand/static/description/cybro_logo.png b/odoo-debrand/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/odoo-debrand/static/description/cybro_logo.png differ diff --git a/odoo-debrand/static/description/cybrosys-odoo-debranding-1.jpg b/odoo-debrand/static/description/cybrosys-odoo-debranding-1.jpg new file mode 100644 index 000000000..ff2227ddf Binary files /dev/null and b/odoo-debrand/static/description/cybrosys-odoo-debranding-1.jpg differ diff --git a/odoo-debrand/static/description/cybrosys-odoo-debranding-2.jpg b/odoo-debrand/static/description/cybrosys-odoo-debranding-2.jpg new file mode 100644 index 000000000..b9161600b Binary files /dev/null and b/odoo-debrand/static/description/cybrosys-odoo-debranding-2.jpg differ diff --git a/odoo-debrand/static/description/cybrosys-odoo-debranding-3.jpg b/odoo-debrand/static/description/cybrosys-odoo-debranding-3.jpg new file mode 100644 index 000000000..4c9c7f86b Binary files /dev/null and b/odoo-debrand/static/description/cybrosys-odoo-debranding-3.jpg differ diff --git a/odoo-debrand/static/description/cybrosys-odoo-debranding-4.jpg b/odoo-debrand/static/description/cybrosys-odoo-debranding-4.jpg new file mode 100644 index 000000000..cecad49f4 Binary files /dev/null and b/odoo-debrand/static/description/cybrosys-odoo-debranding-4.jpg differ diff --git a/odoo-debrand/static/description/cybrosys-odoo-debranding-5.jpg b/odoo-debrand/static/description/cybrosys-odoo-debranding-5.jpg new file mode 100644 index 000000000..45bf7dcb2 Binary files /dev/null and b/odoo-debrand/static/description/cybrosys-odoo-debranding-5.jpg differ diff --git a/odoo-debrand/static/description/cybrosys-odoo-debranding-6.jpg b/odoo-debrand/static/description/cybrosys-odoo-debranding-6.jpg new file mode 100644 index 000000000..3d81182bf Binary files /dev/null and b/odoo-debrand/static/description/cybrosys-odoo-debranding-6.jpg differ diff --git a/odoo-debrand/static/description/icon.png b/odoo-debrand/static/description/icon.png new file mode 100644 index 000000000..ab8f8330e Binary files /dev/null and b/odoo-debrand/static/description/icon.png differ diff --git a/odoo-debrand/static/description/index.html b/odoo-debrand/static/description/index.html new file mode 100644 index 000000000..65565497e --- /dev/null +++ b/odoo-debrand/static/description/index.html @@ -0,0 +1,399 @@ + +
+
+

+ Odoo Debranding +

+

+ Debrand Odoo Back-end + Front-End +

+
+ Cybrosys Technologies +
+ +
+ cybrosys technologies
+
+
+
+ +
+
+

+ Overview +

+

+ Want to debrand your company website? Odoo Debranding module developed by Cybrosys Technologies + helps you to change the aesthetic look of Odoo software via customizing them + with Logo and other branding changes. The module helps you to change almost every area of Odoo visuals, + delivering a brand new customized website. +

+

+ Configuration +

+

+ In Odoo 12 some of the debranding features are already removed compared to odoo 11. Branding like powered by in + both front end and back end is removed and website footer and copyright is already changed to company name in Odoo 12. +

+ So in this debranding app, you need to set up the company logo, website name & favicon by your own from the settings option. +

+
+
+ +
+
+

+ Features +

+

+ + Modify database selector page +

+

+ + Modify login page +

+

+ + Remove Odoo's default favicon +

+

+ + Updated "About" list +

+

+ + Removed advertisements from the settings page +

+

+ + Updated warning messages +

+

+ + Page title modification +

+ +
+
+ +
+
+

+ Screenshots +

+

+ + As you see in the settings option you need to set up the Website name & favicon then only the change will be affected + in the title. Also you need to setup the company logo from the settings page to change the default logo. +

+
+ +
+

+
+ Company logo in login page.
+

+
+ +
+

+
+ Powered by in the front-end is removed.
+
+ Default title is changed.
+

+
+ +
+

+ + Updated the Odoo title in the messages. +

+
+ +
+

+
+ Updated the Odoo title in the warning message
+

+
+ +
+

+
+ Odoo promotional banners in the settings dashboard page is changed.
+
+ Odoo accounts and documentation is removed from the dropdown list.
+

+
+ +
+
+
+
+
+ cybrosys technologies +
+
+ +
+
+

+ Our Services +

+
+ + + +
+ +
+ + + +
+

+ + Odoo Support +

+ +
+ +
+
+
+
+
+

+ Our Industries +

+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Trading + +

+

+ Easily procure and sell your products. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Manufacturing +

+

+ Plan, track and schedule your operations. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Restaurant +

+

+ Run your bar or restaurant methodical. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + POS +

+

+ Easy configuring and convivial selling. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + E-commerce & Website +

+

+ Mobile friendly, awe-inspiring product pages. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Hotel Management +

+

+ An all-inclusive hotel management application. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Education +

+

+ A Collaborative platform for educational management. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Service Management +

+

+ Keep track of services and invoice accordingly. +

+
+
+
+
+
+
+ +
diff --git a/odoo-debrand/static/src/js/title.js b/odoo-debrand/static/src/js/title.js new file mode 100644 index 000000000..792c15dba --- /dev/null +++ b/odoo-debrand/static/src/js/title.js @@ -0,0 +1,99 @@ +odoo.define('odoo-debrand-11.title', function(require) { +"use strict"; + +var core = require('web.core'); +var utils = require('web.utils'); +var ajax = require('web.ajax'); +var Dialog = require('web.Dialog'); +var WebClient = require('web.AbstractWebClient'); +var CrashManager = require('web.CrashManager'); // We can import crash_manager also + +console.log("CrashManager",CrashManager) +var concurrency = require('web.concurrency'); +var mixins = require('web.mixins'); +var session = require('web.session'); + +var QWeb = core.qweb; +var _t = core._t; +var _lt = core._lt; +var name = " "; + + +var map_title ={ + user_error: _lt('Warning'), + warning: _lt('Warning'), + access_error: _lt('Access Error'), + missing_error: _lt('Missing Record'), + validation_error: _lt('Validation Error'), + except_orm: _lt('Global Business Error'), + access_denied: _lt('Access Denied'), +}; + +var myWebClient = WebClient.include({ +init: function (parent) { + this._super(); + var obj = this + this._rpc({ + fields: ['name',], + domain: [], + model: 'website', + method: 'search_read', + limit: 1, + context: session.user_context, + }).done(function(result){ + obj.set('title_part', {"zopenerp": result[0].name}); + }); + }, +}); + +var ExceptionHandler = { + /** + * @param parent The parent. + * @param error The error object as returned by the JSON-RPC implementation. + */ + init: function(parent, error) {}, + /** + * Called to inform to display the widget, if necessary. A typical way would be to implement + * this interface in a class extending instance.web.Dialog and simply display the dialog in this + * method. + */ + display: function() {}, +}; + +var RedirectWarningHandler = Dialog.extend(ExceptionHandler, { + init: function(parent, error) { + this._super(parent); + this.error = error; + }, + display: function() { + var self = this; + var error = this.error; + error.data.message = error.data.arguments[0]; + + new Dialog(this, { + size: 'medium', + title: _.str.capitalize(error.type) || _t("Warning"), + buttons: [ + {text: error.data.arguments[2], classes : "btn-primary", click: function() { + window.location.href = '#action='+error.data.arguments[1]; + self.destroy(); + }}, + {text: _t("Cancel"), click: function() { self.destroy(); }, close: true} + ], + $content: QWeb.render('CrashManager.warning', {error: error}), + }).open(); + } +}); +core.crash_registry.add('odoo.exceptions.RedirectWarning', RedirectWarningHandler); + +function session_expired(cm) { + return { + display: function () { + cm.show_warning({type: _t("Session Expired"), data: {message: _t("Your Odoo session expired. Please refresh the current web page.")}}); + } + } +} +core.crash_registry.add('odoo.http.SessionExpiredException', session_expired); + + +}); diff --git a/odoo-debrand/static/src/xml/base.xml b/odoo-debrand/static/src/xml/base.xml new file mode 100644 index 000000000..66a53ecd7 --- /dev/null +++ b/odoo-debrand/static/src/xml/base.xml @@ -0,0 +1,37 @@ + + + + + + + + + + +
+ + + + + + Your permission is required to enable desktop notifications. + + + \ No newline at end of file diff --git a/odoo-debrand/views/database_manager_extend.html b/odoo-debrand/views/database_manager_extend.html new file mode 100644 index 000000000..9a724d035 --- /dev/null +++ b/odoo-debrand/views/database_manager_extend.html @@ -0,0 +1,363 @@ + + + + + {{ website_name }} + + + + + + + + + + + + + + + + + + + + + +{% macro master_input() -%} +
+ {% if insecure %} + + {% else %} + + + {% endif %} +
+{%- endmacro %} + +{% macro create_form() -%} +

Odoo is up and running!
+ Create a new database by filling out the form, + you'll be able to install your first app in a minute.

+ {{ master_input() }} +
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+ + + +
+
+
+
+ + +
+
+ + +
+
+
+
+
+ +
+
+{%- endmacro %} + + + +
+
+
+ +
+ {% if insecure and databases %} +
+ + Warning, {{ company_name }} database manager is not protected. + Please set a master password + to secure it. +
+ {% endif %} + {% if error %} +
{{ error }}
+ {% endif %} + {% if databases %} + + {% if manage %} +
+ + + +
+ {% else %} + + {% endif %} + {% else %} +
+ {{ create_form() }} + +
+ + or restore a database + + {% endif %} +
+
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/odoo-debrand/views/views.xml b/odoo-debrand/views/views.xml new file mode 100644 index 000000000..c9df26ff7 --- /dev/null +++ b/odoo-debrand/views/views.xml @@ -0,0 +1,42 @@ + + + + +