mirror of https://github.com/OCA/web.git
[IMP] web_favicon: pre-commit auto fixes
parent
7c25d048cd
commit
32b84f2079
|
@ -17,22 +17,21 @@ Custom shortcut icon
|
||||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||||
:alt: License: AGPL-3
|
:alt: License: AGPL-3
|
||||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
|
.. |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
|
:target: https://github.com/OCA/web/tree/17.0/web_favicon
|
||||||
:alt: OCA/web
|
:alt: OCA/web
|
||||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
.. |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
|
:target: https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_favicon
|
||||||
:alt: Translate me on Weblate
|
:alt: Translate me on Weblate
|
||||||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
||||||
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=12.0
|
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=17.0
|
||||||
:alt: Try me on Runboat
|
:alt: Try me on Runboat
|
||||||
|
|
||||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
|
|
||||||
|
This module was written to allow you to customize your Odoo instance's
|
||||||
This module was written to allow you to customize your Odoo instance's shortcut
|
shortcut icon (aka favicon). This is useful for branding purposes, but
|
||||||
icon (aka favicon). This is useful for branding purposes, but also for
|
also for integrators who have many different Odoo instances running and
|
||||||
integrators who have many different Odoo instances running and need to see at a
|
need to see at a glance which browser tab does what.
|
||||||
glance which browser tab does what.
|
|
||||||
|
|
||||||
The icon is shown also for portal users when the website modules are not
|
The icon is shown also for portal users when the website modules are not
|
||||||
installed.
|
installed.
|
||||||
|
@ -48,30 +47,33 @@ Configuration
|
||||||
=============
|
=============
|
||||||
|
|
||||||
Upload your favicon (16x16, 32x32, 64x64 or "as big as possible") on the
|
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
|
company form. The file format would be ico, gif or png with 16x16, 32x32
|
||||||
64x64 pixels and 16 colors. Highers resolutions or colors support depends on
|
or 64x64 pixels and 16 colors. Highers resolutions or colors support
|
||||||
the used browser, but most modern browsers do.
|
depends on the used browser, but most modern browsers do.
|
||||||
|
|
||||||
Note that most browsers cache favicons basically forever, so if you want your
|
Note that most browsers cache favicons basically forever, so if you want
|
||||||
icon to show up, you'll most probably have to delete you browser cache.
|
your icon to show up, you'll most probably have to delete you browser
|
||||||
Some browsers can refresh the favicon, accessing the URL
|
cache. Some browsers can refresh the favicon, accessing the URL
|
||||||
<base_url>/web_favicon/favicon.
|
<base_url>/web_favicon/favicon.
|
||||||
|
|
||||||
You have a sample SVG that can be used as template for generating your icon
|
You have a sample SVG that can be used as template for generating your
|
||||||
in /static/src/img/master_original_favicon.svg. You can also search for some
|
icon in /static/src/img/master_original_favicon.svg. You can also search
|
||||||
favicon generators across the web.
|
for some favicon generators across the web.
|
||||||
|
|
||||||
To allow a user to edit the favicon it has to be member of group "Administration / Settings".
|
To allow a user to edit the favicon it has to be member of group
|
||||||
|
"Administration / Settings".
|
||||||
|
|
||||||
Known issues / Roadmap
|
Known issues / Roadmap
|
||||||
======================
|
======================
|
||||||
|
|
||||||
* Allow to upload some big icon (preferrably SVG or the like) and generate
|
- Allow to upload some big icon (preferrably SVG or the like) and
|
||||||
all the icons from it
|
generate all the icons from it
|
||||||
* Generate icons suitable for mobile devices and web apps (see /static/src/img/
|
- Generate icons suitable for mobile devices and web apps (see
|
||||||
folder inside the module for a sample of the possible current formats.
|
/static/src/img/ folder inside the module for a sample of the
|
||||||
* Put the icon definition at system level, not at company level. It doesn't
|
possible current formats.
|
||||||
make sense (as the icon is cached) to have a different icon per company.
|
- 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
|
Bug Tracker
|
||||||
===========
|
===========
|
||||||
|
@ -79,7 +81,7 @@ Bug Tracker
|
||||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
|
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.
|
In case of trouble, please check there if your issue has already been reported.
|
||||||
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
If you spotted it first, help us to smash 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**>`_.
|
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_favicon%0Aversion:%2017.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.
|
Do not contact contributors directly about support or help with technical issues.
|
||||||
|
|
||||||
|
@ -87,13 +89,13 @@ Credits
|
||||||
=======
|
=======
|
||||||
|
|
||||||
Authors
|
Authors
|
||||||
~~~~~~~
|
-------
|
||||||
|
|
||||||
* Therp BV
|
* Therp BV
|
||||||
* Tecnativa
|
* Tecnativa
|
||||||
|
|
||||||
Maintainers
|
Maintainers
|
||||||
~~~~~~~~~~~
|
-----------
|
||||||
|
|
||||||
This module is maintained by the OCA.
|
This module is maintained by the OCA.
|
||||||
|
|
||||||
|
@ -105,6 +107,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.
|
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.
|
This module is part of the `OCA/web <https://github.com/OCA/web/tree/17.0/web_favicon>`_ project on GitHub.
|
||||||
|
|
||||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||||
|
|
|
@ -5,9 +5,7 @@
|
||||||
{
|
{
|
||||||
"name": "Custom shortcut icon",
|
"name": "Custom shortcut icon",
|
||||||
"version": "12.0.1.0.0",
|
"version": "12.0.1.0.0",
|
||||||
"author": "Therp BV, "
|
"author": "Therp BV, " "Tecnativa, " "Odoo Community Association (OCA)",
|
||||||
"Tecnativa, "
|
|
||||||
"Odoo Community Association (OCA)",
|
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"category": "Website",
|
"category": "Website",
|
||||||
"summary": "Allows to set a custom shortcut icon (aka favicon)",
|
"summary": "Allows to set a custom shortcut icon (aka favicon)",
|
||||||
|
|
|
@ -2,28 +2,29 @@
|
||||||
# Copyright 2017 QubiQ 2010 <http://www.qubiq.es>
|
# Copyright 2017 QubiQ 2010 <http://www.qubiq.es>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from io import BytesIO
|
|
||||||
import base64
|
import base64
|
||||||
|
from io import BytesIO
|
||||||
|
|
||||||
from odoo import http
|
from odoo import http
|
||||||
from odoo.tools.misc import file_open
|
from odoo.tools.misc import file_open
|
||||||
|
|
||||||
|
|
||||||
class WebFavicon(http.Controller):
|
class WebFavicon(http.Controller):
|
||||||
|
@http.route("/web_favicon/favicon", type="http", auth="none")
|
||||||
@http.route('/web_favicon/favicon', type='http', auth="none")
|
|
||||||
def icon(self):
|
def icon(self):
|
||||||
request = http.request
|
request = http.request
|
||||||
if 'uid' in request.env.context:
|
if "uid" in request.env.context:
|
||||||
user = request.env['res.users'].browse(request.env.context['uid'])
|
user = request.env["res.users"].browse(request.env.context["uid"])
|
||||||
company = user.sudo(user.id).company_id
|
company = user.sudo(user.id).company_id
|
||||||
else:
|
else:
|
||||||
company = request.env['res.company'].search([], limit=1)
|
company = request.env["res.company"].search([], limit=1)
|
||||||
favicon = company.favicon_backend
|
favicon = company.favicon_backend
|
||||||
favicon_mimetype = company.favicon_backend_mimetype
|
favicon_mimetype = company.favicon_backend_mimetype
|
||||||
if not favicon:
|
if not favicon:
|
||||||
favicon = file_open('web/static/src/img/favicon.ico', 'rb')
|
favicon = file_open("web/static/src/img/favicon.ico", "rb")
|
||||||
favicon_mimetype = 'image/x-icon'
|
favicon_mimetype = "image/x-icon"
|
||||||
else:
|
else:
|
||||||
favicon = BytesIO(base64.b64decode(favicon))
|
favicon = BytesIO(base64.b64decode(favicon))
|
||||||
return request.make_response(
|
return request.make_response(
|
||||||
favicon.read(), [('Content-Type', favicon_mimetype)])
|
favicon.read(), [("Content-Type", favicon_mimetype)]
|
||||||
|
)
|
||||||
|
|
|
@ -2,15 +2,18 @@
|
||||||
# Copyright 2016 Pedro M. Baeza
|
# Copyright 2016 Pedro M. Baeza
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import models, fields
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
class ResCompany(models.Model):
|
class ResCompany(models.Model):
|
||||||
_inherit = 'res.company'
|
_inherit = "res.company"
|
||||||
|
|
||||||
favicon_backend = fields.Binary()
|
favicon_backend = fields.Binary()
|
||||||
favicon_backend_mimetype = fields.Selection(
|
favicon_backend_mimetype = fields.Selection(
|
||||||
selection=[('image/x-icon', 'image/x-icon'),
|
selection=[
|
||||||
('image/gif', 'image/gif'),
|
("image/x-icon", "image/x-icon"),
|
||||||
('image/png', 'image/png')],
|
("image/gif", "image/gif"),
|
||||||
help='Set the mimetype of your file.')
|
("image/png", "image/png"),
|
||||||
|
],
|
||||||
|
help="Set the mimetype of your file.",
|
||||||
|
)
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
[build-system]
|
||||||
|
requires = ["whool"]
|
||||||
|
build-backend = "whool.buildapi"
|
|
@ -0,0 +1,16 @@
|
||||||
|
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".
|
|
@ -1,15 +0,0 @@
|
||||||
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".
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
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>
|
|
@ -1,10 +0,0 @@
|
||||||
|
|
||||||
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
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
- 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.
|
|
@ -1,6 +0,0 @@
|
||||||
* 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.
|
|
|
@ -369,11 +369,11 @@ ul.auto-toc {
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
!! source digest: sha256:4af1c92721d131728f92364370ba5145f45bac9b8e4d4396572737b9ccacd56e
|
!! source digest: sha256:4af1c92721d131728f92364370ba5145f45bac9b8e4d4396572737b9ccacd56e
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||||
<p><a class="reference external image-reference" 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 image-reference" 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 image-reference" 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 image-reference" 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 image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=12.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
<p><a class="reference external image-reference" 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 image-reference" 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 image-reference" href="https://github.com/OCA/web/tree/17.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 image-reference" href="https://translation.odoo-community.org/projects/web-17-0/web-17-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 image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||||
<p>This module was written to allow you to customize your Odoo instance’s shortcut
|
<p>This module was written to allow you to customize your Odoo instance’s
|
||||||
icon (aka favicon). This is useful for branding purposes, but also for
|
shortcut icon (aka favicon). This is useful for branding purposes, but
|
||||||
integrators who have many different Odoo instances running and need to see at a
|
also for integrators who have many different Odoo instances running and
|
||||||
glance which browser tab does what.</p>
|
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
|
<p>The icon is shown also for portal users when the website modules are not
|
||||||
installed.</p>
|
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>More info about favicon: <a class="reference external" href="https://en.wikipedia.org/wiki/Favicon">https://en.wikipedia.org/wiki/Favicon</a></p>
|
||||||
|
@ -393,27 +393,30 @@ installed.</p>
|
||||||
<div class="section" id="configuration">
|
<div class="section" id="configuration">
|
||||||
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
|
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
|
||||||
<p>Upload your favicon (16x16, 32x32, 64x64 or “as big as possible”) on the
|
<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
|
company form. The file format would be ico, gif or png with 16x16, 32x32
|
||||||
64x64 pixels and 16 colors. Highers resolutions or colors support depends on
|
or 64x64 pixels and 16 colors. Highers resolutions or colors support
|
||||||
the used browser, but most modern browsers do.</p>
|
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
|
<p>Note that most browsers cache favicons basically forever, so if you want
|
||||||
icon to show up, you’ll most probably have to delete you browser cache.
|
your icon to show up, you’ll most probably have to delete you browser
|
||||||
Some browsers can refresh the favicon, accessing the URL
|
cache. Some browsers can refresh the favicon, accessing the URL
|
||||||
<base_url>/web_favicon/favicon.</p>
|
<base_url>/web_favicon/favicon.</p>
|
||||||
<p>You have a sample SVG that can be used as template for generating your icon
|
<p>You have a sample SVG that can be used as template for generating your
|
||||||
in /static/src/img/master_original_favicon.svg. You can also search for some
|
icon in /static/src/img/master_original_favicon.svg. You can also search
|
||||||
favicon generators across the web.</p>
|
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>
|
<p>To allow a user to edit the favicon it has to be member of group
|
||||||
|
“Administration / Settings”.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="known-issues-roadmap">
|
<div class="section" id="known-issues-roadmap">
|
||||||
<h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>
|
<h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Allow to upload some big icon (preferrably SVG or the like) and generate
|
<li>Allow to upload some big icon (preferrably SVG or the like) and
|
||||||
all the icons from it</li>
|
generate all the icons from it</li>
|
||||||
<li>Generate icons suitable for mobile devices and web apps (see /static/src/img/
|
<li>Generate icons suitable for mobile devices and web apps (see
|
||||||
folder inside the module for a sample of the possible current formats.</li>
|
/static/src/img/ folder inside the module for a sample of the
|
||||||
<li>Put the icon definition at system level, not at company level. It doesn’t
|
possible current formats.</li>
|
||||||
make sense (as the icon is cached) to have a different icon per company.</li>
|
<li>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.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="bug-tracker">
|
<div class="section" id="bug-tracker">
|
||||||
|
@ -421,7 +424,7 @@ make sense (as the icon is cached) to have a different icon per company.</li>
|
||||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
|
<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.
|
In case of trouble, please check there if your issue has already been reported.
|
||||||
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
If you spotted it first, help us to smash 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>
|
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_favicon%0Aversion:%2017.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>
|
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="credits">
|
<div class="section" id="credits">
|
||||||
|
@ -440,7 +443,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
||||||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.</p>
|
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>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/17.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>
|
<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>
|
</div>
|
||||||
|
|
|
@ -2,39 +2,39 @@
|
||||||
"name": "Odoo",
|
"name": "Odoo",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "\/android-chrome-36x36.png",
|
"src": "/android-chrome-36x36.png",
|
||||||
"sizes": "36x36",
|
"sizes": "36x36",
|
||||||
"type": "image\/png",
|
"type": "image/png",
|
||||||
"density": "0.75"
|
"density": "0.75"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "\/android-chrome-48x48.png",
|
"src": "/android-chrome-48x48.png",
|
||||||
"sizes": "48x48",
|
"sizes": "48x48",
|
||||||
"type": "image\/png",
|
"type": "image/png",
|
||||||
"density": "1.0"
|
"density": "1.0"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "\/android-chrome-72x72.png",
|
"src": "/android-chrome-72x72.png",
|
||||||
"sizes": "72x72",
|
"sizes": "72x72",
|
||||||
"type": "image\/png",
|
"type": "image/png",
|
||||||
"density": "1.5"
|
"density": "1.5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "\/android-chrome-96x96.png",
|
"src": "/android-chrome-96x96.png",
|
||||||
"sizes": "96x96",
|
"sizes": "96x96",
|
||||||
"type": "image\/png",
|
"type": "image/png",
|
||||||
"density": "2.0"
|
"density": "2.0"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "\/android-chrome-144x144.png",
|
"src": "/android-chrome-144x144.png",
|
||||||
"sizes": "144x144",
|
"sizes": "144x144",
|
||||||
"type": "image\/png",
|
"type": "image/png",
|
||||||
"density": "3.0"
|
"density": "3.0"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "\/android-chrome-192x192.png",
|
"src": "/android-chrome-192x192.png",
|
||||||
"sizes": "192x192",
|
"sizes": "192x192",
|
||||||
"type": "image\/png",
|
"type": "image/png",
|
||||||
"density": "4.0"
|
"density": "4.0"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,20 +1,80 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
<html lang="en-US">
|
<html lang="en-US">
|
||||||
<head profile="http://www.w3.org/2005/10/profile">
|
<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
|
||||||
<link rel="apple-touch-icon" sizes="57x57" href="/website_favicon/static/src/img/apple-touch-icon-57x57.png"/>
|
rel="shortcut icon"
|
||||||
<link rel="apple-touch-icon" sizes="60x60" href="/website_favicon/static/src/img/apple-touch-icon-60x60.png"/>
|
href="/website_favicon/static/src/img/favicon.ico"
|
||||||
<link rel="apple-touch-icon" sizes="72x72" href="/website_favicon/static/src/img/apple-touch-icon-72x72.png"/>
|
type="image/x-icon"
|
||||||
<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
|
||||||
<link rel="apple-touch-icon" sizes="120x120" href="/website_favicon/static/src/img/apple-touch-icon-120x120.png"/>
|
rel="apple-touch-icon"
|
||||||
<link rel="apple-touch-icon" sizes="144x144" href="/website_favicon/static/src/img/apple-touch-icon-144x144.png"/>
|
sizes="57x57"
|
||||||
<link rel="apple-touch-icon" sizes="152x152" href="/website_favicon/static/src/img/apple-touch-icon-152x152.png"/>
|
href="/website_favicon/static/src/img/apple-touch-icon-57x57.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
|
||||||
<link rel="icon" type="image/png" href="/website_favicon/static/src/img/android-chrome-192x192.png" sizes="192x192"/>
|
rel="apple-touch-icon"
|
||||||
<link rel="icon" type="image/png" href="/website_favicon/static/src/img/favicon-96x96.png" sizes="96x96"/>
|
sizes="60x60"
|
||||||
<link rel="icon" type="image/png" href="/website_favicon/static/src/img/favicon-16x16.png" sizes="16x16"/>
|
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" />
|
<link rel="manifest" href="/manifest.json" />
|
||||||
<meta name="msapplication-TileColor" content="#da532c" />
|
<meta name="msapplication-TileColor" content="#da532c" />
|
||||||
<meta name="msapplication-TileImage" content="/mstile-144x144.png" />
|
<meta name="msapplication-TileImage" content="/mstile-144x144.png" />
|
||||||
|
|
|
@ -2,12 +2,13 @@
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
|
from odoo import http
|
||||||
from odoo.tests.common import TransactionCase
|
from odoo.tests.common import TransactionCase
|
||||||
from odoo.tools.misc import file_open
|
from odoo.tools.misc import file_open
|
||||||
from odoo import http
|
|
||||||
|
|
||||||
|
|
||||||
class FakeRequest(object):
|
class FakeRequest:
|
||||||
def __init__(self, env):
|
def __init__(self, env):
|
||||||
self.env = env
|
self.env = env
|
||||||
|
|
||||||
|
@ -15,7 +16,7 @@ class FakeRequest(object):
|
||||||
return FakeResponse(data, headers)
|
return FakeResponse(data, headers)
|
||||||
|
|
||||||
|
|
||||||
class FakeResponse(object):
|
class FakeResponse:
|
||||||
def __init__(self, data, headers):
|
def __init__(self, data, headers):
|
||||||
self.data = data
|
self.data = data
|
||||||
self.headers = dict(headers)
|
self.headers = dict(headers)
|
||||||
|
@ -26,21 +27,26 @@ class TestWebFavicon(TransactionCase):
|
||||||
original_request = http.request
|
original_request = http.request
|
||||||
http.request = FakeRequest(self.env)
|
http.request = FakeRequest(self.env)
|
||||||
from ..controllers.web_favicon import WebFavicon
|
from ..controllers.web_favicon import WebFavicon
|
||||||
company = self.env['res.company'].search([], limit=1)
|
|
||||||
|
company = self.env["res.company"].search([], limit=1)
|
||||||
# default icon
|
# default icon
|
||||||
company.write({
|
company.write(
|
||||||
'favicon_backend': False,
|
{
|
||||||
'favicon_backend_mimetype': False,
|
"favicon_backend": False,
|
||||||
})
|
"favicon_backend_mimetype": False,
|
||||||
|
}
|
||||||
|
)
|
||||||
data = WebFavicon().icon()
|
data = WebFavicon().icon()
|
||||||
self.assertEqual(data.headers['Content-Type'], 'image/x-icon')
|
self.assertEqual(data.headers["Content-Type"], "image/x-icon")
|
||||||
# our own icon
|
# our own icon
|
||||||
company.write({
|
company.write(
|
||||||
'favicon_backend': base64.b64encode(file_open(
|
{
|
||||||
'web_favicon/static/description/icon.png', 'rb').read()),
|
"favicon_backend": base64.b64encode(
|
||||||
'favicon_backend_mimetype': 'image/png',
|
file_open("web_favicon/static/description/icon.png", "rb").read()
|
||||||
})
|
),
|
||||||
|
"favicon_backend_mimetype": "image/png",
|
||||||
|
}
|
||||||
|
)
|
||||||
data = WebFavicon().icon()
|
data = WebFavicon().icon()
|
||||||
self.assertEqual(data.headers['Content-Type'],
|
self.assertEqual(data.headers["Content-Type"], company.favicon_backend_mimetype)
|
||||||
company.favicon_backend_mimetype)
|
|
||||||
http.request = original_request
|
http.request = original_request
|
||||||
|
|
|
@ -8,7 +8,10 @@
|
||||||
<page string="Web Favicon" name="favicon" groups="base.group_system">
|
<page string="Web Favicon" name="favicon" groups="base.group_system">
|
||||||
<group string="Favicon" name="favicon">
|
<group string="Favicon" name="favicon">
|
||||||
<field name="favicon_backend" widget="image" />
|
<field name="favicon_backend" widget="image" />
|
||||||
<field name="favicon_backend_mimetype" attrs="{'required': [('favicon_backend', '!=', False)]}" />
|
<field
|
||||||
|
name="favicon_backend_mimetype"
|
||||||
|
attrs="{'required': [('favicon_backend', '!=', False)]}"
|
||||||
|
/>
|
||||||
</group>
|
</group>
|
||||||
</page>
|
</page>
|
||||||
</notebook>
|
</notebook>
|
||||||
|
|
Loading…
Reference in New Issue