From d15658162b270441428d838de14e80565da1d201 Mon Sep 17 00:00:00 2001 From: M Machado Date: Wed, 6 May 2026 10:20:35 +0200 Subject: [PATCH] [IMP] pos_config_logo: support custom logo in POS navbar and saver screen Extend pos_config_logo to reuse the configured POS logo beyond receipts, showing it in the navbar and saver screen, and document the new behavior. Co-authored-by: Cursor --- pos_config_logo/README.rst | 24 +- pos_config_logo/readme/CONTRIBUTORS.md | 1 + pos_config_logo/readme/DESCRIPTION.md | 10 +- pos_config_logo/readme/USAGE.md | 6 +- pos_config_logo/static/description/index.html | 924 +++++++++--------- .../static/src/js/navbar_logo.esm.js | 12 + .../static/src/js/saver_screen_logo.esm.js | 17 + .../static/src/xml/navbar_logo.xml | 18 + .../static/src/xml/saver_screen_logo.xml | 16 + 9 files changed, 558 insertions(+), 470 deletions(-) create mode 100644 pos_config_logo/static/src/js/navbar_logo.esm.js create mode 100644 pos_config_logo/static/src/js/saver_screen_logo.esm.js create mode 100644 pos_config_logo/static/src/xml/navbar_logo.xml create mode 100644 pos_config_logo/static/src/xml/saver_screen_logo.xml diff --git a/pos_config_logo/README.rst b/pos_config_logo/README.rst index 5531fb7e11..2e44ee7cc8 100644 --- a/pos_config_logo/README.rst +++ b/pos_config_logo/README.rst @@ -1,7 +1,3 @@ -.. image:: https://odoo-community.org/readme-banner-image - :target: https://odoo-community.org/get-involved?utm_source=readme - :alt: Odoo Community Association - ================== Point of sale logo ================== @@ -17,7 +13,7 @@ Point of sale logo .. |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/license-AGPL--3-blue.png +.. |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%2Fpos-lightgray.png?logo=github @@ -32,9 +28,15 @@ Point of sale logo |badge1| |badge2| |badge3| |badge4| |badge5| -This module allows to configure a point of sale logo per config to +This module allows configuring a point of sale logo per configuration to override the company one. +When set, this logo is used in: + +- Receipt header. +- POS navbar header logo. +- POS saver screen logo. + **Table of contents** .. contents:: @@ -63,8 +65,12 @@ will print the company one. Usage ===== -When the cashier prints a receipt the point of sale logo will show up in -the receipt. +When a logo is configured in the POS settings, the point of sale logo is +displayed: + +- In the printed receipt header. +- In the POS navbar. +- In the POS saver screen. Bug Tracker =========== @@ -91,6 +97,8 @@ Contributors - David Vidal +- Miguel Machado + Maintainers ----------- diff --git a/pos_config_logo/readme/CONTRIBUTORS.md b/pos_config_logo/readme/CONTRIBUTORS.md index 3a16ddf047..77f0d0c6fb 100644 --- a/pos_config_logo/readme/CONTRIBUTORS.md +++ b/pos_config_logo/readme/CONTRIBUTORS.md @@ -1,2 +1,3 @@ - [Tecnativa](https://tecnativa.com) - David Vidal +- Miguel Machado diff --git a/pos_config_logo/readme/DESCRIPTION.md b/pos_config_logo/readme/DESCRIPTION.md index 105d76631c..013c6fe565 100644 --- a/pos_config_logo/readme/DESCRIPTION.md +++ b/pos_config_logo/readme/DESCRIPTION.md @@ -1,2 +1,8 @@ -This module allows to configure a point of sale logo per config to override the company -one. +This module allows configuring a point of sale logo per configuration to override the +company one. + +When set, this logo is used in: + +- Receipt header. +- POS navbar header logo. +- POS saver screen logo. diff --git a/pos_config_logo/readme/USAGE.md b/pos_config_logo/readme/USAGE.md index f782ee1ef9..f0066d6b37 100644 --- a/pos_config_logo/readme/USAGE.md +++ b/pos_config_logo/readme/USAGE.md @@ -1 +1,5 @@ -When the cashier prints a receipt the point of sale logo will show up in the receipt. +When a logo is configured in the POS settings, the point of sale logo is displayed: + +- In the printed receipt header. +- In the POS navbar. +- In the POS saver screen. diff --git a/pos_config_logo/static/description/index.html b/pos_config_logo/static/description/index.html index 65ab712285..90ceb5124e 100644 --- a/pos_config_logo/static/description/index.html +++ b/pos_config_logo/static/description/index.html @@ -1,459 +1,465 @@ - - - - - -README.rst - - - -
- - - -Odoo Community Association - - -
- - + + + + + +Point of sale logo + + + + + + diff --git a/pos_config_logo/static/src/js/navbar_logo.esm.js b/pos_config_logo/static/src/js/navbar_logo.esm.js new file mode 100644 index 0000000000..42e00a17bf --- /dev/null +++ b/pos_config_logo/static/src/js/navbar_logo.esm.js @@ -0,0 +1,12 @@ +import {Navbar} from "@point_of_sale/app/navbar/navbar"; +import {patch} from "@web/core/utils/patch"; + +patch(Navbar.prototype, { + get posHeaderLogoSrc() { + const config = this.pos?.config; + if (!config?.logo || !config.id) { + return "/web/static/img/logo.png"; + } + return `/web/image?model=pos.config&id=${config.id}&field=logo`; + }, +}); diff --git a/pos_config_logo/static/src/js/saver_screen_logo.esm.js b/pos_config_logo/static/src/js/saver_screen_logo.esm.js new file mode 100644 index 0000000000..55b8348023 --- /dev/null +++ b/pos_config_logo/static/src/js/saver_screen_logo.esm.js @@ -0,0 +1,17 @@ +import {patch} from "@web/core/utils/patch"; +import {SaverScreen} from "@point_of_sale/app/screens/saver_screen/saver_screen"; +import {usePos} from "@point_of_sale/app/store/pos_hook"; + +patch(SaverScreen.prototype, { + setup() { + super.setup(); + this.pos = usePos(); + }, + get saverLogoSrc() { + const config = this.pos?.config; + if (!config?.logo || !config.id) { + return "/web/static/img/odoo_logo.svg"; + } + return `/web/image?model=pos.config&id=${config.id}&field=logo`; + }, +}); diff --git a/pos_config_logo/static/src/xml/navbar_logo.xml b/pos_config_logo/static/src/xml/navbar_logo.xml new file mode 100644 index 0000000000..56e3488fa8 --- /dev/null +++ b/pos_config_logo/static/src/xml/navbar_logo.xml @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/pos_config_logo/static/src/xml/saver_screen_logo.xml b/pos_config_logo/static/src/xml/saver_screen_logo.xml new file mode 100644 index 0000000000..9fc0aa8baa --- /dev/null +++ b/pos_config_logo/static/src/xml/saver_screen_logo.xml @@ -0,0 +1,16 @@ + + + + + Logo + + +