Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions web_pwa_customize/README.rst
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:8415b51de0273f7a4646b27d9dd9e8a0e3a10f92aed0e8b5636cf66800c70918
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/18.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-18-0/web-18-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=18.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:%2018.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/18.0/web_pwa_customize>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions web_pwa_customize/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import controllers
from . import models
14 changes: 14 additions & 0 deletions web_pwa_customize/__manifest__.py
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": "18.0.1.0.0",
"depends": ["web"],
"license": "AGPL-3",
"category": "Website",
"installable": True,
"maintainers": ["victoralmau"],
"data": ["views/res_config_settings_views.xml"],
}
1 change: 1 addition & 0 deletions web_pwa_customize/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import webmanifest
71 changes: 71 additions & 0 deletions web_pwa_customize/controllers/webmanifest.py
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"),
],
)
83 changes: 83 additions & 0 deletions web_pwa_customize/i18n/es.po
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."
84 changes: 84 additions & 0 deletions web_pwa_customize/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# 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"
"PO-Revision-Date: 2025-08-06 14:27+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\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 5.10.4\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\">Colore sfondo</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\">Colore 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 "Colore sfondo"

#. module: web_pwa_customize
#: model_terms:ir.ui.view,arch_db:web_pwa_customize.res_config_settings_view_form
msgid "Colors"
msgstr "Colori"

#. module: web_pwa_customize
#: model:ir.model,name:web_pwa_customize.model_res_config_settings
msgid "Config Settings"
msgstr "Impostazioni configurazione"

#. 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 "Icona"

#. 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 "Colore 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 "Nome corto applicazione web"

#. 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 "Si possono caricare solo file PNG maggiori di 512x512"

#. 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 "Si possono caricare solo file SVG o PNG. trovato %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 "Non si può caricare un file superiore a 2MB."
Loading