Browse Source

Merge pull request #800 from QubiQ/11.0-mig-web_favicon

[11.0] [MIG] web_favicon
pull/899/head
Pedro M. Baeza 7 years ago
committed by GitHub
parent
commit
ebb0f5fdd9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 86
      web_favicon/README.rst
  2. 5
      web_favicon/__init__.py
  3. 23
      web_favicon/__manifest__.py
  4. 4
      web_favicon/controllers/__init__.py
  5. 30
      web_favicon/controllers/web_favicon.py
  6. 64
      web_favicon/i18n/de.po
  7. 64
      web_favicon/i18n/es.po
  8. 65
      web_favicon/i18n/hr.po
  9. 64
      web_favicon/i18n/nl_NL.po
  10. 64
      web_favicon/i18n/pt_BR.po
  11. 4
      web_favicon/models/__init__.py
  12. 17
      web_favicon/models/res_company.py
  13. BIN
      web_favicon/static/description/icon.png
  14. BIN
      web_favicon/static/src/img/android-chrome-144x144.png
  15. BIN
      web_favicon/static/src/img/android-chrome-192x192.png
  16. BIN
      web_favicon/static/src/img/android-chrome-36x36.png
  17. BIN
      web_favicon/static/src/img/android-chrome-48x48.png
  18. BIN
      web_favicon/static/src/img/android-chrome-72x72.png
  19. BIN
      web_favicon/static/src/img/android-chrome-96x96.png
  20. BIN
      web_favicon/static/src/img/apple-touch-icon-114x114.png
  21. BIN
      web_favicon/static/src/img/apple-touch-icon-120x120.png
  22. BIN
      web_favicon/static/src/img/apple-touch-icon-144x144.png
  23. BIN
      web_favicon/static/src/img/apple-touch-icon-152x152.png
  24. BIN
      web_favicon/static/src/img/apple-touch-icon-180x180.png
  25. BIN
      web_favicon/static/src/img/apple-touch-icon-57x57.png
  26. BIN
      web_favicon/static/src/img/apple-touch-icon-60x60.png
  27. BIN
      web_favicon/static/src/img/apple-touch-icon-72x72.png
  28. BIN
      web_favicon/static/src/img/apple-touch-icon-76x76.png
  29. BIN
      web_favicon/static/src/img/apple-touch-icon-precomposed.png
  30. BIN
      web_favicon/static/src/img/apple-touch-icon.png
  31. 12
      web_favicon/static/src/img/browserconfig.xml
  32. BIN
      web_favicon/static/src/img/favicon-16x16.png
  33. BIN
      web_favicon/static/src/img/favicon-32x32.png
  34. BIN
      web_favicon/static/src/img/favicon-96x96.png
  35. BIN
      web_favicon/static/src/img/favicon.ico
  36. 41
      web_favicon/static/src/img/manifest.json
  37. BIN
      web_favicon/static/src/img/master_original_favicon.png
  38. 56
      web_favicon/static/src/img/master_original_favicon.svg
  39. BIN
      web_favicon/static/src/img/mstile-144x144.png
  40. BIN
      web_favicon/static/src/img/mstile-150x150.png
  41. BIN
      web_favicon/static/src/img/mstile-310x150.png
  42. BIN
      web_favicon/static/src/img/mstile-310x310.png
  43. BIN
      web_favicon/static/src/img/mstile-70x70.png
  44. 24
      web_favicon/static/src/img/website_favicon_sample.html
  45. 4
      web_favicon/tests/__init__.py
  46. 48
      web_favicon/tests/test_web_favicon.py
  47. 17
      web_favicon/views/res_company.xml
  48. 8
      web_favicon/views/templates.xml

86
web_favicon/README.rst

@ -0,0 +1,86 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
==============================
Custom shortcut icon (favicon)
==============================
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.
More info about favicon: https://en.wikipedia.org/wiki/Favicon
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".
Usage
=====
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/162/10.0
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 <https://github.com/OCA/web/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
`here <https://github.com/OCA/web/issues/new?body=module:%20
web_favicon%0Aversion:%20
10.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Contributors
------------
* Holger Brunn <hbrunn@therp.nl>
* Pedro M. Baeza <pedro.baeza@gmail.com>
* Dennis Sluijk <d.sluijk@onestein.nl>
* Marçal Isern <marsal.isern@qubiq.es>
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
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.
To contribute to this module, please visit https://odoo-community.org.

5
web_favicon/__init__.py

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models
from . import controllers

23
web_favicon/__manifest__.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Therp BV <http://therp.nl>
# Copyright 2016 Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Custom shortcut icon",
"version": "11.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)",
"depends": [
"web",
],
"data": [
"views/res_company.xml",
"views/templates.xml",
],
"installable": True,
}

4
web_favicon/controllers/__init__.py

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import web_favicon

30
web_favicon/controllers/web_favicon.py

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Therp BV <http://therp.nl>
# Copyright 2017 QubiQ 2010 <http://www.qubiq.es>
# 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)])

64
web_favicon/i18n/de.po

@ -0,0 +1,64 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_favicon
#
# Translators:
# Niki Waibel <niki.waibel@gmail.com>, 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 <niki.waibel@gmail.com>, 2016\n"
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: de\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
msgid "Favicon backend"
msgstr "Icon"
#. module: web_favicon
#: model:ir.model.fields,field_description:web_favicon.field_res_company_favicon_backend_mimetype
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"

64
web_favicon/i18n/es.po

@ -0,0 +1,64 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_favicon
#
# Translators:
# Pedro M. Baeza <pedro.baeza@gmail.com>, 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 <pedro.baeza@gmail.com>, 2016\n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es\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
msgid "Favicon backend"
msgstr "Favicon del backend"
#. module: web_favicon
#: model:ir.model.fields,field_description:web_favicon.field_res_company_favicon_backend_mimetype
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"

65
web_favicon/i18n/hr.po

@ -0,0 +1,65 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_favicon
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
# Bole <bole@dajmi5.com>, 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 <bole@dajmi5.com>, 2017\n"
"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: hr\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
msgid "Favicon backend"
msgstr "Favicon backend"
#. 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 "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"

64
web_favicon/i18n/nl_NL.po

@ -0,0 +1,64 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_favicon
#
# Translators:
# Peter Hageman <hageman.p@gmail.com>, 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 <hageman.p@gmail.com>, 2017\n"
"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/teams/23907/nl_NL/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: nl_NL\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
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 "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"

64
web_favicon/i18n/pt_BR.po

@ -0,0 +1,64 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_favicon
#
# Translators:
# Rodrigo de Almeida Sottomaior Macedo <rmsolucoeseminformatic4@gmail.com>, 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: 2017-06-22 08:26+0000\n"
"Last-Translator: Rodrigo de Almeida Sottomaior Macedo <rmsolucoeseminformatic4@gmail.com>, 2017\n"
"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/23907/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 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 backend"
#. module: web_favicon
#: model:ir.model.fields,field_description:web_favicon.field_res_company_favicon_backend_mimetype
msgid "Favicon backend mimetype"
msgstr "Favicon backend 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 "Web Favicon"
#. 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"

4
web_favicon/models/__init__.py

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import res_company

17
web_favicon/models/res_company.py

@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Therp BV <http://therp.nl>
# 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.')

BIN
web_favicon/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 3.3 KiB

BIN
web_favicon/static/src/img/android-chrome-144x144.png

After

Width: 144  |  Height: 144  |  Size: 1.6 KiB

BIN
web_favicon/static/src/img/android-chrome-192x192.png

After

Width: 192  |  Height: 192  |  Size: 2.3 KiB

BIN
web_favicon/static/src/img/android-chrome-36x36.png

After

Width: 36  |  Height: 36  |  Size: 582 B

BIN
web_favicon/static/src/img/android-chrome-48x48.png

After

Width: 48  |  Height: 48  |  Size: 693 B

BIN
web_favicon/static/src/img/android-chrome-72x72.png

After

Width: 72  |  Height: 72  |  Size: 949 B

BIN
web_favicon/static/src/img/android-chrome-96x96.png

After

Width: 96  |  Height: 96  |  Size: 1.2 KiB

BIN
web_favicon/static/src/img/apple-touch-icon-114x114.png

After

Width: 114  |  Height: 114  |  Size: 1.2 KiB

BIN
web_favicon/static/src/img/apple-touch-icon-120x120.png

After

Width: 120  |  Height: 120  |  Size: 1.2 KiB

BIN
web_favicon/static/src/img/apple-touch-icon-144x144.png

After

Width: 144  |  Height: 144  |  Size: 1.5 KiB

BIN
web_favicon/static/src/img/apple-touch-icon-152x152.png

After

Width: 152  |  Height: 152  |  Size: 1.5 KiB

BIN
web_favicon/static/src/img/apple-touch-icon-180x180.png

After

Width: 180  |  Height: 180  |  Size: 1.8 KiB

BIN
web_favicon/static/src/img/apple-touch-icon-57x57.png

After

Width: 57  |  Height: 57  |  Size: 677 B

BIN
web_favicon/static/src/img/apple-touch-icon-60x60.png

After

Width: 60  |  Height: 60  |  Size: 736 B

BIN
web_favicon/static/src/img/apple-touch-icon-72x72.png

After

Width: 72  |  Height: 72  |  Size: 869 B

BIN
web_favicon/static/src/img/apple-touch-icon-76x76.png

After

Width: 76  |  Height: 76  |  Size: 855 B

BIN
web_favicon/static/src/img/apple-touch-icon-precomposed.png

After

Width: 180  |  Height: 180  |  Size: 2.3 KiB

BIN
web_favicon/static/src/img/apple-touch-icon.png

After

Width: 180  |  Height: 180  |  Size: 1.8 KiB

12
web_favicon/static/src/img/browserconfig.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="/mstile-70x70.png"/>
<square150x150logo src="/mstile-150x150.png"/>
<square310x310logo src="/mstile-310x310.png"/>
<wide310x150logo src="/mstile-310x150.png"/>
<TileColor>#da532c</TileColor>
</tile>
</msapplication>
</browserconfig>

BIN
web_favicon/static/src/img/favicon-16x16.png

After

Width: 16  |  Height: 16  |  Size: 390 B

BIN
web_favicon/static/src/img/favicon-32x32.png

After

Width: 32  |  Height: 32  |  Size: 533 B

BIN
web_favicon/static/src/img/favicon-96x96.png

After

Width: 96  |  Height: 96  |  Size: 1.2 KiB

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

41
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"
}
]
}

BIN
web_favicon/static/src/img/master_original_favicon.png

After

Width: 260  |  Height: 260  |  Size: 7.1 KiB

56
web_favicon/static/src/img/master_original_favicon.svg

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
width="260"
height="260"
xml:space="preserve"
sodipodi:docname="master_original_favicon.svg"
inkscape:export-filename="master_original_favicon.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"><metadata
id="metadata8"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs6" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1861"
inkscape:window-height="1176"
id="namedview4"
showgrid="false"
inkscape:zoom="2.6264843"
inkscape:cx="139.55902"
inkscape:cy="63.525562"
inkscape:window-x="59"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="g10"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" /><g
id="g10"
inkscape:groupmode="layer"
inkscape:label="ink_ext_XXXXXX"
transform="matrix(1.25,0,0,-1.25,0,260)"><path
inkscape:connector-curvature="0"
id="path14"
style="fill:#a2478a;fill-opacity:1;fill-rule:nonzero;stroke:none"
d="m 104.00014,165.45424 c -8.313043,0 -16.263246,-1.57861 -23.850744,-4.72609 -7.594015,-3.15718 -14.181554,-7.52151 -19.768717,-13.10966 -5.587026,-5.58537 -10.031894,-12.10596 -13.321854,-19.55278 -3.297028,-7.45376 -4.942836,-15.61837 -4.942836,-24.4966 0,-8.312905 1.645808,-16.26269 4.942836,-23.850746 3.28996,-7.594012 7.734828,-14.256255 13.321854,-19.984093 5.587163,-5.733797 12.174702,-10.246299 19.768717,-13.536809 7.587498,-3.297027 15.537701,-4.941729 23.850744,-4.941729 8.30583,0 16.2577,1.644702 23.85171,4.941729 7.5875,3.29051 14.18128,7.803012 19.76942,13.536809 5.58675,5.727838 10.02454,12.390081 13.32171,19.984093 3.29023,7.588056 4.94089,15.537841 4.94089,23.850746 -0.85928,16.90258 -6.87567,31.15898 -18.04779,42.76184 -11.17419,11.60314 -25.6454,17.97571 -43.40561,19.12329 l -0.43033,0 z M 104.43047,208 c 14.03437,0 27.28859,-2.79405 39.75226,-8.38083 12.46244,-5.58534 23.4211,-13.10687 32.87602,-22.5618 9.45355,-9.45492 16.97508,-20.48705 22.56183,-33.09085 C 205.20733,131.3558 208,117.89258 208,103.56911 208,89.239815 205.27385,75.85019 199.83679,63.387487 194.39,50.925336 187.01124,39.966662 177.70323,30.511325 168.38966,21.056678 157.431,13.602838 144.82719,8.1646355 132.21703,2.726419 118.61203,0 104.00014,0 89.671258,0 76.208041,2.5780813 63.603558,7.7347705 50.993109,12.892 39.96777,20.123798 30.512431,29.437215 21.058202,38.744259 13.605015,49.702934 8.1651761,62.313379 2.7204595,74.917448 0,88.668665 0,103.56911 c 0,14.32347 2.6462976,27.71892 7.9502436,40.1826 5.2990814,12.46381 12.6781754,23.34765 22.1335154,32.66119 9.453538,9.30801 20.553026,16.76025 33.305391,22.347 12.744188,5.58675 26.429298,8.66218 41.04132,9.2401" /></g></svg>

BIN
web_favicon/static/src/img/mstile-144x144.png

After

Width: 144  |  Height: 144  |  Size: 1.8 KiB

BIN
web_favicon/static/src/img/mstile-150x150.png

After

Width: 270  |  Height: 270  |  Size: 1.6 KiB

BIN
web_favicon/static/src/img/mstile-310x150.png

After

Width: 558  |  Height: 270  |  Size: 1.5 KiB

BIN
web_favicon/static/src/img/mstile-310x310.png

After

Width: 558  |  Height: 558  |  Size: 3.2 KiB

BIN
web_favicon/static/src/img/mstile-70x70.png

After

Width: 128  |  Height: 128  |  Size: 1.2 KiB

24
web_favicon/static/src/img/website_favicon_sample.html

@ -0,0 +1,24 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">
<head profile="http://www.w3.org/2005/10/profile">
<link rel="shortcut icon" href="/website_favicon/static/src/img/favicon.ico" type="image/x-icon"/>
<link rel="apple-touch-icon" sizes="57x57" href="/website_favicon/static/src/img/apple-touch-icon-57x57.png"/>
<link rel="apple-touch-icon" sizes="60x60" href="/website_favicon/static/src/img/apple-touch-icon-60x60.png"/>
<link rel="apple-touch-icon" sizes="72x72" href="/website_favicon/static/src/img/apple-touch-icon-72x72.png"/>
<link rel="apple-touch-icon" sizes="76x76" href="/website_favicon/static/src/img/apple-touch-icon-76x76.png"/>
<link rel="apple-touch-icon" sizes="114x114" href="/website_favicon/static/src/img/apple-touch-icon-114x114.png"/>
<link rel="apple-touch-icon" sizes="120x120" href="/website_favicon/static/src/img/apple-touch-icon-120x120.png"/>
<link rel="apple-touch-icon" sizes="144x144" href="/website_favicon/static/src/img/apple-touch-icon-144x144.png"/>
<link rel="apple-touch-icon" sizes="152x152" href="/website_favicon/static/src/img/apple-touch-icon-152x152.png"/>
<link rel="apple-touch-icon" sizes="180x180" href="/website_favicon/static/src/img/apple-touch-icon-180x180.png"/>
<link rel="icon" type="image/png" href="/website_favicon/static/src/img/favicon-32x32.png" sizes="32x32"/>
<link rel="icon" type="image/png" href="/website_favicon/static/src/img/android-chrome-192x192.png" sizes="192x192"/>
<link rel="icon" type="image/png" href="/website_favicon/static/src/img/favicon-96x96.png" sizes="96x96"/>
<link rel="icon" type="image/png" href="/website_favicon/static/src/img/favicon-16x16.png" sizes="16x16"/>
<link rel="manifest" href="/manifest.json"/>
<meta name="msapplication-TileColor" content="#da532c"/>
<meta name="msapplication-TileImage" content="/mstile-144x144.png"/>
<meta name="theme-color" content="#ffffff"/>
</head>
<body/>
</html>

4
web_favicon/tests/__init__.py

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import test_web_favicon

48
web_favicon/tests/test_web_favicon.py

@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
# © 2015 Therp BV <http://therp.nl>
# 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

17
web_favicon/views/res_company.xml

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_company_form" model="ir.ui.view">
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form" />
<field name="arch" type="xml">
<notebook position="inside">
<page string="Web Favicon" name="favicon" groups="base.group_system">
<group string="Favicon" name="favicon">
<field name="favicon_backend" widget="image" />
<field name="favicon_backend_mimetype" attrs="{'required': [('favicon_backend', '!=', False)]}" />
</group>
</page>
</notebook>
</field>
</record>
</odoo>

8
web_favicon/views/templates.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<template id="layout" inherit_id="web.layout">
<xpath expr="//link[@rel='shortcut icon']" position="replace">
<link rel="icon" href="/web_favicon/favicon" />
</xpath>
</template>
</odoo>
Loading…
Cancel
Save