diff --git a/pos_require_product_quantity/README.rst b/pos_require_product_quantity/README.rst new file mode 100644 index 0000000000..c7731eceda --- /dev/null +++ b/pos_require_product_quantity/README.rst @@ -0,0 +1,96 @@ +=============================== +Require Product Quantity in POS +=============================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:bcd7e5bc214d8bc45951305e61c4de51f6069a3f08f07f52c58a36b481c10659 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fpos-lightgray.png?logo=github + :target: https://github.com/OCA/pos/tree/18.0/pos_require_product_quantity + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-18-0/pos-18-0-pos_require_product_quantity + :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/pos&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module forbids adding empty order lines on POS orders. + +When clicking on the "Payment" button in the Point of Sale, a popup is +shown if product quantity for one or more order lines is set to 0. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To enable the feature, go to **Point of Sale** → **Configuration** → +**Settings**, select your POS, and enable **Require Product Quantity** +under the *Product Prices* section. + +Once enabled, if a cashier clicks the **Payment** button while one or +more order lines have a quantity of 0, an alert dialog is shown listing +the affected products. The payment screen will not open until all +quantities are set to a non-zero value. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Coop IT Easy SCRLfs + +Contributors +------------ + +- Robin Keunen +- Iván Todorovich +- Foram Shah +- `Trobz `__: + + - Phan Hong Phuc + +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/pos `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pos_require_product_quantity/__init__.py b/pos_require_product_quantity/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/pos_require_product_quantity/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/pos_require_product_quantity/__manifest__.py b/pos_require_product_quantity/__manifest__.py new file mode 100644 index 0000000000..b7a245c8b7 --- /dev/null +++ b/pos_require_product_quantity/__manifest__.py @@ -0,0 +1,27 @@ +# Copyright 2019-2020 Coop IT Easy SCRLfs +# Robin Keunen +# Simon Hick +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Require Product Quantity in POS", + "version": "18.0.1.0.0", + "author": "Coop IT Easy SCRLfs, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/pos", + "license": "AGPL-3", + "category": "Point of Sale", + "summary": """ + A popup is shown if product quantity is set to 0 for one or more order + lines when clicking on "Payment" button. + """, + "depends": [ + "point_of_sale", + ], + "data": [ + "views/res_config_settings_views.xml", + ], + "assets": { + "point_of_sale._assets_pos": [ + "pos_require_product_quantity/static/src/overrides/pos_store.esm.js", + ] + }, +} diff --git a/pos_require_product_quantity/i18n/es.po b/pos_require_product_quantity/i18n/es.po new file mode 100644 index 0000000000..e187b0ec59 --- /dev/null +++ b/pos_require_product_quantity/i18n/es.po @@ -0,0 +1,65 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_require_product_quantity +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2026-04-13 08:45+0000\n" +"Last-Translator: ferdymercury \n" +"Language-Team: none\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" +"X-Generator: Weblate 5.15.2\n" + +#. module: pos_require_product_quantity +#: model:ir.model.fields,field_description:pos_require_product_quantity.field_pos_config__display_name +msgid "Display Name" +msgstr "Nombre mostrado" + +#. module: pos_require_product_quantity +#: model:ir.model.fields,field_description:pos_require_product_quantity.field_pos_config__id +msgid "ID" +msgstr "ID" + +#. module: pos_require_product_quantity +#: model:ir.model.fields,field_description:pos_require_product_quantity.field_pos_config____last_update +msgid "Last Modified on" +msgstr "Última modificación a" + +#. module: pos_require_product_quantity +#. openerp-web +#: code:addons/pos_require_product_quantity/static/src/js/screens.js:0 +#, python-format +msgid "Missing quantities" +msgstr "Cantidades faltantes" + +#. module: pos_require_product_quantity +#. openerp-web +#: code:addons/pos_require_product_quantity/static/src/js/screens.js:0 +#, python-format +msgid "No quantity set for products:" +msgstr "No hay cantidad establecida para productos:" + +#. module: pos_require_product_quantity +#: model:ir.model,name:pos_require_product_quantity.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Configuración del punto de venta" + +#. module: pos_require_product_quantity +#: model:ir.model.fields,field_description:pos_require_product_quantity.field_pos_config__require_product_quantity +msgid "Require product quantity in POS" +msgstr "Requerir cantidad de producto en PdV" + +#. module: pos_require_product_quantity +#: model_terms:ir.ui.view,arch_db:pos_require_product_quantity.pos_config_view_form +msgid "" +"Show pop-up when product quantity is set to 0 for one or more order lines " +"when clicking on \"Payment\" button." +msgstr "" +"Mostrar ventana emergente cuando la cantidad del producto se establece en 0 " +"para una o más líneas de pedido al hacer clic en el botón \"Pago\"." diff --git a/pos_require_product_quantity/i18n/fr.po b/pos_require_product_quantity/i18n/fr.po new file mode 100644 index 0000000000..ff7d60d1a4 --- /dev/null +++ b/pos_require_product_quantity/i18n/fr.po @@ -0,0 +1,54 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_require_product_quantity +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-07-02 04:17+0000\n" +"PO-Revision-Date: 2026-07-02 04:17+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: pos_require_product_quantity +#: model:ir.model,name:pos_require_product_quantity.model_res_config_settings +msgid "Config Settings" +msgstr "Paramètres de configuration" + +#. module: pos_require_product_quantity +#. odoo-javascript +#: code:addons/pos_require_product_quantity/static/src/overrides/pos_store.esm.js:0 +msgid "Missing quantities" +msgstr "Attention quantités manquantes" + +#. module: pos_require_product_quantity +#. odoo-javascript +#: code:addons/pos_require_product_quantity/static/src/overrides/pos_store.esm.js:0 +msgid "No quantity set for products:" +msgstr "Corriger quantité à 0 pour les produits suivants:" + +#. module: pos_require_product_quantity +#: model:ir.model,name:pos_require_product_quantity.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Configuration du point de vente" + +#. module: pos_require_product_quantity +#: model_terms:ir.ui.view,arch_db:pos_require_product_quantity.res_config_settings_view_form +msgid "Require Product Quantity" +msgstr "Exiger la quantité de produit" + +#. module: pos_require_product_quantity +#: model:ir.model.fields,field_description:pos_require_product_quantity.field_pos_config__require_product_quantity +#: model:ir.model.fields,field_description:pos_require_product_quantity.field_res_config_settings__pos_require_product_quantity +msgid "Require product quantity in POS" +msgstr "Exiger la quantité de produit en PDV" + +#. module: pos_require_product_quantity +#: model_terms:ir.ui.view,arch_db:pos_require_product_quantity.res_config_settings_view_form +msgid "The products added to the order must have a quantity of more than 0" +msgstr "Les produits ajoutés à la commande doivent avoir une quantité supérieure à 0" diff --git a/pos_require_product_quantity/i18n/it.po b/pos_require_product_quantity/i18n/it.po new file mode 100644 index 0000000000..35311dd3c7 --- /dev/null +++ b/pos_require_product_quantity/i18n/it.po @@ -0,0 +1,65 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_require_product_quantity +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-03-09 22:22+0000\n" +"Last-Translator: mymage \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 4.14.1\n" + +#. module: pos_require_product_quantity +#: model:ir.model.fields,field_description:pos_require_product_quantity.field_pos_config__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: pos_require_product_quantity +#: model:ir.model.fields,field_description:pos_require_product_quantity.field_pos_config__id +msgid "ID" +msgstr "ID" + +#. module: pos_require_product_quantity +#: model:ir.model.fields,field_description:pos_require_product_quantity.field_pos_config____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: pos_require_product_quantity +#. openerp-web +#: code:addons/pos_require_product_quantity/static/src/js/screens.js:0 +#, python-format +msgid "Missing quantities" +msgstr "Quantità mancanti" + +#. module: pos_require_product_quantity +#. openerp-web +#: code:addons/pos_require_product_quantity/static/src/js/screens.js:0 +#, python-format +msgid "No quantity set for products:" +msgstr "Quantità non impostata per prodotti:" + +#. module: pos_require_product_quantity +#: model:ir.model,name:pos_require_product_quantity.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Configurazione punto vendita" + +#. module: pos_require_product_quantity +#: model:ir.model.fields,field_description:pos_require_product_quantity.field_pos_config__require_product_quantity +msgid "Require product quantity in POS" +msgstr "Richiede quantità prodotto nel POS" + +#. module: pos_require_product_quantity +#: model_terms:ir.ui.view,arch_db:pos_require_product_quantity.pos_config_view_form +msgid "" +"Show pop-up when product quantity is set to 0 for one or more order lines " +"when clicking on \"Payment\" button." +msgstr "" +"Visualizza pop-up quando la quantità prodotto è impostata a 0per uno o più " +"righe ordine quando si clicca il pulsante \"Pagamento\"." diff --git a/pos_require_product_quantity/i18n/pos_require_product_quantity.pot b/pos_require_product_quantity/i18n/pos_require_product_quantity.pot new file mode 100644 index 0000000000..45d82660de --- /dev/null +++ b/pos_require_product_quantity/i18n/pos_require_product_quantity.pot @@ -0,0 +1,54 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_require_product_quantity +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-07-02 04:17+0000\n" +"PO-Revision-Date: 2026-07-02 04:17+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: pos_require_product_quantity +#: model:ir.model,name:pos_require_product_quantity.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: pos_require_product_quantity +#. odoo-javascript +#: code:addons/pos_require_product_quantity/static/src/overrides/pos_store.esm.js:0 +msgid "Missing quantities" +msgstr "" + +#. module: pos_require_product_quantity +#. odoo-javascript +#: code:addons/pos_require_product_quantity/static/src/overrides/pos_store.esm.js:0 +msgid "No quantity set for products:" +msgstr "" + +#. module: pos_require_product_quantity +#: model:ir.model,name:pos_require_product_quantity.model_pos_config +msgid "Point of Sale Configuration" +msgstr "" + +#. module: pos_require_product_quantity +#: model_terms:ir.ui.view,arch_db:pos_require_product_quantity.res_config_settings_view_form +msgid "Require Product Quantity" +msgstr "" + +#. module: pos_require_product_quantity +#: model:ir.model.fields,field_description:pos_require_product_quantity.field_pos_config__require_product_quantity +#: model:ir.model.fields,field_description:pos_require_product_quantity.field_res_config_settings__pos_require_product_quantity +msgid "Require product quantity in POS" +msgstr "" + +#. module: pos_require_product_quantity +#: model_terms:ir.ui.view,arch_db:pos_require_product_quantity.res_config_settings_view_form +msgid "The products added to the order must have a quantity of more than 0" +msgstr "" diff --git a/pos_require_product_quantity/i18n/pt.po b/pos_require_product_quantity/i18n/pt.po new file mode 100644 index 0000000000..1a80372569 --- /dev/null +++ b/pos_require_product_quantity/i18n/pt.po @@ -0,0 +1,65 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_require_product_quantity +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-02-01 12:33+0000\n" +"Last-Translator: Pedro Castro Silva \n" +"Language-Team: none\n" +"Language: pt\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 4.3.2\n" + +#. module: pos_require_product_quantity +#: model:ir.model.fields,field_description:pos_require_product_quantity.field_pos_config__display_name +msgid "Display Name" +msgstr "Nome a Exibir" + +#. module: pos_require_product_quantity +#: model:ir.model.fields,field_description:pos_require_product_quantity.field_pos_config__id +msgid "ID" +msgstr "ID" + +#. module: pos_require_product_quantity +#: model:ir.model.fields,field_description:pos_require_product_quantity.field_pos_config____last_update +msgid "Last Modified on" +msgstr "Última Modificação em" + +#. module: pos_require_product_quantity +#. openerp-web +#: code:addons/pos_require_product_quantity/static/src/js/screens.js:0 +#, python-format +msgid "Missing quantities" +msgstr "Quantidades em falta" + +#. module: pos_require_product_quantity +#. openerp-web +#: code:addons/pos_require_product_quantity/static/src/js/screens.js:0 +#, python-format +msgid "No quantity set for products:" +msgstr "Não foi definida quantidade para os produtos:" + +#. module: pos_require_product_quantity +#: model:ir.model,name:pos_require_product_quantity.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Configuração do Ponto de Venda" + +#. module: pos_require_product_quantity +#: model:ir.model.fields,field_description:pos_require_product_quantity.field_pos_config__require_product_quantity +msgid "Require product quantity in POS" +msgstr "Requerer quantidade no POS" + +#. module: pos_require_product_quantity +#: model_terms:ir.ui.view,arch_db:pos_require_product_quantity.pos_config_view_form +msgid "" +"Show pop-up when product quantity is set to 0 for one or more order lines " +"when clicking on \"Payment\" button." +msgstr "" +"Exibir pop-up quando a quantidade do produto for 0 em pelo menos uma linha " +"ao clicar no botão \"Pagamento\"." diff --git a/pos_require_product_quantity/models/__init__.py b/pos_require_product_quantity/models/__init__.py new file mode 100644 index 0000000000..2b92809a3b --- /dev/null +++ b/pos_require_product_quantity/models/__init__.py @@ -0,0 +1,2 @@ +from . import pos_config +from . import res_config_settings diff --git a/pos_require_product_quantity/models/pos_config.py b/pos_require_product_quantity/models/pos_config.py new file mode 100644 index 0000000000..647c0758d0 --- /dev/null +++ b/pos_require_product_quantity/models/pos_config.py @@ -0,0 +1,14 @@ +# SPDX-FileCopyrightText: 2025 Coop IT Easy SC +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +from odoo import fields, models + + +class PosConfig(models.Model): + _inherit = "pos.config" + + require_product_quantity = fields.Boolean( + string="Require product quantity in POS", + default=True, + ) diff --git a/pos_require_product_quantity/models/res_config_settings.py b/pos_require_product_quantity/models/res_config_settings.py new file mode 100644 index 0000000000..5d1a27d769 --- /dev/null +++ b/pos_require_product_quantity/models/res_config_settings.py @@ -0,0 +1,13 @@ +# Copyright 2025 CoopITEasy - Simon Hick +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + pos_require_product_quantity = fields.Boolean( + related="pos_config_id.require_product_quantity", + readonly=False, + ) diff --git a/pos_require_product_quantity/pyproject.toml b/pos_require_product_quantity/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/pos_require_product_quantity/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/pos_require_product_quantity/readme/CONTRIBUTORS.md b/pos_require_product_quantity/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..def9f33d63 --- /dev/null +++ b/pos_require_product_quantity/readme/CONTRIBUTORS.md @@ -0,0 +1,5 @@ +- Robin Keunen \ +- Iván Todorovich \ +- Foram Shah \ +- [Trobz](https://www.trobz.com): + - Phan Hong Phuc \ diff --git a/pos_require_product_quantity/readme/DESCRIPTION.md b/pos_require_product_quantity/readme/DESCRIPTION.md new file mode 100644 index 0000000000..8da29f4ccb --- /dev/null +++ b/pos_require_product_quantity/readme/DESCRIPTION.md @@ -0,0 +1,4 @@ +This module forbids adding empty order lines on POS orders. + +When clicking on the "Payment" button in the Point of Sale, a popup is +shown if product quantity for one or more order lines is set to 0. diff --git a/pos_require_product_quantity/readme/USAGE.md b/pos_require_product_quantity/readme/USAGE.md new file mode 100644 index 0000000000..2de0b326f7 --- /dev/null +++ b/pos_require_product_quantity/readme/USAGE.md @@ -0,0 +1,8 @@ +To enable the feature, go to **Point of Sale** → **Configuration** → +**Settings**, select your POS, and enable **Require Product Quantity** +under the *Product Prices* section. + +Once enabled, if a cashier clicks the **Payment** button while one or +more order lines have a quantity of 0, an alert dialog is shown listing +the affected products. The payment screen will not open until all +quantities are set to a non-zero value. diff --git a/pos_require_product_quantity/static/description/icon.png b/pos_require_product_quantity/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/pos_require_product_quantity/static/description/icon.png differ diff --git a/pos_require_product_quantity/static/description/index.html b/pos_require_product_quantity/static/description/index.html new file mode 100644 index 0000000000..ea78f76c61 --- /dev/null +++ b/pos_require_product_quantity/static/description/index.html @@ -0,0 +1,442 @@ + + + + + +Require Product Quantity in POS + + + +
+

Require Product Quantity in POS

+ + +

Beta License: AGPL-3 OCA/pos Translate me on Weblate Try me on Runboat

+

This module forbids adding empty order lines on POS orders.

+

When clicking on the “Payment” button in the Point of Sale, a popup is +shown if product quantity for one or more order lines is set to 0.

+

Table of contents

+ +
+

Usage

+

To enable the feature, go to Point of SaleConfiguration → +Settings, select your POS, and enable Require Product Quantity +under the Product Prices section.

+

Once enabled, if a cashier clicks the Payment button while one or +more order lines have a quantity of 0, an alert dialog is shown listing +the affected products. The payment screen will not open until all +quantities are set to a non-zero value.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Coop IT Easy SCRLfs
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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/pos project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/pos_require_product_quantity/static/src/overrides/pos_store.esm.js b/pos_require_product_quantity/static/src/overrides/pos_store.esm.js new file mode 100644 index 0000000000..12160b3653 --- /dev/null +++ b/pos_require_product_quantity/static/src/overrides/pos_store.esm.js @@ -0,0 +1,37 @@ +/* + Copyright 2019 Coop IT Easy SCRLfs + Robin Keunen + Simon Hick + License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +*/ + +import {ConfirmationDialog} from "@web/core/confirmation_dialog/confirmation_dialog"; +import {PosStore} from "@point_of_sale/app/store/pos_store"; +import {_t} from "@web/core/l10n/translation"; +import {patch} from "@web/core/utils/patch"; + +patch(PosStore.prototype, { + async pay() { + if (this.config.require_product_quantity) { + const linesWithoutQty = this.get_order().lines.filter( + (line) => line.qty === 0 + ); + if (linesWithoutQty.length > 0) { + await new Promise((resolve) => { + this.dialog.add(ConfirmationDialog, { + title: _t("Missing quantities"), + body: + _t("No quantity set for products:") + + "\n" + + linesWithoutQty + .map((line) => " - " + line.product_id.display_name) + .join("\n"), + confirm: resolve, + }); + }); + return; + } + } + return super.pay(...arguments); + }, +}); diff --git a/pos_require_product_quantity/views/res_config_settings_views.xml b/pos_require_product_quantity/views/res_config_settings_views.xml new file mode 100644 index 0000000000..34587ae4a6 --- /dev/null +++ b/pos_require_product_quantity/views/res_config_settings_views.xml @@ -0,0 +1,19 @@ + + + + res.config.settings.view.form + res.config.settings + + + + + + + + + +