diff --git a/odex25_base/web_debranding/README.rst b/odex25_base/web_debranding/README.rst new file mode 100644 index 000000000..610ad3ca1 --- /dev/null +++ b/odex25_base/web_debranding/README.rst @@ -0,0 +1,68 @@ +.. image:: https://itpp.dev/images/infinity-readme.png + :alt: Tested and maintained by IT Projects Labs + :target: https://itpp.dev + +.. image:: https://img.shields.io/badge/license-MIT-blue.svg + :target: https://opensource.org/licenses/MIT + :alt: License: MIT + +==================== + Backend debranding +==================== + +Build and enhance brand by removing references to `odoo.com `__ and customizing company logo, favicon, page title, etc. + +1. *(feature is not required in 12.0+ versions)* +2. Replaces **Odoo** in page title +3. Replaces **Odoo** in help message for empty list +4. *(feature is not required in 9.0+ versions)* +5. Deletes Documentation, Support, About links from the top right-hand User Menu. +6. *(feature is not required in 11.0+ versions)* +7. Replaces **Odoo** in Dialog Box +8. Replaces **Odoo** in strings marked for translation +9. Replaces default favicon to a custom one +10. Hides Apps menu (by default, only Super User can see Apps menu. You could change it via tick "Show Modules Menu" in user's access rights tab. +11. Disables server requests to odoo.com (publisher_warranty_url) - optional. Works only for non-enterprise versions of odoo +12. *(feature is a part of p.5)* +13. *(feature is not required in 13.0+ versions)* +14. *(feature is not required in 12.0+ versions)* +15. *(feature is not required in 12.0+ versions)* +16. *(feature is not required in 12.0+ versions)* +17. ``[ENTERPRISE]`` Deletes odoo logo in application switcher +18. Hides Enterprise features in Settings +19. Replaces **Odoo** in all backend qweb templates (e.g. FAQ in import tool) +20. Replaces **odoo.com** in hints, examples, etc. +21. Renames **OdooBot** to *Bot*. Uses company's logo as bot avatar +22. ``[ENTERPRISE]`` Replaces icons for android and apple devices with custom url +23. Replaces links to `documentation `__ (e.g. "Help" in Import tool, "How-to" in paypal, etc.) to custom website +24. *(feature is not required in 12.0+ versions)* +25. *(feature is not required in 12.0+ versions)* +26. Deletes Google Play, Apps Store apps links +27. Replaces **Powered by Odoo** in emails +28. Deletes **Powered by Odoo** in Website (when installed) +29. Hides iap links in Settings + + +Roadmap +======= + +* TODO: replace hardcoded placeholders and make them based on `web_debranding.new_website` + +Questions? +========== + +To get an assistance on this module contact us by email :arrow_right: help@itpp.dev + +Contributors +============ +* `Ivan Yelizariev `__ + + +Further information +=================== + +Odoo Apps Store: https://www.odoo.com/apps/modules/14.0/web_debranding/ + +Notifications on updates: `via Atom `_, `by Email `_ + +Tested on `Odoo 14.0 `_ diff --git a/odex25_base/web_debranding/__init__.py b/odex25_base/web_debranding/__init__.py new file mode 100644 index 000000000..33240f219 --- /dev/null +++ b/odex25_base/web_debranding/__init__.py @@ -0,0 +1,18 @@ +# License MIT (https://opensource.org/licenses/MIT). + +from . import models +from . import controllers + +from odoo import SUPERUSER_ID, api + +MODULE = "_web_debranding" + + +def uninstall_hook(cr, registry): + env = api.Environment(cr, SUPERUSER_ID, {}) + env["ir.model.data"]._module_data_uninstall([MODULE]) + + +def post_load(): + + from . import fields diff --git a/odex25_base/web_debranding/__manifest__.py b/odex25_base/web_debranding/__manifest__.py new file mode 100644 index 000000000..4678a9094 --- /dev/null +++ b/odex25_base/web_debranding/__manifest__.py @@ -0,0 +1,46 @@ +# Copyright 2015-2021 Ivan Yelizariev +# Copyright 2017 Ilmir Karamov +# Copyright 2018-2019 Kolushov Alexandr +# Copyright 2018 Ildar Nasyrov +# Copyright 2018 WohthaN +# Copyright 2019-2020 Eugene Molotov +# Copyright 2020 Denis Mudarisov +# License MIT (https://opensource.org/licenses/MIT). +# License OPL-1 (https://www.odoo.com/documentation/user/14.0/legal/licenses/licenses.html#odoo-apps) for derivative work. +{ + "name": "Backend debranding", + "version": "14.0.1.1.2", + "author": "IT-Projects LLC, Ivan Yelizariev", + "license": "OPL-1", + "category": "Debranding", + "images": ["images/web_debranding.png"], + "website": "https://odoo-debranding.com", + "support": "apps@itpp.dev", + "price": 300.00, + "currency": "EUR", + "depends": [ + "base_setup", + "web", + "mail", + "access_settings_menu", + "mail_bot", + "base", + ], + "external_dependencies": {"python": ["lxml"]}, + "data": [ + "data.xml", + "views.xml", + "js.xml", + "pre_install.xml", + "views/res_config.xml", + ], + "qweb": [ + "static/src/xml/bot.xml", + "static/src/xml/web.xml", + ], + "post_load": "post_load", + "auto_install": False, + "uninstall_hook": "uninstall_hook", + "installable": True, + "saas_demo_title": "Backend debranding demo", +} diff --git a/odex25_base/web_debranding/controllers/__init__.py b/odex25_base/web_debranding/controllers/__init__.py new file mode 100644 index 000000000..9153c2c3a --- /dev/null +++ b/odex25_base/web_debranding/controllers/__init__.py @@ -0,0 +1,3 @@ +# License MIT (https://opensource.org/licenses/MIT). + +from . import main diff --git a/odex25_base/web_debranding/controllers/main.py b/odex25_base/web_debranding/controllers/main.py new file mode 100644 index 000000000..b9da223fc --- /dev/null +++ b/odex25_base/web_debranding/controllers/main.py @@ -0,0 +1,88 @@ +# Copyright 2015-2018,2020 Ivan Yelizariev +# Copyright 2016 Stanislav Krotov +# Copyright 2017 Ilmir Karamov +# Copyright 2017 Nicolas JEUDY +# Copyright 2017 Ildar Nasyrov +# Copyright 2018 Kolushov Alexandr +# License MIT (https://opensource.org/licenses/MIT). +# License OPL-1 (https://www.odoo.com/documentation/user/14.0/legal/licenses/licenses.html#odoo-apps) for derivative work. + +import base64 +import functools +import io + +import odoo +from odoo import http +from odoo.http import request +from odoo.modules import get_module_resource + +from odoo.addons.web.controllers.main import Binary, WebClient + +from ..models.ir_translation import debrand_bytes + +db_monodb = http.db_monodb + + +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.png" + default_logo_module = "web_debranding" + if request.session.db: + default_logo_module = ( + request.env["ir.config_parameter"] + .sudo() + .get_param("web_debranding.default_logo_module") + ) + placeholder = functools.partial( + get_module_resource, default_logo_module, "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)) + else: + try: + # create an empty registry + registry = odoo.modules.registry.Registry(dbname) + with registry.cursor() as cr: + 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_data = io.BytesIO(base64.b64decode(row[0])) + response = http.send_file( + image_data, filename=imgname, mtime=row[1] + ) + else: + response = http.send_file(placeholder("nologo.png")) + except Exception: + response = http.send_file(placeholder(imgname)) + return response + + +class WebClientCustom(WebClient): + @http.route() + def qweb(self, *args, **kwargs): + response = super(WebClientCustom, self).qweb(*args, **kwargs) + data = response.get_data() + data = debrand_bytes(request.session.db and request.env or None, data) + response.set_data(data) + return response diff --git a/odex25_base/web_debranding/data.xml b/odex25_base/web_debranding/data.xml new file mode 100644 index 000000000..dfdfd3ca6 --- /dev/null +++ b/odex25_base/web_debranding/data.xml @@ -0,0 +1,14 @@ + + + + + web_debranding.default_logo_module + web_debranding + + + Bot + bot@example.com + + diff --git a/odex25_base/web_debranding/doc/changelog.rst b/odex25_base/web_debranding/doc/changelog.rst new file mode 100644 index 000000000..8212bafa7 --- /dev/null +++ b/odex25_base/web_debranding/doc/changelog.rst @@ -0,0 +1,194 @@ +`1.1.2` +-------- + +- **Fix:** fix `search_count` method for `payment.acquirer` + +`1.1.1` +-------- + +- **Fix:** Debrand "session expired" popup + +`1.1.0` +-------- + +- **New:** delete iap links in Settings +- **Fix:** hide Enterprise checkboxes in Settings + +`1.0.32` +-------- + +- **Fix:** add missing dependency ``mail_bot`` + +`1.0.31` +-------- + +- **Fix:** delete Odoo placeholders in user's preferences + +`1.0.30` +-------- + +- **Fix:** delete "Powered by Odoo" in website + +`1.0.29` +-------- + +- **Fix:** error in Discuss menu on first usage + +`1.0.28` +-------- + +**Fix:** debrand_bytes now accepts bytes and str types +**Fix:** fixed "OdooBot has a request" item in notifications +**Fix:** included mail_channel fixes + +`1.0.27` +-------- + +**Fix:** error on res.config form opening + +`1.0.26` +-------- + +- FIX: developer mode was availabile via dropdown menu for non-admins + +`1.0.25` +-------- + +- FIX: error in Planner + +`1.0.24` +-------- + +- FIX: Save\Create button didn't react in ``Point of Sale`` records + +`1.0.23` +-------- + +- FIX: Debranding problems after introducing new features + +`1.0.22` +-------- + +- FIX: method create didn't work via xmlrpc (e.g. on using Mail Composer) + +`1.0.21` +-------- + +- FIX: In some cases, default parameters were used instead of custom ones + +`1.0.20` +-------- + +- FIX: Hiding a custom logo +- FIX: Error when creating second empty database +- FIX: Remove official videos in planner +- FIX: Replace "Odoo" in 'install aplication' mails +- FIX: Remove Enterprise radio-buttons in Settings + +`1.0.19` +-------- + +- FIX: Page title was empty even when it doesn't contain references to odoo + +`1.0.18` +-------- + +- FIX: Replace icons for android and apple devices with custom url + +`1.0.17` +-------- + +- FIX: Do not reset config values to default ones after upgrade or reinstall the module + +`1.0.16` +-------- + +- FIX: Removed odoo.com link from left bottom of the page + +`1.0.15` +-------- + +- FIX: Updating Title didn't work on *Optimize SEO* website tool + +`1.0.14` +-------- + +- FIX: Compatibility with Timesheet Grid View module + +`1.0.13` +-------- + +- IMP: Add "Developer mode" link to the top right-hand User Menu + +`1.0.12` +-------- + +- FIX: Forbid to disable odoo.com binding for enterprise due to terms of Odoo Enterprise Subscription Agreement + +`1.0.11` +-------- + +- FIX desktop notifications: replace odoo icon company log and debrand text + +`1.0.10` +-------- + +- FIX: Reconsile button didn't work +- FIX: Updated title was not set + +`1.0.9` +------- + +- FIX: don't hide whole section in Settings if it not all fields are enterprise + +`1.0.8` +------- + +- IMP: 11. Disables server requests to odoo.com (publisher_warranty_url) - optional + +`1.0.7` +------- + +- FIX: bug with fields on User form in Odoo Enterprise + +`1.0.6` +------- + +- FIX: bug with replacing the word "odoo" in JS functions +- FIX: replace title and favicon in Odoo Enterprise + + +`1.0.5` +------- + +- ADD: Replaces "Odoo" in all backend qweb templates (e.g. FAQ in import tool) + +`1.0.4` +------- + +- ADD: hide Enterprise features in Settings + +`1.0.3` +------- + +- ADD: support Enterprise release +- ADD: 16. Deletes "Odoo" in a request message for permission desktop notifications +- ADD: 17. [ENTERPRISE] Deletes odoo logo in application switcher + + +`1.0.2` +------- + +- ADD: debrand Planner +- FIX: updates for recent odoo 9.0 + +`1.0.1` +------- + +- FIX: updates for recent odoo 9.0 +- REF: compatible with other Dashboard modules + +`1.0.0` +------- + +- init version diff --git a/odex25_base/web_debranding/doc/index.rst b/odex25_base/web_debranding/doc/index.rst new file mode 100644 index 000000000..2607f57ce --- /dev/null +++ b/odex25_base/web_debranding/doc/index.rst @@ -0,0 +1,118 @@ +==================== + Backend debranding +==================== + +Installation +============ + +* `Install `__ this module in a usual way + +Configuration +============= + +By default the module replaces ``Odoo`` to ``Software``. + +* Switch to Developer mode +* Open ``[[ General Settings ]] >> Technical >> Parameters >> System Parameters`` and modify: + + * ``web_debranding.new_title`` (put space in *Value field* if you don't need Brand in Title) + * ``web_debranding.new_name`` (your Brand) + * ``web_debranding.new_website`` (your website) + * ``web_debranding.new_documentation_website`` (website with documentation instead of official one) + * ``web_debranding.favicon_url`` + * ``web_debranding.send_publisher_warranty_url`` - set 0 to disable server requests to odoo.com and 1 otherwise (useful for enterprise contractors). Works only for non-enterprise versions of odoo, check `note `__ below. + * ``web_debranding.icon_url`` - icon for mobile devices *recommended size :192x192* + * ``web_debranding.apple_touch_icon_url`` - icon for IOS Safari *recommended size :152x152* + +Further debranding +================== + +* Open *addons/mail/data/mail_data.xml* and edit Template **Notification Email** - delete ``using Odoo`` +* Install `website_debranding `__ if module *Website Builder* has been already installed in your system +* Install `pos_debranding `__ if module `POS` has been already installed in your system +* Delete *Odoo.com Accounts* record at *Settings >> Users & Companies >> OAuth Providers* if module ``OAuth2 Authentication`` has been already installed in your system +* To debrand ``/web/database/manager``: + + * Either set `list_db `__ to value ``False`` + + * or edit *addons/web/views/database_manager.html* file: + + * delete or modify **** tag + * delete or modify favicon + * delete or modify **<img>** tag with ``logo2.png`` + * delete or modify warning **<div class="alert alert-warning"> Warning, your Odoo database ...</div>** + * delete or modify **<small class="text-muted">** To enhance your experience, some data may be sent to *Odoo online services*. See our `Privacy Policy <https://www.odoo.com/privacy>`__ + * delete or modify **<p class="form-text"> In order to avoid conflicts between databases, Odoo needs ...</p>** + +* Favicon + + * in existing database, you may need to open ``[[ Settings ]] >> Users & Companies >> Companies`` and change **Company Favicon** + * for new companies odoo default favicon is empty + * to get debranded favicon in new datatabase check next section + +Auto-debrand new databases +========================== + +To automatically install this module for every new databases set 'auto_install': True in ``__manifest__.py`` files of following modules: + +* ``web_debranding`` +* ``ir_rule_protected`` +* ``access_restricted`` +* ``access_apps`` +* ``access_settings_menu`` +* ``mail (built-in)`` +* ``base_setup (built-in)`` +* ``bus (built-in)`` + +Also, it's recommended to add ``web_debranding`` to `server wide modules <https://odoo-development.readthedocs.io/en/latest/admin/server_wide_modules.html>`__, e.g.:: + + ./odoo-bin --load=base,web,web_debranding +Usage +===== +* Open *Backend* +* Perform usual workflow + +RESULT: No more reference to `Odoo <https://www.odoo.com/>`__. *Possible exceptions may be Mails.* + +Examples +======== + +* Search a random string at the menu ``[[ Settings ]] >> Users & Companies >> Companies`` + + Create and manage the companies that will be managed by **Odoo** from here. Shops or subsidiaries can be created and maintained from here. + +* Try to delete Administrator via menu ``[[ Settings ]] >> Users & Copanies >> Users`` + + You can not remove the admin user as it is used internally for resources created by *Odoo** (updates, module installation, ...). + + Note: You may see another error depending on installed modules. + +* When you create new company it shows placeholder for field **Website** + + e.g. www.odoo.com + +* Open menu ``[[ Settings ]] >> General Settings``. + + Use external pads in **Odoo** Notes. + + Extract and analyze **Odoo** data from Google Spreadsheet. + +* Open menu ``[[ Discuss ]] >> CHANNELS >> #general`` + + * Send ``/help`` to the chat + + **OdooBot** - now + + You are in channel #general. + + You can mention someone by typing @username, this will grab its attention. + + You can mention a channel by typing #channel. + + You can execute a command by typing /command. + + You can insert canned responses in your message by typing :shortcut. + +* Open two browser tabs with Odoo. Then logout in one of it. Open any menu in another one. + + Your **Odoo** session expired. The current page is about to be refreshed. diff --git a/odex25_base/web_debranding/doc/src/index.html b/odex25_base/web_debranding/doc/src/index.html new file mode 100644 index 000000000..7fb76a48a --- /dev/null +++ b/odex25_base/web_debranding/doc/src/index.html @@ -0,0 +1,85 @@ +<section class="oe_container"> + <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel"> + <div class="carousel-inner"> + <div class="carousel-item active"> + <img class="d-block w-100" src="Group.png" alt="First slide"> + </div> + <div class="carousel-item"> + <img class="d-block w-100" src="Group2.png" alt="Second slide"> + </div> + <div class="carousel-item"> + <img class="d-block w-100" src="Group3.png" alt="Third slide"> + </div> + <div class="carousel-item"> + <img class="d-block w-100" src="Group4.png" alt="Forth slide"> + </div> + <div class="carousel-item"> + <img class="d-block w-100" src="Group5.png" alt="Fiveth slide"> + </div> + <div class="carousel-item"> + <img class="d-block w-100" src="Group6.png" alt="Sixth slide"> + </div> + <div class="carousel-item"> + <img class="d-block w-100" src="Group7.png" alt="Seventh slide"> + </div> + <div class="carousel-item"> + <img class="d-block w-100" src="Group8.png" alt="Eighth slide"> + </div> + <div class="carousel-item"> + <img class="d-block w-100" src="Group9.png" alt="Nineth slide"> + </div> + </div> + <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev"> + <span class="carousel-control-prev-icon" aria-hidden="true"></span> + <span class="sr-only">Previous</span> + </a> + <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next"> + <span class="carousel-control-next-icon" aria-hidden="true"></span> + <span class="sr-only">Next</span> + </a> + </div> +</section> + +<section class="oe_container"> + <div class="oe_row oe_spaced"> + <div class="oe_span12"> + <p class="oe_mt32"> + Beyond the presentation this service provides a <b>wide range of options</b> for debranding: + </p> + <p class="oe_mt32"> + <ol> + <li> Replaces "Odoo" in page title </li> + <li> Replaces "Odoo" in help message for empty list </li> + <li> Deletes Documentation, Support, About links from the top right-hand User Menu. </li> + <li> Replaces "Odoo" in Dialog Box </li> + <li> Replaces "Odoo" in strings marked for translation </li> + <li> Replaces default favicon to a custom one </li> + <li> Hides Apps menu (by default, only Super User can see Apps menu. You could change it via tick "Show Modules Menu" in user's access rights tab. </li> + <li> Disables server requests to odoo.com (publisher_warranty_url) - optional. Works only for non-enterprise versions of odoo </li> + <li> [ENTERPRISE] Deletes odoo logo in application switcher </li> + <li> Hides Enterprise features in Settings </li> + <li> Replaces "Odoo" in all backend qweb templates (e.g. FAQ in import tool) </li> + <li> Replaces "odoo.com" in hints, examples, etc. </li> + <li> Rename "OdooBot" to "Bot". Use company's logo as bot avatar </li> + <li> [ENTERPRISE] Replaces icons for android and apple devices with custom url </li> + <li> Replaces links to <a href="https://www.odoo.com/documentation"> documentation </a> (e.g. "Help" in Import tool, "How-to" in paypal, etc.) to custom website </li> + <li> Deletes Google Play, Apps Store apps links</li> + <li> Replaces "Powered by Odoo" in emails</li> + <li> Deletes "Powered by Odoo" in Website (when installed)</li> + </ol> + </div> + </div> +</section> + +<section class="oe_container"> + <div class="oe_row oe_spaced"> + <div class="oe_span12"> + <div class="alert alert-danger oe_mt32" style="padding:0.3em 0.6em; font-size: 150%;"> + Within Backend debranding we hide <i>menu Apps</i> that is disabled for User after installing the module. + Only <a href="https://odoo-development.readthedocs.io/en/latest/odoo/usage/login-as-superuser.html">Super User</a> can enable them.</p> + Also we hide buttons for the modules installation. <i>For example in the menu Inventory -> Settings some options disappear.</i></p> + You can return them only through the <a href="https://odoo-development.readthedocs.io/en/latest/odoo/usage/login-as-superuser.html">Super User</a>. + </div> + </div> + </div> +</section> diff --git a/odex25_base/web_debranding/doc/src/info.yaml b/odex25_base/web_debranding/doc/src/info.yaml new file mode 100644 index 000000000..af65a5c77 --- /dev/null +++ b/odex25_base/web_debranding/doc/src/info.yaml @@ -0,0 +1,4 @@ +slogan: + Build and enhance your Brand by removing references to <a + href="https://www.odoo.com/"> odoo.com </a> and customizing company logo, favicon, + page title, etc. diff --git a/odex25_base/web_debranding/fields.py b/odex25_base/web_debranding/fields.py new file mode 100644 index 000000000..0e5cc48e9 --- /dev/null +++ b/odex25_base/web_debranding/fields.py @@ -0,0 +1,45 @@ +# Copyright 2015-2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> +# Copyright 2017 Ilmir Karamov <https://it-projects.info/team/ilmir-k> +# Copyright 2017 Nicolas JEUDY <https://github.com/njeudy> +# License MIT (https://opensource.org/licenses/MIT). + +from odoo.fields import _String + +from .models.ir_translation import debrand + +get_trans_func = _String.get_trans_func + + +def get_trans_func_debrand(self, records): + if True: # keep original indent + if callable(self.translate): + rec_src_trans = records.env["ir.translation"]._get_terms_translations( + self, records + ) + + def translate(record_id, value): + src_trans = rec_src_trans[record_id] + + def tr(source): + trans = src_trans.get(source, source) + return debrand(records.env, trans) + + return self.translate(tr, value) + + else: + # it seems that this block is never used + # See https://github.com/odoo/odoo/pull/48019 + rec_trans = records.env["ir.translation"]._get_ids( + "{},{}".format(self.model_name, self.name), + "model", + records.env.lang, + records.ids, + ) + + def translate(record_id, value): + return rec_trans.get(record_id) or value + + return translate + + +_String.get_trans_func = get_trans_func_debrand diff --git a/odex25_base/web_debranding/i18n/es_CR.po b/odex25_base/web_debranding/i18n/es_CR.po new file mode 100644 index 000000000..99fa52054 --- /dev/null +++ b/odex25_base/web_debranding/i18n/es_CR.po @@ -0,0 +1,164 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_debranding +# +# Translators: +# Randall <randall_castro@me.com>, 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-04-30 21:57+0000\n" +"PO-Revision-Date: 2018-04-30 21:57+0000\n" +"Last-Translator: Randall <randall_castro@me.com>, 2018\n" +"Language-Team: Spanish (Costa Rica) (https://www.transifex.com/it-projects-" +"llc/teams/76080/es_CR/)\n" +"Language: es_CR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: web_debranding +#. openerp-web +#: code:addons/web_debranding/static/src/xml/web.xml:27 +#, python-format +msgid "(with assets)" +msgstr "" + +#. module: web_debranding +#: model:ir.model,name:web_debranding.model_ir_actions_act_window +msgid "Action Window" +msgstr "" + +#. module: web_debranding +#: model:ir.model.fields,field_description:web_debranding.field_res_users__odoobot_state +msgid "Bot Status" +msgstr "" + +#. module: web_debranding +#. openerp-web +#: code:addons/web_debranding/static/src/xml/web.xml:26 +#: code:addons/web_debranding/static/src/xml/web.xml:27 +#, python-format +msgid "Developer mode" +msgstr "Modo desarrollador" + +#. module: web_debranding +#. openerp-web +#: code:addons/web_debranding/static/src/js/user_menu.js:36 +#: code:addons/web_debranding/static/src/js/user_menu.js:42 +#, python-format +msgid "Developer mode is already activated" +msgstr "El modo desarrollador ya se encuentra activado" + +#. module: web_debranding +#: selection:res.users,odoobot_state:0 +msgid "Disabled" +msgstr "" + +#. module: web_debranding +#: selection:res.users,odoobot_state:0 +msgid "Idle" +msgstr "" + +#. module: web_debranding +#: model:ir.model,name:web_debranding.model_mail_message +msgid "Message" +msgstr "Mensaje" + +#. module: web_debranding +#: selection:res.users,odoobot_state:0 +msgid "Not initialized" +msgstr "" + +#. module: web_debranding +#: selection:res.users,odoobot_state:0 +msgid "Onboarding attachement" +msgstr "" + +#. module: web_debranding +#: selection:res.users,odoobot_state:0 +msgid "Onboarding command" +msgstr "" + +#. module: web_debranding +#: selection:res.users,odoobot_state:0 +msgid "Onboarding emoji" +msgstr "" + +#. module: web_debranding +#: selection:res.users,odoobot_state:0 +msgid "Onboarding ping" +msgstr "" + +#. module: web_debranding +#. openerp-web +#: code:addons/web_debranding/static/src/js/native_notifications.js:15 +#, python-format +msgid "Permission denied" +msgstr "" + +#. module: web_debranding +#: model:ir.model,name:web_debranding.model_publisher_warranty_contract +#, fuzzy +msgid "Publisher Warranty Contract" +msgstr "publisher_warranty.contract" + +#. module: web_debranding +#: code:addons/web_debranding/models/ir_config_parameter.py:12 +#: code:addons/web_debranding/models/ir_config_parameter.py:13 +#, python-format +msgid "Software" +msgstr "Software" + +#. module: web_debranding +#: model:ir.model,name:web_debranding.model_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: web_debranding +#: model:ir.model,name:web_debranding.model_ir_translation +#, fuzzy +msgid "Translation" +msgstr "ir.translation" + +#. module: web_debranding +#: model:ir.model,name:web_debranding.model_res_users +msgid "Users" +msgstr "" + +#. module: web_debranding +#: model:ir.model,name:web_debranding.model_ir_ui_view +msgid "View" +msgstr "" + +#. module: web_debranding +#. openerp-web +#: code:addons/web_debranding/static/src/js/native_notifications.js:15 +#, python-format +msgid "Yay, push notifications are enabled!" +msgstr "" + +#. module: web_debranding +#. openerp-web +#: code:addons/web_debranding/static/src/xml/web.xml:8 +#, python-format +msgid "Your permission is required to" +msgstr "Se requieren permisos para" + +#. module: web_debranding +#. openerp-web +#: code:addons/web_debranding/static/src/xml/web.xml:9 +#, python-format +msgid "enable desktop notifications" +msgstr "Habilitar notificaciones de escritorio" + +#~ msgid "Planner" +#~ msgstr "Planificador" + +#~ msgid "ir.actions.act_window" +#~ msgstr "ir.actions.act_window" + +#~ msgid "ir.config_parameter" +#~ msgstr "ir.config_parameter" diff --git a/odex25_base/web_debranding/i18n/ru.po b/odex25_base/web_debranding/i18n/ru.po new file mode 100644 index 000000000..e098d793e --- /dev/null +++ b/odex25_base/web_debranding/i18n/ru.po @@ -0,0 +1,155 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_debranding +# +# Translators: +# Translation Bot <i18n-bot@it-projects.info>, 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-08 15:03+0000\n" +"PO-Revision-Date: 2017-12-08 15:03+0000\n" +"Last-Translator: Translation Bot <i18n-bot@it-projects.info>, 2017\n" +"Language-Team: Russian (https://www.transifex.com/it-projects-llc/" +"teams/76080/ru/)\n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n" +"%100>=11 && n%100<=14)? 2 : 3);\n" + +#. module: web_debranding +#. openerp-web +#: code:addons/web_debranding/static/src/xml/web.xml:27 +#, python-format +msgid "(with assets)" +msgstr "" + +#. module: web_debranding +#: model:ir.model,name:web_debranding.model_ir_actions_act_window +msgid "Action Window" +msgstr "" + +#. module: web_debranding +#: model:ir.model.fields,field_description:web_debranding.field_res_users__odoobot_state +msgid "Bot Status" +msgstr "" + +#. module: web_debranding +#. openerp-web +#: code:addons/web_debranding/static/src/xml/web.xml:26 +#: code:addons/web_debranding/static/src/xml/web.xml:27 +#, python-format +msgid "Developer mode" +msgstr "Режим разработчика" + +#. module: web_debranding +#. openerp-web +#: code:addons/web_debranding/static/src/js/user_menu.js:36 +#: code:addons/web_debranding/static/src/js/user_menu.js:42 +#, python-format +msgid "Developer mode is already activated" +msgstr "Режим разработчика уже активирован" + +#. module: web_debranding +#: selection:res.users,odoobot_state:0 +msgid "Disabled" +msgstr "" + +#. module: web_debranding +#: selection:res.users,odoobot_state:0 +msgid "Idle" +msgstr "" + +#. module: web_debranding +#: model:ir.model,name:web_debranding.model_mail_message +msgid "Message" +msgstr "" + +#. module: web_debranding +#: selection:res.users,odoobot_state:0 +msgid "Not initialized" +msgstr "" + +#. module: web_debranding +#: selection:res.users,odoobot_state:0 +msgid "Onboarding attachement" +msgstr "" + +#. module: web_debranding +#: selection:res.users,odoobot_state:0 +msgid "Onboarding command" +msgstr "" + +#. module: web_debranding +#: selection:res.users,odoobot_state:0 +msgid "Onboarding emoji" +msgstr "" + +#. module: web_debranding +#: selection:res.users,odoobot_state:0 +msgid "Onboarding ping" +msgstr "" + +#. module: web_debranding +#. openerp-web +#: code:addons/web_debranding/static/src/js/native_notifications.js:15 +#, python-format +msgid "Permission denied" +msgstr "" + +#. module: web_debranding +#: model:ir.model,name:web_debranding.model_publisher_warranty_contract +msgid "Publisher Warranty Contract" +msgstr "" + +#. module: web_debranding +#: code:addons/web_debranding/models/ir_config_parameter.py:12 +#: code:addons/web_debranding/models/ir_config_parameter.py:13 +#, python-format +msgid "Software" +msgstr "" + +#. module: web_debranding +#: model:ir.model,name:web_debranding.model_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: web_debranding +#: model:ir.model,name:web_debranding.model_ir_translation +msgid "Translation" +msgstr "" + +#. module: web_debranding +#: model:ir.model,name:web_debranding.model_res_users +msgid "Users" +msgstr "" + +#. module: web_debranding +#: model:ir.model,name:web_debranding.model_ir_ui_view +msgid "View" +msgstr "" + +#. module: web_debranding +#. openerp-web +#: code:addons/web_debranding/static/src/js/native_notifications.js:15 +#, python-format +msgid "Yay, push notifications are enabled!" +msgstr "" + +#. module: web_debranding +#. openerp-web +#: code:addons/web_debranding/static/src/xml/web.xml:8 +#, python-format +msgid "Your permission is required to" +msgstr "" + +#. module: web_debranding +#. openerp-web +#: code:addons/web_debranding/static/src/xml/web.xml:9 +#, python-format +msgid "enable desktop notifications" +msgstr "" diff --git a/odex25_base/web_debranding/images/web_debranding.png b/odex25_base/web_debranding/images/web_debranding.png new file mode 100644 index 000000000..dbf25a00d Binary files /dev/null and b/odex25_base/web_debranding/images/web_debranding.png differ diff --git a/odex25_base/web_debranding/js.xml b/odex25_base/web_debranding/js.xml new file mode 100644 index 000000000..94f3ba642 --- /dev/null +++ b/odex25_base/web_debranding/js.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8" ?> +<odoo> + <!--Copyright 2015-2018,2020 Ivan Yelizariev <https://it-projects.info/team/yelizariev> + Copyright 2015 igallyamov <https://github.com/igallyamov> + Copyright 2016 Stanislav Krotov <https://it-projects.info/team/ufaks> + Copyright 2017 Ilmir Karamov <https://it-projects.info/team/ilmir-k> + License MIT (https://opensource.org/licenses/MIT).--> + <template + id="debranding_title_js" + name="Debranding title JS" + inherit_id="web.assets_backend" + > + <xpath expr="." position="inside"> + <link rel="stylesheet" href="/web_debranding/static/src/css/web.css" /> + <script + type="text/javascript" + src="/web_debranding/static/src/js/base.js" + /> + <script + type="text/javascript" + src="/web_debranding/static/src/js/dialog.js" + /> + <script + type="text/javascript" + src="/web_debranding/static/src/js/field_upgrade.js" + /> + <script + type="text/javascript" + src="/web_debranding/static/src/js/native_notifications.js" + /> + <script type="text/javascript" src="/web_debranding/static/src/js/bot.js" /> + </xpath> + </template> +</odoo> diff --git a/odex25_base/web_debranding/models/__init__.py b/odex25_base/web_debranding/models/__init__.py new file mode 100644 index 000000000..437ae3640 --- /dev/null +++ b/odex25_base/web_debranding/models/__init__.py @@ -0,0 +1,15 @@ +# License MIT (https://opensource.org/licenses/MIT). + +from . import base +from . import ir_actions +from . import ir_translation +from . import publisher_warranty_contract +from . import ir_config_parameter +from . import ir_ui_view +from . import mail_message +from . import mail_channel +from . import res_users +from . import ir_model +from . import res_company +from . import res_config_settings +from . import ir_module_module diff --git a/odex25_base/web_debranding/models/base.py b/odex25_base/web_debranding/models/base.py new file mode 100644 index 000000000..10e337676 --- /dev/null +++ b/odex25_base/web_debranding/models/base.py @@ -0,0 +1,34 @@ +# Copyright 2020 Ivan Yelizariev +# License OPL-1 (https://www.odoo.com/documentation/user/14.0/legal/licenses/licenses.html#odoo-apps). +from odoo import api, models + +from .ir_translation import debrand + +BRANDED_FIELDS = { + "mail.template": ["body_html", "name"], + "mailing.mailing": ["body_html"], +} + + +class Base(models.AbstractModel): + + _inherit = "base" + + def _read(self, fields): + super(Base, self)._read(fields) + if self._name not in BRANDED_FIELDS.keys(): + return + + for f in BRANDED_FIELDS[self._name]: + values = [] + for r in self: + values.append(debrand(self.env, r[f])) + field = self._fields[f] + self.env.cache.update(self, field, values) + + @api.model + def search(self, domain, offset=0, limit=None, order=None, count=False): + res = super().search(domain, offset, limit, order, count) + if self._name == "payment.acquirer" and not count: + res = res.filtered(lambda a: not a.module_to_buy) + return res diff --git a/odex25_base/web_debranding/models/ir_actions.py b/odex25_base/web_debranding/models/ir_actions.py new file mode 100644 index 000000000..9f86023a1 --- /dev/null +++ b/odex25_base/web_debranding/models/ir_actions.py @@ -0,0 +1,21 @@ +# Copyright 2015-2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> +# Copyright 2017 Ilmir Karamov <https://it-projects.info/team/ilmir-k> +# License MIT (https://opensource.org/licenses/MIT). + +from odoo import models + + +class IrActionsActWindowDebranding(models.Model): + _inherit = "ir.actions.act_window" + + def read(self, fields=None, load="_classic_read"): + results = super(IrActionsActWindowDebranding, self).read( + fields=fields, load=load + ) + if not fields or "help" in fields: + params = self.env["ir.config_parameter"].get_debranding_parameters() + new_name = params.get("web_debranding.new_name") + for res in results: + if isinstance(res, dict) and res.get("help"): + res["help"] = res["help"].replace("Odoo", new_name) + return results diff --git a/odex25_base/web_debranding/models/ir_config_parameter.py b/odex25_base/web_debranding/models/ir_config_parameter.py new file mode 100644 index 000000000..50e1ba9f1 --- /dev/null +++ b/odex25_base/web_debranding/models/ir_config_parameter.py @@ -0,0 +1,43 @@ +# Copyright 2015-2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> +# Copyright 2016 Stanislav Krotov <https://it-projects.info/team/ufaks> +# Copyright 2017 ArtyomLosev <https://github.com/ArtyomLosev> +# Copyright 2017 Ilmir Karamov <https://it-projects.info/team/ilmir-k> +# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr> +# Copyright 2019 Eugene Molotov <https://github.com/em230418> +# License MIT (https://opensource.org/licenses/MIT). + +from odoo import api, models +from odoo.tools.translate import _ + +PARAMS = [ + ("web_debranding.new_name", _("Software")), + ("web_debranding.new_title", _("Software")), + ("web_debranding.new_website", "example.com"), + ("web_debranding.new_documentation_website", ""), + ("web_debranding.favicon_url", ""), + ("web_debranding.send_publisher_warranty_url", "0"), + ("web_debranding.icon_url", ""), + ("web_debranding.apple_touch_icon_url", ""), +] + + +def get_debranding_parameters_env(env): + res = {} + for param, default in PARAMS: + value = env["ir.config_parameter"].sudo().get_param(param, default) + res[param] = value.strip() + return res + + +class IrConfigParameter(models.Model): + _inherit = "ir.config_parameter" + + @api.model + def get_debranding_parameters(self): + return get_debranding_parameters_env(self.env) + + @api.model + def create_debranding_parameters(self): + for param, default in PARAMS: + if not self.env["ir.config_parameter"].sudo().get_param(param): + self.env["ir.config_parameter"].sudo().set_param(param, default or " ") diff --git a/odex25_base/web_debranding/models/ir_model.py b/odex25_base/web_debranding/models/ir_model.py new file mode 100644 index 000000000..cf76bc826 --- /dev/null +++ b/odex25_base/web_debranding/models/ir_model.py @@ -0,0 +1,13 @@ +# Copyright 2020 Ivan Yelizariev +# License OPL-1 (https://www.odoo.com/documentation/user/14.0/legal/licenses/licenses.html#odoo-apps). +from odoo import models + +from .ir_translation import debrand + + +class IrModelSelection(models.Model): + _inherit = "ir.model.fields.selection" + + def _get_selection_data(self, *args, **kwargs): + data = super(IrModelSelection, self)._get_selection_data(*args, **kwargs) + return ((value, debrand(name)) for value, name in data) diff --git a/odex25_base/web_debranding/models/ir_module_module.py b/odex25_base/web_debranding/models/ir_module_module.py new file mode 100644 index 000000000..7a0842a5c --- /dev/null +++ b/odex25_base/web_debranding/models/ir_module_module.py @@ -0,0 +1,10 @@ +from odoo import api, models + + +class IrModuleModule(models.Model): + _inherit = "ir.module.module" + + @api.model + def search(self, domain, offset=0, limit=None, order=None, count=False): + domain += [("to_buy", "=", False)] + return super().search(domain, offset, limit, order, count) diff --git a/odex25_base/web_debranding/models/ir_translation.py b/odex25_base/web_debranding/models/ir_translation.py new file mode 100644 index 000000000..20a66e3cd --- /dev/null +++ b/odex25_base/web_debranding/models/ir_translation.py @@ -0,0 +1,132 @@ +# Copyright 2015-2018,2020 Ivan Yelizariev <https://it-projects.info/team/yelizariev> +# Copyright 2016 Stanislav Krotov <https://it-projects.info/team/ufaks> +# Copyright 2017 Ilmir Karamov <https://it-projects.info/team/ilmir-k> +# Copyright 2017 Nicolas JEUDY <https://github.com/njeudy> +# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr> +# Copyright 2018 Ildar Nasyrov <https://it-projects.info/team/iledarn> +# Copyright 2019 Eugene Molotov <https://it-projects.info/team/molotov> +# License MIT (https://opensource.org/licenses/MIT). +# License OPL-1 (https://www.odoo.com/documentation/user/14.0/legal/licenses/licenses.html#odoo-apps) for derivative work. + +import re + +from odoo import api, models, tools + +from odoo.addons.base.models.ir_translation import ( + IrTranslation as IrTranslationOriginal, +) + +from .ir_config_parameter import get_debranding_parameters_env + + +def debrand_documentation_links(source, new_documentation_website): + return re.sub( + r"https://www.odoo.com/documentation/", + new_documentation_website + "documentation/", + source, + flags=re.IGNORECASE, + ) + + +def debrand_links(source, new_website): + return re.sub(r"\bodoo.com\b", new_website, source, flags=re.IGNORECASE) + + +def debrand(env, source, is_code=False): + if not source or not re.search(r"\bodoo\b", source, re.IGNORECASE): + return source + params = get_debranding_parameters_env(env) + new_name = params.get("web_debranding.new_name") + new_website = params.get("web_debranding.new_website") + new_documentation_website = params.get("web_debranding.new_documentation_website") + + source = debrand_documentation_links(source, new_documentation_website) + source = debrand_links(source, new_website) + # We must exclude the next cases, which occur only in a code, + # Since JS functions are also contained in the localization files. + # Next regular expression exclude from substitution 'odoo.SMTH', 'odoo =', 'odoo=', 'odooSMTH', 'odoo[' + # Where SMTH is an any symbol or number or '_'. Option odoo.com were excluded previously. + # Examples: + # odoo. + # xml file: https://github.com/odoo/odoo/blob/9.0/addons/im_livechat/views/im_livechat_channel_templates.xml#L148 + # odooSMTH + # https://github.com/odoo/odoo/blob/11.0/addons/website_google_map/views/google_map_templates.xml#L14 + # odoo = + # https://github.com/odoo/odoo/blob/11.0/addons/web/views/webclient_templates.xml#L260 + # odoo[ + # https://github.com/odoo/odoo/blob/11.0/addons/web_editor/views/iframe.xml#L43-L44 + # SMTH.odoo + # https://github.com/odoo/odoo/blob/11.0/addons/web_editor/views/iframe.xml#L43 + source = re.sub( + r"\b(?<!\.)odoo(?!\.\S|\s?=|\w|\[)\b", new_name, source, flags=re.IGNORECASE + ) + + return source + + +def debrand_bytes(env, source): + if type(source) is bytes: + source = source.decode("utf-8") + return bytes(debrand(env, source), "utf-8") + + +class IrTranslation(models.Model): + _inherit = "ir.translation" + + @api.model + def _debrand_dict(self, res): + for k in res: + res[k] = self._debrand(res[k]) + return res + + @api.model + def _debrand(self, source): + return debrand(self.env, source) + + @tools.ormcache("name", "types", "lang", "source", "res_id") + def __get_source(self, name, types, lang, source, res_id): + res = super(IrTranslation, self).__get_source(name, types, lang, source, res_id) + return self._debrand(res) + + @api.model + @tools.ormcache_context("model_name", keys=("lang",)) + def get_field_string(self, model_name): + res = super(IrTranslation, self).get_field_string(model_name) + return self._debrand_dict(res) + + @api.model + @tools.ormcache_context("model_name", keys=("lang",)) + def get_field_help(self, model_name): + res = super(IrTranslation, self).get_field_help(model_name) + return self._debrand_dict(res) + + @api.model + def decorated_clear_caches(self): + """For calling clear_caches from via xml <function ... /> + we wrapped it in the api.model decorator + + """ + self.clear_caches() + + @api.model + def get_translations_for_webclient(self, *args, **kwargs): + translations_per_module, lang_params = super( + IrTranslation, self + ).get_translations_for_webclient(*args, **kwargs) + + for _module_key, module_vals in translations_per_module.items(): + for message in module_vals["messages"]: + message["id"] = debrand(self.env, message["id"]) + message["string"] = debrand(self.env, message["string"]) + + return translations_per_module, lang_params + + @api.model + @tools.ormcache_context("model_name", "field_name", keys=("lang",)) + def get_field_selection(self, model_name, field_name): + # call undecorated super method. See odoo/tools/cache.py::ormcache and http://decorator.readthedocs.io/en/stable/tests.documentation.html#getting-the-source-code + + selection = IrTranslationOriginal.get_field_selection.__wrapped__( + self, model_name, field_name + ) + return [(value, debrand(self.env, name)) for value, name in selection] diff --git a/odex25_base/web_debranding/models/ir_ui_view.py b/odex25_base/web_debranding/models/ir_ui_view.py new file mode 100644 index 000000000..4b2205ce7 --- /dev/null +++ b/odex25_base/web_debranding/models/ir_ui_view.py @@ -0,0 +1,108 @@ +# Copyright 2016-2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> +# Copyright 2017 ArtyomLosev <https://github.com/ArtyomLosev> +# Copyright 2017 Ilmir Karamov <https://it-projects.info/team/ilmir-k> +# License MIT (https://opensource.org/licenses/MIT). + +import logging + +from odoo import api, models +from odoo.tools import mute_logger + +from .ir_translation import debrand + +_logger = logging.getLogger(__name__) + +MODULE = "_web_debranding" + + +class View(models.Model): + _inherit = "ir.ui.view" + + def read_combined(self, fields=None): + res = super(View, self).read_combined(fields=fields) + res["arch"] = debrand(self.env, res["arch"], is_code=True) + return res + + @api.model + def _create_debranding_views(self): + """Create UI views that may work only in one Odoo edition""" + + # Odoo EE + self._create_view( + "webclient_bootstrap_enterprise_mobile_icon", + "web_enterprise.webclient_bootstrap", + """ + <xpath expr="//link[@rel='icon']" position="replace"> + <t t-set="icon" t-value="request and request.env['ir.config_parameter'].get_debranding_parameters().get('web_debranding.icon_url', '')"/> + <t t-if="icon"> + <link rel="icon" sizes="192x192" t-att-href="icon" type="image/x-icon"/> + </t> + </xpath>""", + ) + + # Odoo EE + self._create_view( + "webclient_bootstrap_enterprise_apple_touch_icon", + "web_enterprise.webclient_bootstrap", + """ + <xpath expr="//link[@rel='apple-touch-icon']" position="replace"> + <t t-if="icon"> + <link rel="apple-touch-icon" t-att-href="icon" type="image/x-icon"/> + </t> + </xpath>""", + ) + + # Odoo EE + self._create_view( + "webclient_bootstrap_enterprise_windows_phone", + "web_enterprise.webclient_bootstrap", + """ + <xpath expr="//meta[@name='msapplication-TileImage']" position="replace"> + <t t-if="icon"> + <meta name="msapplication-TileImage" t-att-content="icon"/> + </t> + </xpath>""", + ) + + @api.model + def _create_view(self, name, inherit_id, arch, noupdate=False, view_type="qweb"): + view = self.env.ref("{}.{}".format(MODULE, name), raise_if_not_found=False) + if view: + try: + view.write({"arch": arch}) + view._check_xml() + except Exception: + _logger.warning( + "Cannot update view %s. Delete it.", name, exc_info=True + ) + view.unlink() + return + + return view.id + + try: + with self.env.cr.savepoint(), mute_logger("odoo.models"): + view = self.env["ir.ui.view"].create( + { + "name": name, + "type": view_type, + "arch": arch, + "inherit_id": self.env.ref( + inherit_id, raise_if_not_found=True + ).id, + } + ) + view._check_xml() + except Exception: + _logger.debug("Cannot create view %s. Cancel.", name, exc_info=True) + return + self.env["ir.model.data"].create( + { + "name": name, + "model": "ir.ui.view", + "module": MODULE, + "res_id": view.id, + "noupdate": noupdate, + } + ) + return view.id diff --git a/odex25_base/web_debranding/models/mail_channel.py b/odex25_base/web_debranding/models/mail_channel.py new file mode 100644 index 000000000..4ef27c06a --- /dev/null +++ b/odex25_base/web_debranding/models/mail_channel.py @@ -0,0 +1,17 @@ +# Copyright 2018 Bikbov Rafis <https://it-projects.info/team/bikbov> +# Copyright 2020 Ivan Yelizariev <https://it-projects.info/team/yelizariev> +# License MIT (https://opensource.org/licenses/MIT). + +from odoo import api, models + + +class Channel(models.Model): + _inherit = "mail.channel" + + @api.model + def init_odoobot(self): + channel = super(Channel, self).init_odoobot() + if not channel: + return + channel.write({"name": "Bot"}) + return channel diff --git a/odex25_base/web_debranding/models/mail_message.py b/odex25_base/web_debranding/models/mail_message.py new file mode 100644 index 000000000..46daa7561 --- /dev/null +++ b/odex25_base/web_debranding/models/mail_message.py @@ -0,0 +1,33 @@ +# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr> +# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> +# License MIT (https://opensource.org/licenses/MIT). + +import logging + +from odoo import api, models + +from .ir_translation import debrand + +_logger = logging.getLogger(__name__) + +MODULE = "_web_debranding" + + +class MailMessage(models.Model): + _inherit = "mail.message" + + @api.model + def create(self, values): + subject = values.get("subject") + channel_all_employees = self.env.ref( + "mail.channel_all_employees", raise_if_not_found=False + ) + if ( + channel_all_employees + and subject + and values.get("model") == "mail.channel" + and channel_all_employees.id == values.get("res_id") + and subject.endswith("application installed!") + ): + values["body"] = debrand(self.env, values.get("body", "")) + return super(MailMessage, self).create(values) diff --git a/odex25_base/web_debranding/models/publisher_warranty_contract.py b/odex25_base/web_debranding/models/publisher_warranty_contract.py new file mode 100644 index 000000000..75205c5f4 --- /dev/null +++ b/odex25_base/web_debranding/models/publisher_warranty_contract.py @@ -0,0 +1,30 @@ +# Copyright 2015-2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> +# Copyright 2016 Stanislav Krotov <https://it-projects.info/team/ufaks> +# Copyright 2017 Ilmir Karamov <https://it-projects.info/team/ilmir-k> +# License MIT (https://opensource.org/licenses/MIT). + +import logging + +from odoo import models +from odoo.release import version_info + +_logger = logging.getLogger(__name__) + + +class PublisherWarrantyContract(models.AbstractModel): + _inherit = "publisher_warranty.contract" + + def update_notification(self, cron_mode=True): + is_enterprise = version_info[5] == "e" + _logger.debug("is_enterprise=%s", is_enterprise) + # Running Odoo EE without calling super is illegal. So, make it impossible to disable in enterprise. See README.rst for details + if ( + is_enterprise + or self.env["ir.config_parameter"] + .get_debranding_parameters() + .get("web_debranding.send_publisher_warranty_url") + == "1" + ): + return super(PublisherWarrantyContract, self).update_notification(cron_mode) + else: + return True diff --git a/odex25_base/web_debranding/models/res_company.py b/odex25_base/web_debranding/models/res_company.py new file mode 100644 index 000000000..2cc31dc5a --- /dev/null +++ b/odex25_base/web_debranding/models/res_company.py @@ -0,0 +1,12 @@ +# Copyright 2020 Ivan Yelizariev +# License OPL-1 (https://www.odoo.com/documentation/user/14.0/legal/licenses/licenses.html#odoo-apps). +from odoo import fields, models + + +class Company(models.Model): + _inherit = "res.company" + + def _get_default_favicon(self, original=False): + return None + + favicon = fields.Binary(default=_get_default_favicon) diff --git a/odex25_base/web_debranding/models/res_config_settings.py b/odex25_base/web_debranding/models/res_config_settings.py new file mode 100644 index 000000000..644083617 --- /dev/null +++ b/odex25_base/web_debranding/models/res_config_settings.py @@ -0,0 +1,71 @@ +# Copyright 2021 Ivan Yelizariev <https://it-projects.info/team/yelizariev> +# License OPL-1 (https://www.odoo.com/documentation/user/14.0/legal/licenses/licenses.html#odoo-apps) for derivative work. + +from lxml import etree + +from odoo import api, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + @api.model + def fields_view_get( + self, view_id=None, view_type="form", toolbar=False, submenu=False + ): + ret_val = super(ResConfigSettings, self).fields_view_get( + view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu + ) + + page_name = ret_val["name"] + if not page_name == "res.config.settings.view.form": + return ret_val + + doc = etree.XML(ret_val["arch"]) + + general_redirect_queries = [ + "//div[@id='sms']", + "//div[@id='partner_autocomplete']", + "//div[@id='iap_portal']", + ] + for query in general_redirect_queries: + for item in doc.xpath(query): + item.getparent().remove(item) + + crm_redirect_queries = [ + "//div[@id='crm_iap_lead_settings']", + "//div[@id='crm_iap_lead_website_settings']", + "//div[@id='crm_iap_lead_enrich']", + ] + for query in crm_redirect_queries: + for item in doc.xpath(query): + checkbox = item.getprevious() + checkbox.getparent().remove(checkbox) + item.getparent().remove(item) + + snailmail_query = "//div[@id='send_invoices_followups']" + for item in doc.xpath(snailmail_query): + item.set("style", "display:none") + + sms_confirmation_query = "//div[@id='stock_sms']" + for item in doc.xpath(sms_confirmation_query): + item.set("style", "display:none") + + enterprise_query = "//div[div[field[@widget='upgrade_boolean']]]" + for item in doc.xpath(enterprise_query): + item.set("style", "display:none") + + # Hide doc links in Settings (unmaintained feature, because the module already replaces links to custom ones) + # question_mark_query = "//a[@class='o_doc_link']" + # for item in doc.xpath(question_mark_query): + # item.set("style", "display:none") + + container_query = "//div[@class='row mt16 o_settings_container']" + for item in doc.xpath(container_query): + if not item.getchildren(): + title = item.getprevious() + title.getparent().remove(title) + item.getparent().remove(item) + + ret_val["arch"] = etree.tostring(doc) + return ret_val diff --git a/odex25_base/web_debranding/models/res_users.py b/odex25_base/web_debranding/models/res_users.py new file mode 100644 index 000000000..ce261de5a --- /dev/null +++ b/odex25_base/web_debranding/models/res_users.py @@ -0,0 +1,15 @@ +# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr> +# License MIT (https://opensource.org/licenses/MIT). + +from odoo import fields, models + + +class ResUsers(models.Model): + _inherit = "res.users" + + odoobot_state = fields.Selection(string="Bot Status") + + def is_admin(self): + # By default Python functions starting with _ are considered private methods. + # Private methods (such as _is_admin) cannot be called remotely + return self._is_admin() diff --git a/odex25_base/web_debranding/pre_install.xml b/odex25_base/web_debranding/pre_install.xml new file mode 100644 index 000000000..a2b780f15 --- /dev/null +++ b/odex25_base/web_debranding/pre_install.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8" ?> +<odoo> + <function model="ir.config_parameter" name="create_debranding_parameters" /> + <function model="ir.translation" name="decorated_clear_caches" /> + <function model="ir.ui.view" name="_create_debranding_views" /> +</odoo> diff --git a/odex25_base/web_debranding/static/description/Group.png b/odex25_base/web_debranding/static/description/Group.png new file mode 100644 index 000000000..1480958f0 Binary files /dev/null and b/odex25_base/web_debranding/static/description/Group.png differ diff --git a/odex25_base/web_debranding/static/description/Group2.png b/odex25_base/web_debranding/static/description/Group2.png new file mode 100644 index 000000000..1287a9968 Binary files /dev/null and b/odex25_base/web_debranding/static/description/Group2.png differ diff --git a/odex25_base/web_debranding/static/description/Group3.png b/odex25_base/web_debranding/static/description/Group3.png new file mode 100644 index 000000000..62ad6c0cd Binary files /dev/null and b/odex25_base/web_debranding/static/description/Group3.png differ diff --git a/odex25_base/web_debranding/static/description/Group4.png b/odex25_base/web_debranding/static/description/Group4.png new file mode 100644 index 000000000..bea6a0b6e Binary files /dev/null and b/odex25_base/web_debranding/static/description/Group4.png differ diff --git a/odex25_base/web_debranding/static/description/Group5.png b/odex25_base/web_debranding/static/description/Group5.png new file mode 100644 index 000000000..0479d0352 Binary files /dev/null and b/odex25_base/web_debranding/static/description/Group5.png differ diff --git a/odex25_base/web_debranding/static/description/Group6.png b/odex25_base/web_debranding/static/description/Group6.png new file mode 100644 index 000000000..d8ca5b1db Binary files /dev/null and b/odex25_base/web_debranding/static/description/Group6.png differ diff --git a/odex25_base/web_debranding/static/description/Group7.png b/odex25_base/web_debranding/static/description/Group7.png new file mode 100644 index 000000000..d7ea9b610 Binary files /dev/null and b/odex25_base/web_debranding/static/description/Group7.png differ diff --git a/odex25_base/web_debranding/static/description/Group8.png b/odex25_base/web_debranding/static/description/Group8.png new file mode 100644 index 000000000..9ce00ffa3 Binary files /dev/null and b/odex25_base/web_debranding/static/description/Group8.png differ diff --git a/odex25_base/web_debranding/static/description/Group9.png b/odex25_base/web_debranding/static/description/Group9.png new file mode 100644 index 000000000..cc356b6f2 Binary files /dev/null and b/odex25_base/web_debranding/static/description/Group9.png differ diff --git a/odex25_base/web_debranding/static/description/icon.png b/odex25_base/web_debranding/static/description/icon.png new file mode 100644 index 000000000..b43a0a135 Binary files /dev/null and b/odex25_base/web_debranding/static/description/icon.png differ diff --git a/odex25_base/web_debranding/static/description/index.html b/odex25_base/web_debranding/static/description/index.html new file mode 100644 index 000000000..e65edb684 --- /dev/null +++ b/odex25_base/web_debranding/static/description/index.html @@ -0,0 +1,183 @@ + +<section class="container"> + <div class="row"> + <div class="col-md-offset-1 col-md-8 mb64 mt64"> + <div class=""> + <h2 class="display-3">Backend debranding</h2> + <h4 class="text-default">Build and enhance your Brand by removing references to <a href="https://www.odoo.com/"> odoo.com </a> and customizing company logo, favicon, page title, etc.</h4> + <p class="text-default mt16">Version: v<b>14.0</b>.1.1.2</p> + </div> + </div> + <div class="col-md-3 text-right"> + <p> + <img src="https://itpp.dev/images/favicon.png"/> + <br/>Tested and maintained by + <br/><b>IT Projects Labs</b> + <br/>Assistance: <a href="mailto:apps@itpp.dev">apps@itpp.dev</a> + </p> + </div> + </div> +</section> + + +<section class="oe_container"> + <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel"> + <div class="carousel-inner"> + <div class="carousel-item active"> + <img class="d-block w-100" src="Group.png" alt="First slide"> + </div> + <div class="carousel-item"> + <img class="d-block w-100" src="Group2.png" alt="Second slide"> + </div> + <div class="carousel-item"> + <img class="d-block w-100" src="Group3.png" alt="Third slide"> + </div> + <div class="carousel-item"> + <img class="d-block w-100" src="Group4.png" alt="Forth slide"> + </div> + <div class="carousel-item"> + <img class="d-block w-100" src="Group5.png" alt="Fiveth slide"> + </div> + <div class="carousel-item"> + <img class="d-block w-100" src="Group6.png" alt="Sixth slide"> + </div> + <div class="carousel-item"> + <img class="d-block w-100" src="Group7.png" alt="Seventh slide"> + </div> + <div class="carousel-item"> + <img class="d-block w-100" src="Group8.png" alt="Eighth slide"> + </div> + <div class="carousel-item"> + <img class="d-block w-100" src="Group9.png" alt="Nineth slide"> + </div> + </div> + <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev"> + <span class="carousel-control-prev-icon" aria-hidden="true"></span> + <span class="sr-only">Previous</span> + </a> + <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next"> + <span class="carousel-control-next-icon" aria-hidden="true"></span> + <span class="sr-only">Next</span> + </a> + </div> +</section> + +<section class="oe_container"> + <div class="oe_row oe_spaced"> + <div class="oe_span12"> + <p class="oe_mt32"> + Beyond the presentation this service provides a <b>wide range of options</b> for debranding: + </p> + <p class="oe_mt32"> + <ol> + <li> Replaces "Odoo" in page title </li> + <li> Replaces "Odoo" in help message for empty list </li> + <li> Deletes Documentation, Support, About links from the top right-hand User Menu. </li> + <li> Replaces "Odoo" in Dialog Box </li> + <li> Replaces "Odoo" in strings marked for translation </li> + <li> Replaces default favicon to a custom one </li> + <li> Hides Apps menu (by default, only Super User can see Apps menu. You could change it via tick "Show Modules Menu" in user's access rights tab. </li> + <li> Disables server requests to odoo.com (publisher_warranty_url) - optional. Works only for non-enterprise versions of odoo </li> + <li> [ENTERPRISE] Deletes odoo logo in application switcher </li> + <li> Hides Enterprise features in Settings </li> + <li> Replaces "Odoo" in all backend qweb templates (e.g. FAQ in import tool) </li> + <li> Replaces "odoo.com" in hints, examples, etc. </li> + <li> Rename "OdooBot" to "Bot". Use company's logo as bot avatar </li> + <li> [ENTERPRISE] Replaces icons for android and apple devices with custom url </li> + <li> Replaces links to <a href="https://www.odoo.com/documentation"> documentation </a> (e.g. "Help" in Import tool, "How-to" in paypal, etc.) to custom website </li> + <li> Deletes Google Play, Apps Store apps links</li> + <li> Replaces "Powered by Odoo" in emails</li> + <li> Deletes "Powered by Odoo" in Website (when installed)</li> + </ol> + </div> + </div> +</section> + +<section class="oe_container"> + <div class="oe_row oe_spaced"> + <div class="oe_span12"> + <div class="alert alert-danger oe_mt32" style="padding:0.3em 0.6em; font-size: 150%;"> + Within Backend debranding we hide <i>menu Apps</i> that is disabled for User after installing the module. + Only <a href="https://odoo-development.readthedocs.io/en/latest/odoo/usage/login-as-superuser.html">Super User</a> can enable them.</p> + Also we hide buttons for the modules installation. <i>For example in the menu Inventory -> Settings some options disappear.</i></p> + You can return them only through the <a href="https://odoo-development.readthedocs.io/en/latest/odoo/usage/login-as-superuser.html">Super User</a>. + </div> + </div> + </div> +</section> + + + +<section class="container text-center"> + <div class="mt-4 mb-3"> + <h2>Let our expertise work for you!</h2> + <h4 class="d-none d-md-block">(Doors and windows below are clickable)</h4> + <div class="mb32 d-md-none"> + <ul class="list-unstyled"> + <li><a target="_blank" href="https://apps.odoo.com/apps/browse?repo_maintainer_id=59928">All modules</a></li> + <li><a target="_blank" href="https://apps.odoo.com/apps/browse?price=Free&order=Downloads&repo_maintainer_id=59928">Free Modules</a></li> + <li><a target="_blank" href="https://apps.odoo.com/apps/modules/category/Point%20of%20Sale/browse?repo_maintainer_id=59928">All POS modules</a></li> + <li><a target="_blank" href="https://apps.odoo.com/apps/modules/category/Discuss/browse?repo_maintainer_id=59928">All Mail modules</a></li> + <li><a target="_blank" href="https://apps.odoo.com/apps/modules/category/Website/browse?repo_maintainer_id=59928">All Website modules</a></li> + <li><a target="_blank" href="https://apps.odoo.com/apps/modules/category/eCommerce/browse?repo_maintainer_id=59928">All eCommerce modules</a></li> + <li><a target="_blank" href="https://apps.odoo.com/apps/modules/browse?search=sync+studio&repo_maintainer_id=59928">Sync Studio</a></li> + <li><a target="_blank" href="https://apps.odoo.com/apps/modules/14.0/openapi/">REST API</a></li> + <li><a target="_blank" href="https://apps.odoo.com/apps/modules/14.0/base_automation_webhook/">Webhooks</a></li> + <li><a target="_blank" href="https://apps.odoo.com/apps/modules/14.0/pos_product_available/">POS: show product qty</a></li> + <li><a target="_blank" href="https://apps.odoo.com/apps/modules/14.0/web_login_background/">Web Login Background</a></li> + </ul> + </div> + <div class="mb64 d-none d-xl-block"> + <img class="img img-responsive" src="https://itpp.dev/images/apps/;-)/itpp-labs-1100.jpg" usemap="#itpp-xl" /> + <map name="itpp-xl"> + <area alt="Free Modules" target="_blank" href="https://apps.odoo.com/apps/browse?price=Free&order=Downloads&repo_maintainer_id=59928" shape="rect" class="" coords="900,220,1080,625" /> + <area alt="Sync Studio" target="_blank" href="https://apps.odoo.com/apps/modules/browse?search=sync+studio&repo_maintainer_id=59928" shape="rect" class="" coords="552,186,721,274" /> + <area alt="REST API" target="_blank" href="https://apps.odoo.com/apps/modules/14.0/openapi/" shape="rect" class="" coords="646,279,720,365" /> + <area alt="Webhooks" target="_blank" href="https://apps.odoo.com/apps/modules/14.0/base_automation_webhook/" shape="rect" class="" coords="646,370,720,458" /> + <area alt="POS: show product qty" target="_blank" href="https://apps.odoo.com/apps/modules/14.0/pos_product_available/" shape="rect" class="" coords="82,373,251,459" /> + <area alt="All modules" target="_blank" href="https://apps.odoo.com/apps/browse?repo_maintainer_id=59928" shape="rect" class="" coords="326,267,381,456" /> + <area alt="All POS modules" target="_blank" href="https://apps.odoo.com/apps/modules/category/Point%20of%20Sale/browse?repo_maintainer_id=59928" shape="rect" class="" coords="82,191,154,276" /> + <area alt="All Mail modules" target="_blank" href="https://apps.odoo.com/apps/modules/category/Discuss/browse?repo_maintainer_id=59928" shape="rect" class="" coords="82,282,155,368" /> + <area alt="All Website modules" target="_blank" href="https://apps.odoo.com/apps/modules/category/Website/browse?repo_maintainer_id=59928" shape="rect" class="" coords="176,282,250,368" /> + <area alt="All eCommerce modules" target="_blank" href="https://apps.odoo.com/apps/modules/category/eCommerce/browse?repo_maintainer_id=59928" shape="rect" class="" coords="175,189,250,275" /> + <area alt="Ivan Yelizariev" target="_blank" href="https://apps.odoo.com/apps/modules/browse?search=Ivan+Yelizariev&repo_maintainer_id=59928" shape="rect" class="" coords="554,280,625,456" /> + <area alt="Web Login Background" target="_blank" href="https://apps.odoo.com/apps/modules/14.0/web_login_background/" shape="rect" class="" coords="420,267,477,456" /> + </map> + </div> + <div class="mb64 d-none d-lg-block d-xl-none"> + <img class="img img-responsive" src="https://itpp.dev/images/apps/;-)/itpp-labs-930.jpg" usemap="#itpp-lg" /> + <map name="itpp-lg"> + <area alt="Free Modules" target="_blank" href="https://apps.odoo.com/apps/browse?price=Free&order=Downloads&repo_maintainer_id=59928" shape="rect" class="" coords="760,186,913,528" /> + <area alt="Sync Studio" target="_blank" href="https://apps.odoo.com/apps/modules/browse?search=sync+studio&repo_maintainer_id=59928" shape="rect" class="" coords="466,157,609,231" /> + <area alt="REST API" target="_blank" href="https://apps.odoo.com/apps/modules/14.0/openapi/" shape="rect" class="" coords="546,235,608,308" /> + <area alt="Webhooks" target="_blank" href="https://apps.odoo.com/apps/modules/14.0/base_automation_webhook/" shape="rect" class="" coords="546,312,608,387" /> + <area alt="POS: show product qty" target="_blank" href="https://apps.odoo.com/apps/modules/14.0/pos_product_available/" shape="rect" class="" coords="69,315,212,388" /> + <area alt="All modules" target="_blank" href="https://apps.odoo.com/apps/browse?repo_maintainer_id=59928" shape="rect" class="" coords="275,225,322,385" /> + <area alt="All POS modules" target="_blank" href="https://apps.odoo.com/apps/modules/category/Point%20of%20Sale/browse?repo_maintainer_id=59928" shape="rect" class="" coords="69,161,130,233" /> + <area alt="All Mail modules" target="_blank" href="https://apps.odoo.com/apps/modules/category/Discuss/browse?repo_maintainer_id=59928" shape="rect" class="" coords="69,238,131,311" /> + <area alt="All Website modules" target="_blank" href="https://apps.odoo.com/apps/modules/category/Website/browse?repo_maintainer_id=59928" shape="rect" class="" coords="148,238,211,311" /> + <area alt="All eCommerce modules" target="_blank" href="https://apps.odoo.com/apps/modules/category/eCommerce/browse?repo_maintainer_id=59928" shape="rect" class="" coords="147,159,211,232" /> + <area alt="Ivan Yelizariev" target="_blank" href="https://apps.odoo.com/apps/modules/browse?search=Ivan+Yelizariev&repo_maintainer_id=59928" shape="rect" class="" coords="468,236,528,385" /> + <area alt="Web Login Background" target="_blank" href="https://apps.odoo.com/apps/modules/14.0/web_login_background/" shape="rect" class="" coords="355,225,403,385" /> + </map> + </div> + <div class="mb64 d-lg-none"> + <img class="img img-responsive" src="https://itpp.dev/images/apps/;-)/itpp-labs-690.jpg" usemap="#itpp-md" /> + <map name="itpp-md"> + <area alt="Free Modules" target="_blank" href="https://apps.odoo.com/apps/browse?price=Free&order=Downloads&repo_maintainer_id=59928" shape="rect" class="" coords="564,138,677,392" /> + <area alt="Sync Studio" target="_blank" href="https://apps.odoo.com/apps/modules/browse?search=sync+studio&repo_maintainer_id=59928" shape="rect" class="" coords="346,116,452,171" /> + <area alt="REST API" target="_blank" href="https://apps.odoo.com/apps/modules/14.0/openapi/" shape="rect" class="" coords="405,175,451,228" /> + <area alt="Webhooks" target="_blank" href="https://apps.odoo.com/apps/modules/14.0/base_automation_webhook/" shape="rect" class="" coords="405,232,451,287" /> + <area alt="POS: show product qty" target="_blank" href="https://apps.odoo.com/apps/modules/14.0/pos_product_available/" shape="rect" class="" coords="51,233,157,287" /> + <area alt="All modules" target="_blank" href="https://apps.odoo.com/apps/browse?repo_maintainer_id=59928" shape="rect" class="" coords="204,167,238,286" /> + <area alt="All POS modules" target="_blank" href="https://apps.odoo.com/apps/modules/category/Point%20of%20Sale/browse?repo_maintainer_id=59928" shape="rect" class="" coords="51,119,96,173" /> + <area alt="All Mail modules" target="_blank" href="https://apps.odoo.com/apps/modules/category/Discuss/browse?repo_maintainer_id=59928" shape="rect" class="" coords="51,176,97,230" /> + <area alt="All Website modules" target="_blank" href="https://apps.odoo.com/apps/modules/category/Website/browse?repo_maintainer_id=59928" shape="rect" class="" coords="110,176,156,230" /> + <area alt="All eCommerce modules" target="_blank" href="https://apps.odoo.com/apps/modules/category/eCommerce/browse?repo_maintainer_id=59928" shape="rect" class="" coords="109,118,156,172" /> + <area alt="Ivan Yelizariev" target="_blank" href="https://apps.odoo.com/apps/modules/browse?search=Ivan+Yelizariev&repo_maintainer_id=59928" shape="rect" class="" coords="347,175,392,286" /> + <area alt="Web Login Background" target="_blank" href="https://apps.odoo.com/apps/modules/14.0/web_login_background/" shape="rect" class="" coords="263,167,299,286" /> + </map> + </div> + </div> +</section> + diff --git a/odex25_base/web_debranding/static/src/css/web.css b/odex25_base/web_debranding/static/src/css/web.css new file mode 100644 index 000000000..92ffef935 --- /dev/null +++ b/odex25_base/web_debranding/static/src/css/web.css @@ -0,0 +1,3 @@ +.o_application_switcher .o_application_switcher_footer { + display: none; +} diff --git a/odex25_base/web_debranding/static/src/img/logo.png b/odex25_base/web_debranding/static/src/img/logo.png new file mode 100644 index 000000000..639bbf85c Binary files /dev/null and b/odex25_base/web_debranding/static/src/img/logo.png differ diff --git a/odex25_base/web_debranding/static/src/img/nologo.png b/odex25_base/web_debranding/static/src/img/nologo.png new file mode 100644 index 000000000..639bbf85c Binary files /dev/null and b/odex25_base/web_debranding/static/src/img/nologo.png differ diff --git a/odex25_base/web_debranding/static/src/js/base.js b/odex25_base/web_debranding/static/src/js/base.js new file mode 100644 index 000000000..fcccac818 --- /dev/null +++ b/odex25_base/web_debranding/static/src/js/base.js @@ -0,0 +1,33 @@ +/* Copyright 2015-2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> + Copyright 2017 ArtyomLosev <https://github.com/ArtyomLosev> + License MIT (https://opensource.org/licenses/MIT). */ +odoo.define("web_debranding.base", function (require) { + "use strict"; + var WebClient = require("web.WebClient"); + + WebClient.include({ + init: function (parent) { + this._super.apply(this, arguments); + var self = this; + this.set("title_part", {zopenerp: ""}); + odoo.debranding_new_name = ""; + odoo.debranding_new_website = ""; + odoo.debranding_new_title = ""; + + self._rpc( + { + model: "ir.config_parameter", + method: "get_debranding_parameters", + }, + { + shadow: true, + } + ).then(function (result) { + odoo.debranding_new_name = result["web_debranding.new_name"]; + odoo.debranding_new_website = result["web_debranding.new_website"]; + odoo.debranding_new_title = result["web_debranding.new_title"]; + self.set("title_part", {zopenerp: odoo.debranding_new_title}); + }); + }, + }); +}); diff --git a/odex25_base/web_debranding/static/src/js/bot.js b/odex25_base/web_debranding/static/src/js/bot.js new file mode 100644 index 000000000..f28edcc46 --- /dev/null +++ b/odex25_base/web_debranding/static/src/js/bot.js @@ -0,0 +1,41 @@ +/* Copyright 2016-2017 Ivan Yelizariev <https://it-projects.info/team/yelizariev> + Copyright 2020 Eugene Molotov <https://it-projects.info/team/em230418> + License MIT (https://opensource.org/licenses/MIT). + License OPL-1 (https://www.odoo.com/documentation/user/14.0/legal/licenses/licenses.html#odoo-apps) for derivative work. */ +odoo.define("web_debranding.bot", function (require) { + "use strict"; + + require("web_debranding.dialog"); + const components = { + Message: require("mail/static/src/components/message/message.js"), + ThreadPreview: require("mail/static/src/components/thread_preview/thread_preview.js"), + }; + + const session = require("web.session"); + const {patch} = require("web.utils"); + + patch(components.ThreadPreview, "web_debranding/static/src/js/bot.js", { + image() { + if ( + this.thread.correspondent && + this.thread.correspondent === this.env.messaging.partnerRoot + ) { + return "/web/binary/company_logo?company_id=" + session.company_id; + } + return this._super(); + }, + }); + + patch(components.Message, "web_debranding/static/src/js/message.js", { + avatar_debranded() { + if ( + this.message.author && + this.message.author === this.env.messaging.partnerRoot + ) { + return "/web/binary/company_logo?company_id=" + session.company_id; + } + + return this.avatar; + }, + }); +}); diff --git a/odex25_base/web_debranding/static/src/js/dialog.js b/odex25_base/web_debranding/static/src/js/dialog.js new file mode 100644 index 000000000..0e07d587e --- /dev/null +++ b/odex25_base/web_debranding/static/src/js/dialog.js @@ -0,0 +1,49 @@ +/* Copyright 2015-2018,2021 Ivan Yelizariev <https://twitter.com/yelizariev> + Copyright 2015 igallyamov <https://github.com/igallyamov> + Copyright 2017 Gabbasov Dinar <https://it-projects.info/team/GabbasovDinar> + License MIT (https://opensource.org/licenses/MIT).*/ +odoo.define("web_debranding.dialog", function (require) { + "use strict"; + require("web_debranding.base"); + var CrashManager = require("web.CrashManager"); + + function crash_init(parent, options, error) { + var debranding_new_name = odoo.debranding_new_name; + error.message = error.message.replace(/Odoo/gi, debranding_new_name); + this._super.apply(this, [parent, options, error]); + } + CrashManager.ErrorDialog.include({ + init: crash_init, + }); + CrashManager.WarningDialog.include({ + init: crash_init, + }); + + var Dialog = require("web.Dialog"); + Dialog.include({ + init: function (parent, options) { + var debranding_new_name = odoo.debranding_new_name; + var debranding_new_website = odoo.debranding_new_website; + options = options || {}; + if (options.title && options.title.replace) { + var title = options.title.replace(/Odoo/gi, debranding_new_name); + options.title = title; + } else { + options.title = debranding_new_name; + } + if (options.$content) { + if (!(options.$content instanceof $)) { + options.$content = $(options.$content); + } + var content_html = options.$content.html(); + content_html = content_html.replace( + /Odoo.com/gi, + debranding_new_website + ); + content_html = content_html.replace(/Odoo/gi, debranding_new_name); + options.$content.html(content_html); + } + this._super(parent, options); + }, + }); +}); diff --git a/odex25_base/web_debranding/static/src/js/field_upgrade.js b/odex25_base/web_debranding/static/src/js/field_upgrade.js new file mode 100644 index 000000000..a31e8d7c1 --- /dev/null +++ b/odex25_base/web_debranding/static/src/js/field_upgrade.js @@ -0,0 +1,42 @@ +/* Copyright 2016-2017 Ivan Yelizariev <https://it-projects.info/team/yelizariev> + Copyright 2017 ArtyomLosev <https://github.com/ArtyomLosev> + Copyright 2018-2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr> + Copyright 2018 Ildar Nasyrov <https://it-projects.info/team/iledarn> + License MIT (https://opensource.org/licenses/MIT). + License OPL-1 (https://www.odoo.com/documentation/user/14.0/legal/licenses/licenses.html#odoo-apps) for derivative work. */ +odoo.define("web_debranding.field_upgrade", function (require) { + "use strict"; + + var FormRenderer = require("web.FormRenderer"); + + FormRenderer.include({ + _renderTagForm: function (node) { + var $result = this._super(node); + + /* + Remove following element: + + <div class="col-xs-12 col-md-6 o_setting_box" title="Boost your sales with two kinds of discount programs: promotions and coupon codes. Specific conditions can be set (products, customers, minimum purchase amount, period). Rewards can be discounts (% or amount) or free products."> + <div class="o_setting_left_pane"> + <div class="o_field_boolean o_field_widget" name="module_sale_coupon"> + </div> + </div> +<div class="o_setting_right_pane"> + <label class="o_form_label" for="o_field_input_18" data-original-title="" title="" aria-describedby="tooltip822540">Coupons & Promotions + </label> + <div class="text-muted" id="sale_coupon"> + Manage promotion & coupon programs + + </div> +</div> +</div> + +*/ + if (this.state && this.state.model === "res.config.settings") { + // Hide enterprise labels with related fields + $result.find(".o_enterprise_label").parent().parent().parent().hide(); + } + return $result; + }, + }); +}); diff --git a/odex25_base/web_debranding/static/src/js/native_notifications.js b/odex25_base/web_debranding/static/src/js/native_notifications.js new file mode 100644 index 000000000..e6fad308a --- /dev/null +++ b/odex25_base/web_debranding/static/src/js/native_notifications.js @@ -0,0 +1,51 @@ +/* Copyright 2016-2017 Ivan Yelizariev <https://it-projects.info/team/yelizariev> + Copyright 2017 ArtyomLosev <https://github.com/ArtyomLosev> + License MIT (https://opensource.org/licenses/MIT). */ +odoo.define("web_debranding.native_notifications", function (require) { + "use strict"; + + require("web_debranding.base"); + var session = require("web.session"); + var BusService = require("bus.BusService"); + var core = require("web.core"); + var _t = core._t; + + BusService.include({ + sendNotification: function (title, content, callback) { + if ( + title === _t("Yay, push notifications are enabled!") || + title === _t("Permission denied") + ) { + content = content.replace(/Odoo/gi, odoo.debranding_new_name); + } + + if (window.Notification && Notification.permission === "granted") { + if (this.isMasterTab()) { + this._sendNativeNotification(title, content, callback); + } + } else { + this._super(title, content, callback); + } + }, + _sendNativeNotification: function (title, content, callback) { + var notification = new Notification(title, { + body: content, + icon: "/web/binary/company_logo?company_id=" + session.company_id, + }); + notification.onclick = function () { + window.focus(); + if (this.cancel) { + this.cancel(); + } else if (this.close) { + this.close(); + } + if (callback) { + // eslint-disable-next-line + callback(); + } + }; + }, + }); + + return BusService; +}); diff --git a/odex25_base/web_debranding/static/src/xml/bot.xml b/odex25_base/web_debranding/static/src/xml/bot.xml new file mode 100644 index 000000000..ec5efeaef --- /dev/null +++ b/odex25_base/web_debranding/static/src/xml/bot.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- Copyright 2020 Eugene Molotov <https://github.com/em230418> + License OPL-1 (https://www.odoo.com/documentation/user/14.0/legal/licenses/licenses.html#odoo-apps) for derivative work.--> +<templates xml:space="preserve"> + <t + t-name="web_debranding.mail.Message" + t-inherit="mail.Message" + t-inherit-mode="extension" + owl="1" + > + <xpath expr="//img[@t-att-src='avatar']" position="attributes"> + <attribute name="t-att-src">avatar_debranded()</attribute> + </xpath> + </t> + <t + t-name="web_debranding.mail.NotificationRequest" + t-inherit="mail.NotificationRequest" + t-inherit-mode="extension" + owl="1" + > + <xpath + expr="//img[hasclass('o_NotificationRequest_image')]" + position="attributes" + > + <attribute name="src">/web/binary/company_logo?company_id=1</attribute> + <attribute name="alt">Avatar of Bot</attribute> + </xpath> + </t> +</templates> diff --git a/odex25_base/web_debranding/static/src/xml/web.xml b/odex25_base/web_debranding/static/src/xml/web.xml new file mode 100644 index 000000000..0325176aa --- /dev/null +++ b/odex25_base/web_debranding/static/src/xml/web.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!--Copyright 2015-2018,2020 Ivan Yelizariev <https://it-projects.info/team/yelizariev> + Copyright 2016 Stanislav Krotov <https://it-projects.info/team/ufaks> + Copyright 2016 Gabbasov Dinar <https://it-projects.info/team/GabbasovDinar> + Copyright 2020 Denis Mudarisov <https://github.com/trojikman> + License MIT (https://opensource.org/licenses/MIT). + License OPL-1 (https://www.odoo.com/documentation/user/14.0/legal/licenses/licenses.html#odoo-apps) for derivative work. --> +<templates> + <t t-extend="UserMenu.Actions"> + <t t-jquery="a[data-menu='documentation']" t-operation="replace" /> + <t t-jquery="a[data-menu='support']" t-operation="replace" /> + <t t-jquery="a[data-menu='account']" t-operation="replace" /> + <!-- It leads to warning in Odoo EE in browser console, because such selector doesn't exist there --> + <t t-jquery="div.dropdown-divider" t-operation="replace" /> + </t> + <t t-extend="wysiwyg.widgets.image"> + <t t-jquery="t[t-set='urlPlaceholder']" t-operation="inner"> + https://www.example.com/logo.png + </t> + </t> + <t t-extend="wysiwyg.widgets.document"> + <t t-jquery="t[t-set='urlPlaceholder']" t-operation="inner"> + https://www.example.com/mydocument + </t> + </t> + <!-- enterprise: hide database expiration panel --> + <!-- WARNING: running odoo instance with uncommented lines below may be illegal --> + <!-- + <t t-extend="WebClient.database_expiration_panel"> + <t t-jquery=".database_expiration_panel"> + $(this).empty(); + </t> + </t> +--> +</templates> diff --git a/odex25_base/web_debranding/tests/__init__.py b/odex25_base/web_debranding/tests/__init__.py new file mode 100644 index 000000000..93a43037c --- /dev/null +++ b/odex25_base/web_debranding/tests/__init__.py @@ -0,0 +1,3 @@ +# License MIT (https://opensource.org/licenses/MIT). + +from . import test_misc diff --git a/odex25_base/web_debranding/tests/test_misc.py b/odex25_base/web_debranding/tests/test_misc.py new file mode 100644 index 000000000..0d157509b --- /dev/null +++ b/odex25_base/web_debranding/tests/test_misc.py @@ -0,0 +1,19 @@ +# Copyright 2019 Eugene Molotov <https://github.com/em230418> +# License MIT (https://opensource.org/licenses/MIT). + +import odoo.tests + +from ..models.ir_translation import debrand_bytes + + +@odoo.tests.common.tagged("at_install", "post_install") +class TestMisc(odoo.tests.TransactionCase): + def test_debrand_bytes(self): + env = self.env + env["ir.config_parameter"].sudo().set_param( + "web_debranding.new_name", "SuperName" + ) + assert debrand_bytes(env, b"odoo") == b"SuperName" + assert debrand_bytes(env, "odoo") == b"SuperName" + assert debrand_bytes(env, b"test") == b"test" + assert debrand_bytes(env, "test") == b"test" diff --git a/odex25_base/web_debranding/views.xml b/odex25_base/web_debranding/views.xml new file mode 100644 index 000000000..4f14d1152 --- /dev/null +++ b/odex25_base/web_debranding/views.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!--Copyright 2015-2018,2020 Ivan Yelizariev <https://it-projects.info/team/yelizariev> + Copyright 2015 igallyamov <https://github.com/igallyamov> + Copyright 2016 Stanislav Krotov <https://it-projects.info/team/ufaks> + Copyright 2017 Ilmir Karamov <https://it-projects.info/team/ilmir-k> + Copyright 2017 auyeung112002 <https://github.com/auyeung112002> + Copyright 2020 Denis Mudarisov <https://it-projects.info/team/trojikman> + License MIT (https://opensource.org/licenses/MIT). + License OPL-1 (https://www.odoo.com/documentation/user/14.0/legal/licenses/licenses.html#odoo-apps) for derivative work.--> +<odoo> + <template id="login_layout" inherit_id="web.login_layout" priority="8"> + <xpath expr="//div[@t-if='not disable_footer']" position="replace" /> + </template> + <template id="web_layout" inherit_id="web.layout"> + <xpath expr="//title" position="replace"> + <title t-esc="title" /> + </xpath> + <xpath expr="//link[@rel='shortcut icon']" position="replace"> + <t + t-set="favicon" + t-value="request and request.env['ir.config_parameter'].sudo().get_param('web_debranding.favicon_url', '')" + /> + <link + t-if="favicon" + rel="shortcut icon" + t-att-href="favicon" + type="image/x-icon" + /> + </xpath> + </template> + <!-- <template + id="brand_promotion" + inherit_id="web.brand_promotion_message" + priority="99" + > + <xpath expr="//t[@t-raw]" position="replace"> + + </xpath> + </template> --> +</odoo> diff --git a/odex25_base/web_debranding/views/res_config.xml b/odex25_base/web_debranding/views/res_config.xml new file mode 100644 index 000000000..142738770 --- /dev/null +++ b/odex25_base/web_debranding/views/res_config.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> + License OPL-1 (https://www.odoo.com/documentation/user/14.0/legal/licenses/licenses.html#odoo-apps).--> +<odoo> + <record id="res_config_settings_view_form" model="ir.ui.view"> + <field name="name">res.config.settings.view.form.web_debranding</field> + <field name="model">res.config.settings</field> + <field name="inherit_id" ref="base_setup.res_config_settings_view_form" /> + <field name="priority" eval="99" /> + <field name="arch" type="xml"> + <!-- delete android/iOS apps links --> + <xpath expr="//div[@id='about']" position="replace" /> + </field> + </record> +</odoo>