-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
19 changed files
with
1,012 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
================= | ||
Web Pwa Customize | ||
================= | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:4a63e846d259636f1c4cd9c622f602c5a66bf775ab189162f90c00b3e278c7af | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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/17.0/web_pwa_customize | ||
:alt: OCA/web | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_pwa_customize | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=17.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows to configure data for Progressive Web App: Short | ||
name, Background color, Theme color and Icon. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Use Cases / Context | ||
=================== | ||
|
||
The existing definitions in the old web_pwa_oca of 16.0 (not existing or | ||
customizable in core) are maintained. | ||
|
||
Configuration | ||
============= | ||
|
||
#. Go to Settings > General Settings. #. In the 'Progressive Web App' | ||
section you can configure all the data. | ||
|
||
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 to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_pwa_customize%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. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
------- | ||
|
||
* Tecnativa | ||
|
||
Contributors | ||
------------ | ||
|
||
- `Tecnativa <https://www.tecnativa.com>`__: | ||
|
||
- Víctor Martínez | ||
- Pedro M. Baeza | ||
|
||
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. | ||
|
||
.. |maintainer-victoralmau| image:: https://github.com/victoralmau.png?size=40px | ||
:target: https://github.com/victoralmau | ||
:alt: victoralmau | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-victoralmau| | ||
|
||
This module is part of the `OCA/web <https://github.com/OCA/web/tree/17.0/web_pwa_customize>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import controllers | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2024 Tecnativa - Víctor Martínez | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Web Pwa Customize", | ||
"author": "Tecnativa, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/web", | ||
"version": "17.0.1.0.0", | ||
"depends": ["web"], | ||
"license": "AGPL-3", | ||
"category": "Website", | ||
"installable": True, | ||
"maintainers": ["victoralmau"], | ||
"data": ["views/res_config_settings_views.xml"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import webmanifest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Copyright 2024 Tecnativa - Víctor Martínez | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
import json | ||
|
||
from odoo import http | ||
from odoo.http import request | ||
from odoo.tools import ustr | ||
|
||
from odoo.addons.web.controllers import webmanifest | ||
|
||
|
||
class WebManifest(webmanifest.WebManifest): | ||
def _get_pwa_manifest_icons(self, pwa_icon): | ||
icons = [] | ||
if not pwa_icon.mimetype.startswith("image/svg"): | ||
all_icons = ( | ||
request.env["ir.attachment"] | ||
.sudo() | ||
.search( | ||
[ | ||
("url", "like", "/web_pwa_customize/icon"), | ||
( | ||
"url", | ||
"not like", | ||
"/web_pwa_customize/icon.", | ||
), # Get only resized icons | ||
] | ||
) | ||
) | ||
for icon in all_icons: | ||
icon_size_name = icon.url.split("/")[-1].lstrip("icon").split(".")[0] | ||
icons.append( | ||
{"src": icon.url, "sizes": icon_size_name, "type": icon.mimetype} | ||
) | ||
else: | ||
icons = [ | ||
{ | ||
"src": pwa_icon.url, | ||
"sizes": "128x128 144x144 152x152 192x192 256x256 512x512", | ||
"type": pwa_icon.mimetype, | ||
} | ||
] | ||
return icons | ||
|
||
@http.route( | ||
"/web/manifest.webmanifest", type="http", auth="public", methods=["GET"] | ||
) | ||
def webmanifest(self): | ||
"""Call super and overwrite the values that we want.""" | ||
res = super().webmanifest() | ||
manifest = json.loads(res.response[0]) | ||
icp = request.env["ir.config_parameter"].sudo() | ||
manifest["short_name"] = icp.get_param("pwa.manifest.short_name", "Odoo") | ||
manifest["background_color"] = icp.get_param( | ||
"pwa.manifest.background_color", "#714B67" | ||
) | ||
manifest["theme_color"] = icp.get_param("pwa.manifest.theme_color", "#714B67") | ||
pwa_icon = ( | ||
request.env["ir.attachment"] | ||
.sudo() | ||
.search([("url", "like", "/web_pwa_customize/icon.")]) | ||
) | ||
if pwa_icon: | ||
manifest["icons"] = self._get_pwa_manifest_icons(pwa_icon) | ||
body = json.dumps(manifest, default=ustr) | ||
return request.make_response( | ||
body, | ||
[ | ||
("Content-Type", "application/manifest+json"), | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * web_pwa_customize | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 17.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-11-08 16:57+0000\n" | ||
"PO-Revision-Date: 2024-11-08 16:57+0000\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_pwa_customize | ||
#: model_terms:ir.ui.view,arch_db:web_pwa_customize.res_config_settings_view_form | ||
msgid "<span class=\"d-block w-75 py-2\">Background Color</span>" | ||
msgstr "<span class=\"d-block w-75 py-2\">Color de fondo</span>" | ||
|
||
#. module: web_pwa_customize | ||
#: model_terms:ir.ui.view,arch_db:web_pwa_customize.res_config_settings_view_form | ||
msgid "<span class=\"d-block w-75 py-2\">Theme Color</span>" | ||
msgstr "<span class=\"d-block w-75 py-2\">Color del tema</span>" | ||
|
||
#. module: web_pwa_customize | ||
#: model:ir.model.fields,field_description:web_pwa_customize.field_res_config_settings__pwa_background_color | ||
msgid "Background Color" | ||
msgstr "Color de fondo" | ||
|
||
#. module: web_pwa_customize | ||
#: model_terms:ir.ui.view,arch_db:web_pwa_customize.res_config_settings_view_form | ||
msgid "Colors" | ||
msgstr "Colores" | ||
|
||
#. module: web_pwa_customize | ||
#: model:ir.model,name:web_pwa_customize.model_res_config_settings | ||
msgid "Config Settings" | ||
msgstr "Ajustes de configuración" | ||
|
||
#. module: web_pwa_customize | ||
#: model:ir.model.fields,field_description:web_pwa_customize.field_res_config_settings__pwa_icon | ||
#: model_terms:ir.ui.view,arch_db:web_pwa_customize.res_config_settings_view_form | ||
msgid "Icon" | ||
msgstr "Icono" | ||
|
||
#. module: web_pwa_customize | ||
#: model_terms:ir.ui.view,arch_db:web_pwa_customize.res_config_settings_view_form | ||
msgid "Odoo" | ||
msgstr "Odoo" | ||
|
||
#. module: web_pwa_customize | ||
#: model:ir.model.fields,field_description:web_pwa_customize.field_res_config_settings__pwa_theme_color | ||
msgid "Theme Color" | ||
msgstr "Color del tema" | ||
|
||
#. module: web_pwa_customize | ||
#: model:ir.model.fields,field_description:web_pwa_customize.field_res_config_settings__pwa_short_name | ||
msgid "Web App Short Name" | ||
msgstr "Nombre corto de la aplicación" | ||
|
||
#. module: web_pwa_customize | ||
#. odoo-python | ||
#: code:addons/web_pwa_customize/models/res_config_settings.py:0 | ||
#, python-format | ||
msgid "You can only upload PNG files bigger than 512x512" | ||
msgstr "Solo puede cargar archivos PNG de más de 512 x 512" | ||
|
||
#. module: web_pwa_customize | ||
#. odoo-python | ||
#: code:addons/web_pwa_customize/models/res_config_settings.py:0 | ||
#, python-format | ||
msgid "You can only upload SVG or PNG files. Found: %s." | ||
msgstr "Solo puedes cargar archivos SVG o PNG. Encontrado: %s." | ||
|
||
#. module: web_pwa_customize | ||
#. odoo-python | ||
#: code:addons/web_pwa_customize/models/res_config_settings.py:0 | ||
#, python-format | ||
msgid "You can't upload a file with more than 2 MB." | ||
msgstr "No puede cargar un archivo con más de 2 MB." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * web_pwa_customize | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 17.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-11-08 16:56+0000\n" | ||
"PO-Revision-Date: 2024-11-08 16:56+0000\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_pwa_customize | ||
#: model_terms:ir.ui.view,arch_db:web_pwa_customize.res_config_settings_view_form | ||
msgid "<span class=\"d-block w-75 py-2\">Background Color</span>" | ||
msgstr "" | ||
|
||
#. module: web_pwa_customize | ||
#: model_terms:ir.ui.view,arch_db:web_pwa_customize.res_config_settings_view_form | ||
msgid "<span class=\"d-block w-75 py-2\">Theme Color</span>" | ||
msgstr "" | ||
|
||
#. module: web_pwa_customize | ||
#: model:ir.model.fields,field_description:web_pwa_customize.field_res_config_settings__pwa_background_color | ||
msgid "Background Color" | ||
msgstr "" | ||
|
||
#. module: web_pwa_customize | ||
#: model_terms:ir.ui.view,arch_db:web_pwa_customize.res_config_settings_view_form | ||
msgid "Colors" | ||
msgstr "" | ||
|
||
#. module: web_pwa_customize | ||
#: model:ir.model,name:web_pwa_customize.model_res_config_settings | ||
msgid "Config Settings" | ||
msgstr "" | ||
|
||
#. module: web_pwa_customize | ||
#: model:ir.model.fields,field_description:web_pwa_customize.field_res_config_settings__pwa_icon | ||
#: model_terms:ir.ui.view,arch_db:web_pwa_customize.res_config_settings_view_form | ||
msgid "Icon" | ||
msgstr "" | ||
|
||
#. module: web_pwa_customize | ||
#: model_terms:ir.ui.view,arch_db:web_pwa_customize.res_config_settings_view_form | ||
msgid "Odoo" | ||
msgstr "" | ||
|
||
#. module: web_pwa_customize | ||
#: model:ir.model.fields,field_description:web_pwa_customize.field_res_config_settings__pwa_theme_color | ||
msgid "Theme Color" | ||
msgstr "" | ||
|
||
#. module: web_pwa_customize | ||
#: model:ir.model.fields,field_description:web_pwa_customize.field_res_config_settings__pwa_short_name | ||
msgid "Web App Short Name" | ||
msgstr "" | ||
|
||
#. module: web_pwa_customize | ||
#. odoo-python | ||
#: code:addons/web_pwa_customize/models/res_config_settings.py:0 | ||
#, python-format | ||
msgid "You can only upload PNG files bigger than 512x512" | ||
msgstr "" | ||
|
||
#. module: web_pwa_customize | ||
#. odoo-python | ||
#: code:addons/web_pwa_customize/models/res_config_settings.py:0 | ||
#, python-format | ||
msgid "You can only upload SVG or PNG files. Found: %s." | ||
msgstr "" | ||
|
||
#. module: web_pwa_customize | ||
#. odoo-python | ||
#: code:addons/web_pwa_customize/models/res_config_settings.py:0 | ||
#, python-format | ||
msgid "You can't upload a file with more than 2 MB." | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import res_config_settings |
Oops, something went wrong.