Merge pull request #1060 from tarteo/12.0-web-favicon

[12.0][MIG] web_favicon
pull/1098/head
Pedro M. Baeza 2018-10-24 11:34:21 +02:00 committed by GitHub
commit 9c65d91a54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
54 changed files with 1327 additions and 0 deletions

View File

@ -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
<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 <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 <https://github.com/OCA/web/issues/new?body=module:%20web_favicon%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
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 <https://github.com/OCA/web/tree/12.0/web_favicon>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

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

View File

@ -0,0 +1,23 @@
# 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": "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,
}

View File

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

View File

@ -0,0 +1,29 @@
# 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)])

View File

@ -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 <hhg@gabelgaard.org>\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 ""

View File

@ -0,0 +1,66 @@
# 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"
"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"

View File

@ -0,0 +1,66 @@
# 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"
"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"

View File

@ -0,0 +1,68 @@
# 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"
"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"

View File

@ -0,0 +1,66 @@
# 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"
"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"

View File

@ -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 <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: 2018-08-04 13:35+0000\n"
"Last-Translator: Rodrigo Macedo <rmsolucoeseminformatic4@gmail.com>\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"

View File

@ -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 ""

View File

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

View File

@ -0,0 +1,16 @@
# 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.')

View File

@ -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
<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".

View File

@ -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

View File

@ -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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -0,0 +1,447 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>Custom shortcut icon</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="custom-shortcut-icon">
<h1 class="title">Custom shortcut icon</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/web/tree/12.0/web_favicon"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_favicon"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/162/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module was written to allow you to customize your Odoo instances 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.</p>
<p>The icon is shown also for portal users when the website modules are not
installed.</p>
<p>More info about favicon: <a class="reference external" href="https://en.wikipedia.org/wiki/Favicon">https://en.wikipedia.org/wiki/Favicon</a></p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#configuration" id="id1">Configuration</a></li>
<li><a class="reference internal" href="#known-issues-roadmap" id="id2">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#id1">Configuration</a></h1>
<p>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.</p>
<p>Note that most browsers cache favicons basically forever, so if you want your
icon to show up, youll most probably have to delete you browser cache.
Some browsers can refresh the favicon, accessing the URL
&lt;base_url&gt;/web_favicon/favicon.</p>
<p>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.</p>
<p>To allow a user to edit the favicon it has to be member of group “Administration / Settings”.</p>
</div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#id2">Known issues / Roadmap</a></h1>
<ul class="simple">
<li>Allow to upload some big icon (preferrably SVG or the like) and generate
all the icons from it</li>
<li>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.</li>
<li>Put the icon definition at system level, not at company level. It doesnt
make sense (as the icon is cached) to have a different icon per company.</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_favicon%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id4">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id5">Authors</a></h2>
<ul class="simple">
<li>Therp BV</li>
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/12.0/web_favicon">OCA/web</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 949 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 736 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 869 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@ -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>

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -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>

View File

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

View File

@ -0,0 +1,47 @@
# Copyright 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

View File

@ -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>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<template id="layout" inherit_id="web.layout">
<xpath expr="//link[@rel='shortcut icon']" position="before">
<t t-if="not website">
<t t-set="x_icon" t-value="'/web_favicon/favicon'"/>
</t>
</xpath>
</template>
</odoo>