diff --git a/web_favicon/README.rst b/web_favicon/README.rst new file mode 100644 index 00000000..bc3f9e1d --- /dev/null +++ b/web_favicon/README.rst @@ -0,0 +1,107 @@ +==================== +Custom shortcut icon +==================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/12.0/web_favicon + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_favicon + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/162/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + + +This module was written to allow you to customize your Odoo instance's shortcut +icon (aka favicon). This is useful for branding purposes, but also for +integrators who have many different Odoo instances running and need to see at a +glance which browser tab does what. + +The icon is shown also for portal users when the website modules are not +installed. + +More info about favicon: https://en.wikipedia.org/wiki/Favicon + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +Upload your favicon (16x16, 32x32, 64x64 or "as big as possible") on the +company form. The file format would be ico, gif or png with 16x16, 32x32 or +64x64 pixels and 16 colors. Highers resolutions or colors support depends on +the used browser, but most modern browsers do. + +Note that most browsers cache favicons basically forever, so if you want your +icon to show up, you'll most probably have to delete you browser cache. +Some browsers can refresh the favicon, accessing the URL +/web_favicon/favicon. + +You have a sample SVG that can be used as template for generating your icon +in /static/src/img/master_original_favicon.svg. You can also search for some +favicon generators across the web. + +To allow a user to edit the favicon it has to be member of group "Administration / Settings". + +Known issues / Roadmap +====================== + +* Allow to upload some big icon (preferrably SVG or the like) and generate + all the icons from it +* Generate icons suitable for mobile devices and web apps (see /static/src/img/ + folder inside the module for a sample of the possible current formats. +* Put the icon definition at system level, not at company level. It doesn't + make sense (as the icon is cached) to have a different icon per company. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Therp BV +* Tecnativa + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_favicon/__init__.py b/web_favicon/__init__.py new file mode 100644 index 00000000..185df0ee --- /dev/null +++ b/web_favicon/__init__.py @@ -0,0 +1,4 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models +from . import controllers diff --git a/web_favicon/__manifest__.py b/web_favicon/__manifest__.py new file mode 100644 index 00000000..421c7b9f --- /dev/null +++ b/web_favicon/__manifest__.py @@ -0,0 +1,23 @@ +# Copyright 2015 Therp BV +# Copyright 2016 Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Custom shortcut icon", + "version": "12.0.1.0.0", + "author": "Therp BV, " + "Tecnativa, " + "Odoo Community Association (OCA)", + "license": "AGPL-3", + "category": "Website", + "summary": "Allows to set a custom shortcut icon (aka favicon)", + "website": "https://github.com/OCA/web", + "depends": [ + "web", + ], + "data": [ + "views/res_company.xml", + "views/templates.xml", + ], + "installable": True, +} diff --git a/web_favicon/controllers/__init__.py b/web_favicon/controllers/__init__.py new file mode 100644 index 00000000..7084537a --- /dev/null +++ b/web_favicon/controllers/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import web_favicon diff --git a/web_favicon/controllers/web_favicon.py b/web_favicon/controllers/web_favicon.py new file mode 100644 index 00000000..5e135a1b --- /dev/null +++ b/web_favicon/controllers/web_favicon.py @@ -0,0 +1,29 @@ +# Copyright 2015 Therp BV +# Copyright 2017 QubiQ 2010 +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from io import BytesIO +import base64 +from odoo import http +from odoo.tools.misc import file_open + + +class WebFavicon(http.Controller): + + @http.route('/web_favicon/favicon', type='http', auth="none") + def icon(self): + request = http.request + if 'uid' in request.env.context: + user = request.env['res.users'].browse(request.env.context['uid']) + company = user.sudo(user.id).company_id + else: + company = request.env['res.company'].search([], limit=1) + favicon = company.favicon_backend + favicon_mimetype = company.favicon_backend_mimetype + if not favicon: + favicon = file_open('web/static/src/img/favicon.ico', 'rb') + favicon_mimetype = 'image/x-icon' + else: + favicon = BytesIO(base64.b64decode(favicon)) + return request.make_response( + favicon.read(), [('Content-Type', favicon_mimetype)]) diff --git a/web_favicon/i18n/da.po b/web_favicon/i18n/da.po new file mode 100644 index 00000000..cbaa6d78 --- /dev/null +++ b/web_favicon/i18n/da.po @@ -0,0 +1,62 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_favicon +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2018-09-02 06:11+0000\n" +"Last-Translator: Hans Henrik Gabelgaard \n" +"Language-Team: none\n" +"Language: da\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" +"X-Generator: Weblate 3.1.1\n" + +#. module: web_favicon +#: model:ir.model,name:web_favicon.model_res_company +msgid "Companies" +msgstr "Virksomheder" + +#. module: web_favicon +#: model:ir.ui.view,arch_db:web_favicon.view_company_form +msgid "Favicon" +msgstr "" + +#. module: web_favicon +#: model:ir.model.fields,field_description:web_favicon.field_res_company_favicon_backend +msgid "Favicon Backend" +msgstr "" + +#. module: web_favicon +#: model:ir.model.fields,field_description:web_favicon.field_res_company_favicon_backend_mimetype +msgid "Favicon Backend Mimetype" +msgstr "" + +#. module: web_favicon +#: model:ir.model.fields,help:web_favicon.field_res_company_favicon_backend_mimetype +msgid "Set the mimetype of your file." +msgstr "Sæt mimetypen af din fil." + +#. module: web_favicon +#: model:ir.ui.view,arch_db:web_favicon.view_company_form +msgid "Web Favicon" +msgstr "" + +#. module: web_favicon +#: selection:res.company,favicon_backend_mimetype:0 +msgid "image/gif" +msgstr "" + +#. module: web_favicon +#: selection:res.company,favicon_backend_mimetype:0 +msgid "image/png" +msgstr "" + +#. module: web_favicon +#: selection:res.company,favicon_backend_mimetype:0 +msgid "image/x-icon" +msgstr "" diff --git a/web_favicon/i18n/de.po b/web_favicon/i18n/de.po new file mode 100644 index 00000000..51b17b0a --- /dev/null +++ b/web_favicon/i18n/de.po @@ -0,0 +1,66 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_favicon +# +# Translators: +# Niki Waibel , 2016 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-11-22 10:37+0000\n" +"PO-Revision-Date: 2016-11-22 10:37+0000\n" +"Last-Translator: Niki Waibel , 2016\n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" +"Language: de\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_favicon +#: model:ir.model,name:web_favicon.model_res_company +msgid "Companies" +msgstr "Unternehmen" + +#. module: web_favicon +#: model:ir.ui.view,arch_db:web_favicon.view_company_form +msgid "Favicon" +msgstr "Favicon" + +#. module: web_favicon +#: model:ir.model.fields,field_description:web_favicon.field_res_company_favicon_backend +#, fuzzy +msgid "Favicon Backend" +msgstr "Icon" + +#. module: web_favicon +#: model:ir.model.fields,field_description:web_favicon.field_res_company_favicon_backend_mimetype +#, fuzzy +msgid "Favicon Backend Mimetype" +msgstr "MIME-Type" + +#. module: web_favicon +#: model:ir.model.fields,help:web_favicon.field_res_company_favicon_backend_mimetype +msgid "Set the mimetype of your file." +msgstr "Wähle den MIME-Type der Datei." + +#. module: web_favicon +#: model:ir.ui.view,arch_db:web_favicon.view_company_form +msgid "Web Favicon" +msgstr "Web Favicon" + +#. module: web_favicon +#: selection:res.company,favicon_backend_mimetype:0 +msgid "image/gif" +msgstr "image/gif" + +#. module: web_favicon +#: selection:res.company,favicon_backend_mimetype:0 +msgid "image/png" +msgstr "image/png" + +#. module: web_favicon +#: selection:res.company,favicon_backend_mimetype:0 +msgid "image/x-icon" +msgstr "image/x-icon" diff --git a/web_favicon/i18n/es.po b/web_favicon/i18n/es.po new file mode 100644 index 00000000..b77d0186 --- /dev/null +++ b/web_favicon/i18n/es.po @@ -0,0 +1,66 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_favicon +# +# Translators: +# Pedro M. Baeza , 2016 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-12-23 02:13+0000\n" +"PO-Revision-Date: 2016-12-23 02:13+0000\n" +"Last-Translator: Pedro M. Baeza , 2016\n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" +"Language: es\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_favicon +#: model:ir.model,name:web_favicon.model_res_company +msgid "Companies" +msgstr "Compañías" + +#. module: web_favicon +#: model:ir.ui.view,arch_db:web_favicon.view_company_form +msgid "Favicon" +msgstr "Favicon" + +#. module: web_favicon +#: model:ir.model.fields,field_description:web_favicon.field_res_company_favicon_backend +#, fuzzy +msgid "Favicon Backend" +msgstr "Favicon del backend" + +#. module: web_favicon +#: model:ir.model.fields,field_description:web_favicon.field_res_company_favicon_backend_mimetype +#, fuzzy +msgid "Favicon Backend Mimetype" +msgstr "Tipo MIME del favicon de backend" + +#. module: web_favicon +#: model:ir.model.fields,help:web_favicon.field_res_company_favicon_backend_mimetype +msgid "Set the mimetype of your file." +msgstr "Establece el tipo MIME de su archivo." + +#. module: web_favicon +#: model:ir.ui.view,arch_db:web_favicon.view_company_form +msgid "Web Favicon" +msgstr "Favicon web" + +#. module: web_favicon +#: selection:res.company,favicon_backend_mimetype:0 +msgid "image/gif" +msgstr "image/gif" + +#. module: web_favicon +#: selection:res.company,favicon_backend_mimetype:0 +msgid "image/png" +msgstr "image/png" + +#. module: web_favicon +#: selection:res.company,favicon_backend_mimetype:0 +msgid "image/x-icon" +msgstr "image/x-icon" diff --git a/web_favicon/i18n/hr.po b/web_favicon/i18n/hr.po new file mode 100644 index 00000000..7c258024 --- /dev/null +++ b/web_favicon/i18n/hr.po @@ -0,0 +1,68 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_favicon +# +# Translators: +# OCA Transbot , 2017 +# Bole , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-04-28 18:03+0000\n" +"PO-Revision-Date: 2017-04-28 18:03+0000\n" +"Last-Translator: Bole , 2017\n" +"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" +"Language: hr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#. module: web_favicon +#: model:ir.model,name:web_favicon.model_res_company +msgid "Companies" +msgstr "Tvrtke" + +#. module: web_favicon +#: model:ir.ui.view,arch_db:web_favicon.view_company_form +msgid "Favicon" +msgstr "Favicon" + +#. module: web_favicon +#: model:ir.model.fields,field_description:web_favicon.field_res_company_favicon_backend +#, fuzzy +msgid "Favicon Backend" +msgstr "Favicon backend" + +#. module: web_favicon +#: model:ir.model.fields,field_description:web_favicon.field_res_company_favicon_backend_mimetype +#, fuzzy +msgid "Favicon Backend Mimetype" +msgstr "Favicon backend" + +#. module: web_favicon +#: model:ir.model.fields,help:web_favicon.field_res_company_favicon_backend_mimetype +msgid "Set the mimetype of your file." +msgstr "" + +#. module: web_favicon +#: model:ir.ui.view,arch_db:web_favicon.view_company_form +msgid "Web Favicon" +msgstr "" + +#. module: web_favicon +#: selection:res.company,favicon_backend_mimetype:0 +msgid "image/gif" +msgstr "image/gif" + +#. module: web_favicon +#: selection:res.company,favicon_backend_mimetype:0 +msgid "image/png" +msgstr "image/png" + +#. module: web_favicon +#: selection:res.company,favicon_backend_mimetype:0 +msgid "image/x-icon" +msgstr "image/x-icon" diff --git a/web_favicon/i18n/nl_NL.po b/web_favicon/i18n/nl_NL.po new file mode 100644 index 00000000..ab6f2852 --- /dev/null +++ b/web_favicon/i18n/nl_NL.po @@ -0,0 +1,66 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_favicon +# +# Translators: +# Peter Hageman , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-01 03:34+0000\n" +"PO-Revision-Date: 2017-07-01 03:34+0000\n" +"Last-Translator: Peter Hageman , 2017\n" +"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/" +"teams/23907/nl_NL/)\n" +"Language: nl_NL\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_favicon +#: model:ir.model,name:web_favicon.model_res_company +msgid "Companies" +msgstr "Bedrijven" + +#. module: web_favicon +#: model:ir.ui.view,arch_db:web_favicon.view_company_form +msgid "Favicon" +msgstr "Favicon" + +#. module: web_favicon +#: model:ir.model.fields,field_description:web_favicon.field_res_company_favicon_backend +#, fuzzy +msgid "Favicon Backend" +msgstr "Favicon" + +#. module: web_favicon +#: model:ir.model.fields,field_description:web_favicon.field_res_company_favicon_backend_mimetype +msgid "Favicon Backend Mimetype" +msgstr "" + +#. module: web_favicon +#: model:ir.model.fields,help:web_favicon.field_res_company_favicon_backend_mimetype +msgid "Set the mimetype of your file." +msgstr "Stel het afbeeldingstype in voor je bestand." + +#. module: web_favicon +#: model:ir.ui.view,arch_db:web_favicon.view_company_form +msgid "Web Favicon" +msgstr "Web Favicon" + +#. module: web_favicon +#: selection:res.company,favicon_backend_mimetype:0 +msgid "image/gif" +msgstr "afbeelding/gif" + +#. module: web_favicon +#: selection:res.company,favicon_backend_mimetype:0 +msgid "image/png" +msgstr "afbeelding/png" + +#. module: web_favicon +#: selection:res.company,favicon_backend_mimetype:0 +msgid "image/x-icon" +msgstr "afbeelding/x-icon" diff --git a/web_favicon/i18n/pt_BR.po b/web_favicon/i18n/pt_BR.po new file mode 100644 index 00000000..97f0859a --- /dev/null +++ b/web_favicon/i18n/pt_BR.po @@ -0,0 +1,66 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_favicon +# +# Translators: +# Rodrigo de Almeida Sottomaior Macedo , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-22 08:26+0000\n" +"PO-Revision-Date: 2018-08-04 13:35+0000\n" +"Last-Translator: Rodrigo Macedo \n" +"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/" +"23907/pt_BR/)\n" +"Language: pt_BR\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" +"X-Generator: Weblate 3.1.1\n" + +#. module: web_favicon +#: model:ir.model,name:web_favicon.model_res_company +msgid "Companies" +msgstr "Empresas" + +#. module: web_favicon +#: model:ir.ui.view,arch_db:web_favicon.view_company_form +msgid "Favicon" +msgstr "Favicon" + +#. module: web_favicon +#: model:ir.model.fields,field_description:web_favicon.field_res_company_favicon_backend +msgid "Favicon Backend" +msgstr "Favicon back-end" + +#. module: web_favicon +#: model:ir.model.fields,field_description:web_favicon.field_res_company_favicon_backend_mimetype +msgid "Favicon Backend Mimetype" +msgstr "Favicon back-end mimetype" + +#. module: web_favicon +#: model:ir.model.fields,help:web_favicon.field_res_company_favicon_backend_mimetype +msgid "Set the mimetype of your file." +msgstr "Defina o tipo mímico do seu arquivo." + +#. module: web_favicon +#: model:ir.ui.view,arch_db:web_favicon.view_company_form +msgid "Web Favicon" +msgstr "Favicon Web" + +#. module: web_favicon +#: selection:res.company,favicon_backend_mimetype:0 +msgid "image/gif" +msgstr "imagem/gif" + +#. module: web_favicon +#: selection:res.company,favicon_backend_mimetype:0 +msgid "image/png" +msgstr "imagem/png" + +#. module: web_favicon +#: selection:res.company,favicon_backend_mimetype:0 +msgid "image/x-icon" +msgstr "imagem/x-icon" diff --git a/web_favicon/i18n/web_favicon.pot b/web_favicon/i18n/web_favicon.pot new file mode 100644 index 00000000..1e337476 --- /dev/null +++ b/web_favicon/i18n/web_favicon.pot @@ -0,0 +1,60 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_favicon +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: web_favicon +#: model:ir.model,name:web_favicon.model_res_company +msgid "Companies" +msgstr "" + +#. module: web_favicon +#: model:ir.ui.view,arch_db:web_favicon.view_company_form +msgid "Favicon" +msgstr "" + +#. module: web_favicon +#: model:ir.model.fields,field_description:web_favicon.field_res_company_favicon_backend +msgid "Favicon Backend" +msgstr "" + +#. module: web_favicon +#: model:ir.model.fields,field_description:web_favicon.field_res_company_favicon_backend_mimetype +msgid "Favicon Backend Mimetype" +msgstr "" + +#. module: web_favicon +#: model:ir.model.fields,help:web_favicon.field_res_company_favicon_backend_mimetype +msgid "Set the mimetype of your file." +msgstr "" + +#. module: web_favicon +#: model:ir.ui.view,arch_db:web_favicon.view_company_form +msgid "Web Favicon" +msgstr "" + +#. module: web_favicon +#: selection:res.company,favicon_backend_mimetype:0 +msgid "image/gif" +msgstr "" + +#. module: web_favicon +#: selection:res.company,favicon_backend_mimetype:0 +msgid "image/png" +msgstr "" + +#. module: web_favicon +#: selection:res.company,favicon_backend_mimetype:0 +msgid "image/x-icon" +msgstr "" + diff --git a/web_favicon/models/__init__.py b/web_favicon/models/__init__.py new file mode 100644 index 00000000..a12c1b8e --- /dev/null +++ b/web_favicon/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import res_company diff --git a/web_favicon/models/res_company.py b/web_favicon/models/res_company.py new file mode 100644 index 00000000..99894824 --- /dev/null +++ b/web_favicon/models/res_company.py @@ -0,0 +1,16 @@ +# Copyright 2015 Therp BV +# Copyright 2016 Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models, fields + + +class ResCompany(models.Model): + _inherit = 'res.company' + + favicon_backend = fields.Binary() + favicon_backend_mimetype = fields.Selection( + selection=[('image/x-icon', 'image/x-icon'), + ('image/gif', 'image/gif'), + ('image/png', 'image/png')], + help='Set the mimetype of your file.') diff --git a/web_favicon/readme/CONFIGURE.rst b/web_favicon/readme/CONFIGURE.rst new file mode 100644 index 00000000..55777b65 --- /dev/null +++ b/web_favicon/readme/CONFIGURE.rst @@ -0,0 +1,15 @@ +Upload your favicon (16x16, 32x32, 64x64 or "as big as possible") on the +company form. The file format would be ico, gif or png with 16x16, 32x32 or +64x64 pixels and 16 colors. Highers resolutions or colors support depends on +the used browser, but most modern browsers do. + +Note that most browsers cache favicons basically forever, so if you want your +icon to show up, you'll most probably have to delete you browser cache. +Some browsers can refresh the favicon, accessing the URL +/web_favicon/favicon. + +You have a sample SVG that can be used as template for generating your icon +in /static/src/img/master_original_favicon.svg. You can also search for some +favicon generators across the web. + +To allow a user to edit the favicon it has to be member of group "Administration / Settings". diff --git a/web_favicon/readme/DESCRIPTION.rst b/web_favicon/readme/DESCRIPTION.rst new file mode 100644 index 00000000..83260785 --- /dev/null +++ b/web_favicon/readme/DESCRIPTION.rst @@ -0,0 +1,10 @@ + +This module was written to allow you to customize your Odoo instance's shortcut +icon (aka favicon). This is useful for branding purposes, but also for +integrators who have many different Odoo instances running and need to see at a +glance which browser tab does what. + +The icon is shown also for portal users when the website modules are not +installed. + +More info about favicon: https://en.wikipedia.org/wiki/Favicon diff --git a/web_favicon/readme/ROADMAP.rst b/web_favicon/readme/ROADMAP.rst new file mode 100644 index 00000000..b4d00087 --- /dev/null +++ b/web_favicon/readme/ROADMAP.rst @@ -0,0 +1,6 @@ +* Allow to upload some big icon (preferrably SVG or the like) and generate + all the icons from it +* Generate icons suitable for mobile devices and web apps (see /static/src/img/ + folder inside the module for a sample of the possible current formats. +* Put the icon definition at system level, not at company level. It doesn't + make sense (as the icon is cached) to have a different icon per company. diff --git a/web_favicon/static/description/icon.png b/web_favicon/static/description/icon.png new file mode 100644 index 00000000..bc0090b3 Binary files /dev/null and b/web_favicon/static/description/icon.png differ diff --git a/web_favicon/static/description/index.html b/web_favicon/static/description/index.html new file mode 100644 index 00000000..866cc6c6 --- /dev/null +++ b/web_favicon/static/description/index.html @@ -0,0 +1,447 @@ + + + + + + +Custom shortcut icon + + + +
+

Custom shortcut icon

+ + +

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runbot

+

This module was written to allow you to customize your Odoo instance’s shortcut +icon (aka favicon). This is useful for branding purposes, but also for +integrators who have many different Odoo instances running and need to see at a +glance which browser tab does what.

+

The icon is shown also for portal users when the website modules are not +installed.

+

More info about favicon: https://en.wikipedia.org/wiki/Favicon

+

Table of contents

+ +
+

Configuration

+

Upload your favicon (16x16, 32x32, 64x64 or “as big as possible”) on the +company form. The file format would be ico, gif or png with 16x16, 32x32 or +64x64 pixels and 16 colors. Highers resolutions or colors support depends on +the used browser, but most modern browsers do.

+

Note that most browsers cache favicons basically forever, so if you want your +icon to show up, you’ll most probably have to delete you browser cache. +Some browsers can refresh the favicon, accessing the URL +<base_url>/web_favicon/favicon.

+

You have a sample SVG that can be used as template for generating your icon +in /static/src/img/master_original_favicon.svg. You can also search for some +favicon generators across the web.

+

To allow a user to edit the favicon it has to be member of group “Administration / Settings”.

+
+
+

Known issues / Roadmap

+
    +
  • Allow to upload some big icon (preferrably SVG or the like) and generate +all the icons from it
  • +
  • Generate icons suitable for mobile devices and web apps (see /static/src/img/ +folder inside the module for a sample of the possible current formats.
  • +
  • Put the icon definition at system level, not at company level. It doesn’t +make sense (as the icon is cached) to have a different icon per company.
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Therp BV
  • +
  • Tecnativa
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/web project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/web_favicon/static/src/img/android-chrome-144x144.png b/web_favicon/static/src/img/android-chrome-144x144.png new file mode 100644 index 00000000..47cbf21a Binary files /dev/null and b/web_favicon/static/src/img/android-chrome-144x144.png differ diff --git a/web_favicon/static/src/img/android-chrome-192x192.png b/web_favicon/static/src/img/android-chrome-192x192.png new file mode 100644 index 00000000..95dd0dfc Binary files /dev/null and b/web_favicon/static/src/img/android-chrome-192x192.png differ diff --git a/web_favicon/static/src/img/android-chrome-36x36.png b/web_favicon/static/src/img/android-chrome-36x36.png new file mode 100644 index 00000000..046b7266 Binary files /dev/null and b/web_favicon/static/src/img/android-chrome-36x36.png differ diff --git a/web_favicon/static/src/img/android-chrome-48x48.png b/web_favicon/static/src/img/android-chrome-48x48.png new file mode 100644 index 00000000..5a31a338 Binary files /dev/null and b/web_favicon/static/src/img/android-chrome-48x48.png differ diff --git a/web_favicon/static/src/img/android-chrome-72x72.png b/web_favicon/static/src/img/android-chrome-72x72.png new file mode 100644 index 00000000..1e22c520 Binary files /dev/null and b/web_favicon/static/src/img/android-chrome-72x72.png differ diff --git a/web_favicon/static/src/img/android-chrome-96x96.png b/web_favicon/static/src/img/android-chrome-96x96.png new file mode 100644 index 00000000..63ba2618 Binary files /dev/null and b/web_favicon/static/src/img/android-chrome-96x96.png differ diff --git a/web_favicon/static/src/img/apple-touch-icon-114x114.png b/web_favicon/static/src/img/apple-touch-icon-114x114.png new file mode 100644 index 00000000..0aaacd34 Binary files /dev/null and b/web_favicon/static/src/img/apple-touch-icon-114x114.png differ diff --git a/web_favicon/static/src/img/apple-touch-icon-120x120.png b/web_favicon/static/src/img/apple-touch-icon-120x120.png new file mode 100644 index 00000000..3909ec7f Binary files /dev/null and b/web_favicon/static/src/img/apple-touch-icon-120x120.png differ diff --git a/web_favicon/static/src/img/apple-touch-icon-144x144.png b/web_favicon/static/src/img/apple-touch-icon-144x144.png new file mode 100644 index 00000000..f295122a Binary files /dev/null and b/web_favicon/static/src/img/apple-touch-icon-144x144.png differ diff --git a/web_favicon/static/src/img/apple-touch-icon-152x152.png b/web_favicon/static/src/img/apple-touch-icon-152x152.png new file mode 100644 index 00000000..93fd730b Binary files /dev/null and b/web_favicon/static/src/img/apple-touch-icon-152x152.png differ diff --git a/web_favicon/static/src/img/apple-touch-icon-180x180.png b/web_favicon/static/src/img/apple-touch-icon-180x180.png new file mode 100644 index 00000000..2899fa5d Binary files /dev/null and b/web_favicon/static/src/img/apple-touch-icon-180x180.png differ diff --git a/web_favicon/static/src/img/apple-touch-icon-57x57.png b/web_favicon/static/src/img/apple-touch-icon-57x57.png new file mode 100644 index 00000000..1f06b9f2 Binary files /dev/null and b/web_favicon/static/src/img/apple-touch-icon-57x57.png differ diff --git a/web_favicon/static/src/img/apple-touch-icon-60x60.png b/web_favicon/static/src/img/apple-touch-icon-60x60.png new file mode 100644 index 00000000..715f3339 Binary files /dev/null and b/web_favicon/static/src/img/apple-touch-icon-60x60.png differ diff --git a/web_favicon/static/src/img/apple-touch-icon-72x72.png b/web_favicon/static/src/img/apple-touch-icon-72x72.png new file mode 100644 index 00000000..6e869d45 Binary files /dev/null and b/web_favicon/static/src/img/apple-touch-icon-72x72.png differ diff --git a/web_favicon/static/src/img/apple-touch-icon-76x76.png b/web_favicon/static/src/img/apple-touch-icon-76x76.png new file mode 100644 index 00000000..490ff715 Binary files /dev/null and b/web_favicon/static/src/img/apple-touch-icon-76x76.png differ diff --git a/web_favicon/static/src/img/apple-touch-icon-precomposed.png b/web_favicon/static/src/img/apple-touch-icon-precomposed.png new file mode 100644 index 00000000..2b3af81e Binary files /dev/null and b/web_favicon/static/src/img/apple-touch-icon-precomposed.png differ diff --git a/web_favicon/static/src/img/apple-touch-icon.png b/web_favicon/static/src/img/apple-touch-icon.png new file mode 100644 index 00000000..2899fa5d Binary files /dev/null and b/web_favicon/static/src/img/apple-touch-icon.png differ diff --git a/web_favicon/static/src/img/browserconfig.xml b/web_favicon/static/src/img/browserconfig.xml new file mode 100644 index 00000000..fe44cae8 --- /dev/null +++ b/web_favicon/static/src/img/browserconfig.xml @@ -0,0 +1,12 @@ + + + + + + + + + #da532c + + + diff --git a/web_favicon/static/src/img/favicon-16x16.png b/web_favicon/static/src/img/favicon-16x16.png new file mode 100644 index 00000000..b9f30800 Binary files /dev/null and b/web_favicon/static/src/img/favicon-16x16.png differ diff --git a/web_favicon/static/src/img/favicon-32x32.png b/web_favicon/static/src/img/favicon-32x32.png new file mode 100644 index 00000000..8e73a163 Binary files /dev/null and b/web_favicon/static/src/img/favicon-32x32.png differ diff --git a/web_favicon/static/src/img/favicon-96x96.png b/web_favicon/static/src/img/favicon-96x96.png new file mode 100644 index 00000000..63ba2618 Binary files /dev/null and b/web_favicon/static/src/img/favicon-96x96.png differ diff --git a/web_favicon/static/src/img/favicon.ico b/web_favicon/static/src/img/favicon.ico new file mode 100644 index 00000000..cdf7926f Binary files /dev/null and b/web_favicon/static/src/img/favicon.ico differ diff --git a/web_favicon/static/src/img/manifest.json b/web_favicon/static/src/img/manifest.json new file mode 100644 index 00000000..0f649d7b --- /dev/null +++ b/web_favicon/static/src/img/manifest.json @@ -0,0 +1,41 @@ +{ + "name": "Odoo", + "icons": [ + { + "src": "\/android-chrome-36x36.png", + "sizes": "36x36", + "type": "image\/png", + "density": "0.75" + }, + { + "src": "\/android-chrome-48x48.png", + "sizes": "48x48", + "type": "image\/png", + "density": "1.0" + }, + { + "src": "\/android-chrome-72x72.png", + "sizes": "72x72", + "type": "image\/png", + "density": "1.5" + }, + { + "src": "\/android-chrome-96x96.png", + "sizes": "96x96", + "type": "image\/png", + "density": "2.0" + }, + { + "src": "\/android-chrome-144x144.png", + "sizes": "144x144", + "type": "image\/png", + "density": "3.0" + }, + { + "src": "\/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image\/png", + "density": "4.0" + } + ] +} diff --git a/web_favicon/static/src/img/master_original_favicon.png b/web_favicon/static/src/img/master_original_favicon.png new file mode 100644 index 00000000..22a0aa8f Binary files /dev/null and b/web_favicon/static/src/img/master_original_favicon.png differ diff --git a/web_favicon/static/src/img/master_original_favicon.svg b/web_favicon/static/src/img/master_original_favicon.svg new file mode 100644 index 00000000..078a9ef3 --- /dev/null +++ b/web_favicon/static/src/img/master_original_favicon.svg @@ -0,0 +1,56 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/web_favicon/static/src/img/mstile-144x144.png b/web_favicon/static/src/img/mstile-144x144.png new file mode 100644 index 00000000..e44e2367 Binary files /dev/null and b/web_favicon/static/src/img/mstile-144x144.png differ diff --git a/web_favicon/static/src/img/mstile-150x150.png b/web_favicon/static/src/img/mstile-150x150.png new file mode 100644 index 00000000..96b4e865 Binary files /dev/null and b/web_favicon/static/src/img/mstile-150x150.png differ diff --git a/web_favicon/static/src/img/mstile-310x150.png b/web_favicon/static/src/img/mstile-310x150.png new file mode 100644 index 00000000..a924d3ff Binary files /dev/null and b/web_favicon/static/src/img/mstile-310x150.png differ diff --git a/web_favicon/static/src/img/mstile-310x310.png b/web_favicon/static/src/img/mstile-310x310.png new file mode 100644 index 00000000..b9b4a3e8 Binary files /dev/null and b/web_favicon/static/src/img/mstile-310x310.png differ diff --git a/web_favicon/static/src/img/mstile-70x70.png b/web_favicon/static/src/img/mstile-70x70.png new file mode 100644 index 00000000..c02805fe Binary files /dev/null and b/web_favicon/static/src/img/mstile-70x70.png differ diff --git a/web_favicon/static/src/img/website_favicon_sample.html b/web_favicon/static/src/img/website_favicon_sample.html new file mode 100644 index 00000000..db828882 --- /dev/null +++ b/web_favicon/static/src/img/website_favicon_sample.html @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/web_favicon/tests/__init__.py b/web_favicon/tests/__init__.py new file mode 100644 index 00000000..9be3cd52 --- /dev/null +++ b/web_favicon/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_web_favicon diff --git a/web_favicon/tests/test_web_favicon.py b/web_favicon/tests/test_web_favicon.py new file mode 100644 index 00000000..99dbe39a --- /dev/null +++ b/web_favicon/tests/test_web_favicon.py @@ -0,0 +1,47 @@ +# Copyright 2015 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import base64 +from odoo.tests.common import TransactionCase +from odoo.tools.misc import file_open +from odoo import http + + +class FakeRequest(object): + def __init__(self, env): + self.env = env + + def make_response(self, data, headers): + return FakeResponse(data, headers) + + +class FakeResponse(object): + def __init__(self, data, headers): + self.data = data + self.headers = dict(headers) + + +class TestWebFavicon(TransactionCase): + def test_web_favicon(self): + original_request = http.request + http.request = FakeRequest(self.env) + from odoo.addons.web_favicon.controllers.web_favicon import\ + WebFavicon + company = self.env['res.company'].search([], limit=1) + # default icon + company.write({ + 'favicon_backend': False, + 'favicon_backend_mimetype': False, + }) + data = WebFavicon().icon() + self.assertEqual(data.headers['Content-Type'], 'image/x-icon') + # our own icon + company.write({ + 'favicon_backend': base64.b64encode(file_open( + 'web_favicon/static/description/icon.png', 'rb').read()), + 'favicon_backend_mimetype': 'image/png', + }) + data = WebFavicon().icon() + self.assertEqual(data.headers['Content-Type'], + company.favicon_backend_mimetype) + http.request = original_request diff --git a/web_favicon/views/res_company.xml b/web_favicon/views/res_company.xml new file mode 100644 index 00000000..b35fe55d --- /dev/null +++ b/web_favicon/views/res_company.xml @@ -0,0 +1,17 @@ + + + + res.company + + + + + + + + + + + + + diff --git a/web_favicon/views/templates.xml b/web_favicon/views/templates.xml new file mode 100644 index 00000000..37edb63b --- /dev/null +++ b/web_favicon/views/templates.xml @@ -0,0 +1,10 @@ + + + +