From 08fca37c6d8dfef43d97c0f425800661e22ab17c Mon Sep 17 00:00:00 2001 From: luis Date: Sun, 11 May 2025 18:40:33 +0200 Subject: [PATCH] LaOsaCoop/Odoo16#14 migration pos_customer_required --- pos_customer_required/README.rst | 126 +++++ pos_customer_required/__init__.py | 1 + pos_customer_required/__manifest__.py | 26 + pos_customer_required/i18n/ca.po | 103 ++++ pos_customer_required/i18n/es.po | 92 ++++ pos_customer_required/i18n/fr.po | 103 ++++ pos_customer_required/i18n/nl_NL.po | 100 ++++ .../i18n/pos_customer_required.pot | 88 ++++ pos_customer_required/models/__init__.py | 4 + pos_customer_required/models/pos_config.py | 24 + .../models/pos_make_payment.py | 29 ++ pos_customer_required/models/pos_order.py | 22 + .../models/res_config_setting.py | 11 + pos_customer_required/readme/CONFIGURE.rst | 8 + pos_customer_required/readme/CONTRIBUTORS.rst | 6 + pos_customer_required/readme/DESCRIPTION.rst | 28 ++ pos_customer_required/readme/USAGE.rst | 3 + .../frontend_pos_error_message.png | Bin 0 -> 6994 bytes .../static/description/icon.png | Bin 0 -> 4602 bytes .../static/description/index.html | 475 ++++++++++++++++++ .../static/src/js/PaymentScreen.js | 37 ++ .../static/src/js/ProductScreen.js | 38 ++ pos_customer_required/tests/__init__.py | 1 + .../tests/test_pos_customer_required.py | 49 ++ pos_customer_required/views/assets.xml | 16 + .../views/pos_config_view.xml | 27 + .../views/pos_order_view.xml | 21 + 27 files changed, 1438 insertions(+) create mode 100644 pos_customer_required/README.rst create mode 100644 pos_customer_required/__init__.py create mode 100644 pos_customer_required/__manifest__.py create mode 100644 pos_customer_required/i18n/ca.po create mode 100644 pos_customer_required/i18n/es.po create mode 100644 pos_customer_required/i18n/fr.po create mode 100644 pos_customer_required/i18n/nl_NL.po create mode 100644 pos_customer_required/i18n/pos_customer_required.pot create mode 100644 pos_customer_required/models/__init__.py create mode 100644 pos_customer_required/models/pos_config.py create mode 100644 pos_customer_required/models/pos_make_payment.py create mode 100644 pos_customer_required/models/pos_order.py create mode 100644 pos_customer_required/models/res_config_setting.py create mode 100644 pos_customer_required/readme/CONFIGURE.rst create mode 100644 pos_customer_required/readme/CONTRIBUTORS.rst create mode 100644 pos_customer_required/readme/DESCRIPTION.rst create mode 100644 pos_customer_required/readme/USAGE.rst create mode 100644 pos_customer_required/static/description/frontend_pos_error_message.png create mode 100644 pos_customer_required/static/description/icon.png create mode 100644 pos_customer_required/static/description/index.html create mode 100644 pos_customer_required/static/src/js/PaymentScreen.js create mode 100644 pos_customer_required/static/src/js/ProductScreen.js create mode 100644 pos_customer_required/tests/__init__.py create mode 100644 pos_customer_required/tests/test_pos_customer_required.py create mode 100644 pos_customer_required/views/assets.xml create mode 100644 pos_customer_required/views/pos_config_view.xml create mode 100644 pos_customer_required/views/pos_order_view.xml diff --git a/pos_customer_required/README.rst b/pos_customer_required/README.rst new file mode 100644 index 0000000..99565a0 --- /dev/null +++ b/pos_customer_required/README.rst @@ -0,0 +1,126 @@ +============================== +Point of Sale Require Customer +============================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/14.0/pos_customer_required + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-14-0/pos-14-0-pos_customer_required + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/184/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module was written to extend the functionality of odoo pos +and allows you to require a customer for each pos order. In the +pos session configuration, you can choose to require the customer for pos +orders. + +If a customer is not selected, the pos ui will display an error message. +In the backend the customer field is required when needed. + +Two new options are available: + +* Customer 'Required before starting the order'; +* Customer 'Required before paying'; + +'Required before starting the order' Option +------------------------------------------- +In the frontend PoS, the default screen is the screen to select customers. + +* Users are not allowed to start selling before having selected a customer; +* Users can not 'deselect a customer', only select an other one; + +'Required before paying' Option +------------------------------- +In the frontend PoS, the user can start selling, but if the user tries to +make payment and if a customer is not selected, the pos ui will display an +error message. + + +.. image:: https://raw.githubusercontent.com/pos_customer_required/static/description/frontend_pos_error_message.png + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To configure this module, you need to: + +* go to point of sale -> configuration -> point of sales +* select the point of sales you want configure +* search for the "Require Customer" and choose between the following values: + * 'Optional'; (this module has no effect on this PoS config) + * 'Required before paying'; + * 'Required before starting the order'; + +Usage +===== + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/184/9.0 + +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 smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Apertoso NV +* La Louve +* NuoBiT + +Contributors +~~~~~~~~~~~~ + +* Jos De Graeve +* Sylvain LE GAL +* Pedro M. Baeza ( reviews & feedback ) +* Druidoo +* Eric Antones +* Kilian Niubo + +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_customer_required/__init__.py b/pos_customer_required/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/pos_customer_required/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/pos_customer_required/__manifest__.py b/pos_customer_required/__manifest__.py new file mode 100644 index 0000000..e063ef5 --- /dev/null +++ b/pos_customer_required/__manifest__.py @@ -0,0 +1,26 @@ +# Copyright 2004 apertoso NV - Jos DE GRAEVE +# Copyright 2016 La Louve - Sylvain LE GAL +# Copyright 2019 Druidoo - (https://www.druidoo.io) +# Copyright 2022 NuoBiT - Eric Antones +# Copyright 2022 NuoBiT - Kilian Niubo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +{ + "name": "Point of Sale Require Customer", + "version": "16.0.1.0.0", + "category": "Point Of Sale", + "summary": "Point of Sale Require Customer", + "author": "Apertoso NV, La Louve, NuoBiT, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/pos", + "license": "AGPL-3", + "depends": [ + "point_of_sale", + ], + "data": [ + # "views/assets.xml", + "views/pos_config_view.xml", + "views/pos_order_view.xml", + ], + "assets": {"point_of_sale.assets": ["/pos_customer_required/static/src/js/*.js"]}, + "installable": True, +} diff --git a/pos_customer_required/i18n/ca.po b/pos_customer_required/i18n/ca.po new file mode 100644 index 0000000..d53f7fb --- /dev/null +++ b/pos_customer_required/i18n/ca.po @@ -0,0 +1,103 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_customer_required +# +# Translators: +# Marc Tormo i Bochaca , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-03-28 05:50+0000\n" +"PO-Revision-Date: 2020-02-12 19:13+0000\n" +"Last-Translator: Carles Antoli \n" +"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n" +"Language: ca\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 3.10\n" + +#. module: pos_customer_required +#. openerp-web +#: code:addons/pos_customer_required/static/src/js/PaymentScreen.js:0 +#, python-format +msgid "An anonymous order cannot be confirmed" +msgstr "Una comanda anònima no pot ser confirmada" + +#. module: pos_customer_required +#: code:addons/pos_customer_required/models/pos_make_payment.py:0 +#, python-format +msgid "" +"An anonymous order cannot be confirmed.\n" +"Please select a customer for this order." +msgstr "" +"Una comanda anònima no pot ser confirmada.\n" +"Si us plau seleccioneu un client per a aquesta comanda." + +#. module: pos_customer_required +#: code:addons/pos_customer_required/models/pos_order.py:0 +#, python-format +msgid "Customer is required for this order and is missing." +msgstr "En necessari que hi hagi un client per a aquesta comanda i no hi és." + +#. module: pos_customer_required +#: model:ir.model.fields.selection,name:pos_customer_required.selection__pos_config__require_customer__no +msgid "Optional" +msgstr "Opcional" + +#. module: pos_customer_required +#. openerp-web +#: code:addons/pos_customer_required/static/src/js/PaymentScreen.js:0 +#, python-format +msgid "Please select a customer for this order." +msgstr "Si us plau seleccioneu un client per a aquesta comanda." + +#. module: pos_customer_required +#: model:ir.model,name:pos_customer_required.model_pos_config +#, fuzzy +msgid "Point of Sale Configuration" +msgstr "Pagament del Punt de Venda " + +#. module: pos_customer_required +#: model:ir.model,name:pos_customer_required.model_pos_order +#, fuzzy +msgid "Point of Sale Orders" +msgstr "Punt de Venda " + +#. module: pos_customer_required +#: model:ir.model,name:pos_customer_required.model_pos_make_payment +msgid "Point of Sale Payment" +msgstr "Pagament del Punt de Venda" + +#. module: pos_customer_required +#: model:ir.model.fields,field_description:pos_customer_required.field_pos_config__require_customer +#: model:ir.model.fields,field_description:pos_customer_required.field_pos_order__require_customer +#: model_terms:ir.ui.view,arch_db:pos_customer_required.view_pos_config_form +msgid "Require Customer" +msgstr "Client requerit" + +#. module: pos_customer_required +#: model:ir.model.fields,help:pos_customer_required.field_pos_config__require_customer +#: model:ir.model.fields,help:pos_customer_required.field_pos_order__require_customer +msgid "" +"Require customer for orders in this point of sale:\n" +"* 'Optional' (customer is optional);\n" +"* 'Required before paying';\n" +"* 'Required before starting the order';" +msgstr "" +"Requerir client per a comandes en aquest punt de venda:\n" +"* 'Opcional' (el client és opcional);\n" +"* 'Requerit abans de pagar';\n" +"* 'Requerit abans d'entrar la comanda';" + +#. module: pos_customer_required +#: model:ir.model.fields.selection,name:pos_customer_required.selection__pos_config__require_customer__payment +msgid "Required before paying" +msgstr "Requerit abans de pagar" + +#. module: pos_customer_required +#: model:ir.model.fields.selection,name:pos_customer_required.selection__pos_config__require_customer__order +msgid "Required before starting the order" +msgstr "Requerit abans d'entrar la comanda" diff --git a/pos_customer_required/i18n/es.po b/pos_customer_required/i18n/es.po new file mode 100644 index 0000000..1506521 --- /dev/null +++ b/pos_customer_required/i18n/es.po @@ -0,0 +1,92 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_customer_required +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-02-12 19:13+0000\n" +"Last-Translator: Carles Antoli \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 3.10\n" + +#. module: pos_customer_required +#. openerp-web +#: code:addons/pos_customer_required/static/src/js/PaymentScreen.js:0 +#, python-format +msgid "An anonymous order cannot be confirmed" +msgstr "Un pedido anónimo no puede ser confirmado" + +#. module: pos_customer_required +#: code:addons/pos_customer_required/models/pos_make_payment.py:0 +#, python-format +msgid "An anonymous order cannot be confirmed.\n" +"Please select a customer for this order." +msgstr "" +"Un pedido anónimo no puede ser confirmado.\n" +"Por favor seleccione un cliente para este pedido." + +#. module: pos_customer_required +#: code:addons/pos_customer_required/models/pos_order.py:0 +#, python-format +msgid "Customer is required for this order and is missing." +msgstr "" +"En necesario que haya un cliente para este pedido y no está seleccionado." + +#. module: pos_customer_required +#: model:ir.model.fields.selection,name:pos_customer_required.selection__pos_config__require_customer__no +msgid "Optional" +msgstr "Opcional" + +#. module: pos_customer_required +#. openerp-web +#: code:addons/pos_customer_required/static/src/js/PaymentScreen.js:0 +#, python-format +msgid "Please select a customer for this order." +msgstr "Por favor seleccione un cliente para este pedido." + +#. module: pos_customer_required +#: model:ir.model,name:pos_customer_required.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Configuración del punto de venta" + +#. module: pos_customer_required +#: model:ir.model,name:pos_customer_required.model_pos_order +msgid "Point of Sale Orders" +msgstr "Pedidos del punto de venta" + +#. module: pos_customer_required +#: model:ir.model.fields,field_description:pos_customer_required.field_pos_config__require_customer +#: model:ir.model.fields,field_description:pos_customer_required.field_pos_order__require_customer +#: model_terms:ir.ui.view,arch_db:pos_customer_required.view_pos_config_form +msgid "Require Customer" +msgstr "Cliente requerido" + +#. module: pos_customer_required +#: model:ir.model.fields,help:pos_customer_required.field_pos_config__require_customer +#: model:ir.model.fields,help:pos_customer_required.field_pos_order__require_customer +msgid "Require customer for orders in this point of sale:\n" +"* 'Optional' (customer is optional);\n" +"* 'Required before paying';\n" +"* 'Required before starting the order';" +msgstr "" +"Requerir cliente para pedidos en este punto de venta:\n" +"* 'Opcional' (el cliente es opcional);\n" +"* 'Requerido antes de pagar';\n" +"* 'Requerido antes de comenzar el pedido';" + +#. module: pos_customer_required +#: model:ir.model.fields.selection,name:pos_customer_required.selection__pos_config__require_customer__payment +msgid "Required before paying" +msgstr "Requerido antes de pagar" + +#. module: pos_customer_required +#: model:ir.model.fields.selection,name:pos_customer_required.selection__pos_config__require_customer__order +msgid "Required before starting the order" +msgstr "Requerido antes de comenzar el pedido" diff --git a/pos_customer_required/i18n/fr.po b/pos_customer_required/i18n/fr.po new file mode 100644 index 0000000..180411f --- /dev/null +++ b/pos_customer_required/i18n/fr.po @@ -0,0 +1,103 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_customer_required +# +# Translators: +# OCA Transbot , 2016 +# leemannd , 2016 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-12-21 03:45+0000\n" +"PO-Revision-Date: 2016-12-21 03:45+0000\n" +"Last-Translator: leemannd , 2016\n" +"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" +"Language: fr\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" + +#. module: pos_customer_required +#. openerp-web +#: code:addons/pos_customer_required/static/src/js/PaymentScreen.js:0 +#, python-format +msgid "An anonymous order cannot be confirmed" +msgstr "Une commande anonyme ne peut pas être confirmée" + +#. module: pos_customer_required +#: code:addons/pos_customer_required/models/pos_make_payment.py:0 +#, python-format +msgid "" +"An anonymous order cannot be confirmed.\n" +"Please select a customer for this order." +msgstr "" +"Une commande anonyme ne peut pas être confirmée\n" +"Sélectionnez un client pour cette commande." + +#. module: pos_customer_required +#: code:addons/pos_customer_required/models/pos_order.py:0 +#, python-format +msgid "Customer is required for this order and is missing." +msgstr "Un client est requis et manquant." + +#. module: pos_customer_required +#: model:ir.model.fields.selection,name:pos_customer_required.selection__pos_config__require_customer__no +msgid "Optional" +msgstr "Facultatif" + +#. module: pos_customer_required +#. openerp-web +#: code:addons/pos_customer_required/static/src/js/PaymentScreen.js:0 +#, python-format +msgid "Please select a customer for this order." +msgstr "Sélectionnez un client pour cette commande." + +#. module: pos_customer_required +#: model:ir.model,name:pos_customer_required.model_pos_config +#, fuzzy +msgid "Point of Sale Configuration" +msgstr "Paiement du ticket" + +#. module: pos_customer_required +#: model:ir.model,name:pos_customer_required.model_pos_order +#, fuzzy +msgid "Point of Sale Orders" +msgstr "Point de vente" + +#. module: pos_customer_required +#: model:ir.model,name:pos_customer_required.model_pos_make_payment +msgid "Point of Sale Payment" +msgstr "Paiement du ticket" + +#. module: pos_customer_required +#: model:ir.model.fields,field_description:pos_customer_required.field_pos_config__require_customer +#: model:ir.model.fields,field_description:pos_customer_required.field_pos_order__require_customer +#: model_terms:ir.ui.view,arch_db:pos_customer_required.view_pos_config_form +msgid "Require Customer" +msgstr "Client requis" + +#. module: pos_customer_required +#: model:ir.model.fields,help:pos_customer_required.field_pos_config__require_customer +#: model:ir.model.fields,help:pos_customer_required.field_pos_order__require_customer +msgid "" +"Require customer for orders in this point of sale:\n" +"* 'Optional' (customer is optional);\n" +"* 'Required before paying';\n" +"* 'Required before starting the order';" +msgstr "" +"Client requis pour les commandes de ce terminal de point de vente:\n" +"* 'Optionnel' (Le client est optionnel);\n" +"* 'Le client est requis avant le payement';\n" +"* 'Le client est requis avant de commencer la commande';" + +#. module: pos_customer_required +#: model:ir.model.fields.selection,name:pos_customer_required.selection__pos_config__require_customer__payment +msgid "Required before paying" +msgstr "Requis avant de payer" + +#. module: pos_customer_required +#: model:ir.model.fields.selection,name:pos_customer_required.selection__pos_config__require_customer__order +msgid "Required before starting the order" +msgstr "Requis avant de commencer la vente" diff --git a/pos_customer_required/i18n/nl_NL.po b/pos_customer_required/i18n/nl_NL.po new file mode 100644 index 0000000..17a84d9 --- /dev/null +++ b/pos_customer_required/i18n/nl_NL.po @@ -0,0 +1,100 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_customer_required +# +# Translators: +# OCA Transbot , 2016 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-12-13 19:57+0000\n" +"PO-Revision-Date: 2016-12-13 19:57+0000\n" +"Last-Translator: OCA Transbot , 2016\n" +"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/" +"teams/23907/nl_NL/)\n" +"Language: nl_NL\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" + +#. module: pos_customer_required +#. openerp-web +#: code:addons/pos_customer_required/static/src/js/PaymentScreen.js:0 +#, python-format +msgid "An anonymous order cannot be confirmed" +msgstr "Een anoniem kassa order kan niet worden bevestigd" + +#. module: pos_customer_required +#: code:addons/pos_customer_required/models/pos_make_payment.py:0 +#, python-format +msgid "" +"An anonymous order cannot be confirmed.\n" +"Please select a customer for this order." +msgstr "" + +#. module: pos_customer_required +#: code:addons/pos_customer_required/models/pos_order.py:0 +#, python-format +msgid "Customer is required for this order and is missing." +msgstr "" + +#. module: pos_customer_required +#: model:ir.model.fields.selection,name:pos_customer_required.selection__pos_config__require_customer__no +msgid "Optional" +msgstr "" + +#. module: pos_customer_required +#. openerp-web +#: code:addons/pos_customer_required/static/src/js/PaymentScreen.js:0 +#, python-format +msgid "Please select a customer for this order." +msgstr "" + +#. module: pos_customer_required +#: model:ir.model,name:pos_customer_required.model_pos_config +#, fuzzy +msgid "Point of Sale Configuration" +msgstr "Kassa" + +#. module: pos_customer_required +#: model:ir.model,name:pos_customer_required.model_pos_order +#, fuzzy +msgid "Point of Sale Orders" +msgstr "Kassa" + +#. module: pos_customer_required +#: model:ir.model,name:pos_customer_required.model_pos_make_payment +msgid "Point of Sale Payment" +msgstr "" + +#. module: pos_customer_required +#: model:ir.model.fields,field_description:pos_customer_required.field_pos_config__require_customer +#: model:ir.model.fields,field_description:pos_customer_required.field_pos_order__require_customer +#: model_terms:ir.ui.view,arch_db:pos_customer_required.view_pos_config_form +msgid "Require Customer" +msgstr "" + +#. module: pos_customer_required +#: model:ir.model.fields,help:pos_customer_required.field_pos_config__require_customer +#: model:ir.model.fields,help:pos_customer_required.field_pos_order__require_customer +msgid "" +"Require customer for orders in this point of sale:\n" +"* 'Optional' (customer is optional);\n" +"* 'Required before paying';\n" +"* 'Required before starting the order';" +msgstr "" + +#. module: pos_customer_required +#: model:ir.model.fields.selection,name:pos_customer_required.selection__pos_config__require_customer__payment +msgid "Required before paying" +msgstr "" + +#. module: pos_customer_required +#: model:ir.model.fields.selection,name:pos_customer_required.selection__pos_config__require_customer__order +msgid "Required before starting the order" +msgstr "" + +#~ msgid "Require customer" +#~ msgstr "Klant verplichten" diff --git a/pos_customer_required/i18n/pos_customer_required.pot b/pos_customer_required/i18n/pos_customer_required.pot new file mode 100644 index 0000000..fca0c37 --- /dev/null +++ b/pos_customer_required/i18n/pos_customer_required.pot @@ -0,0 +1,88 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_customer_required +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \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_customer_required +#. openerp-web +#: code:addons/pos_customer_required/static/src/js/PaymentScreen.js:0 +#, python-format +msgid "An anonymous order cannot be confirmed" +msgstr "" + +#. module: pos_customer_required +#: code:addons/pos_customer_required/models/pos_make_payment.py:0 +#, python-format +msgid "An anonymous order cannot be confirmed.\n" +"Please select a customer for this order." +msgstr "" + +#. module: pos_customer_required +#: code:addons/pos_customer_required/models/pos_order.py:0 +#, python-format +msgid "Customer is required for this order and is missing." +msgstr "" + +#. module: pos_customer_required +#: model:ir.model.fields.selection,name:pos_customer_required.selection__pos_config__require_customer__no +msgid "Optional" +msgstr "" + +#. module: pos_customer_required +#. openerp-web +#: code:addons/pos_customer_required/static/src/js/PaymentScreen.js:0 +#, python-format +msgid "Please select a customer for this order." +msgstr "" + +#. module: pos_customer_required +#: model:ir.model,name:pos_customer_required.model_pos_config +msgid "Point of Sale Configuration" +msgstr "" + +#. module: pos_customer_required +#: model:ir.model,name:pos_customer_required.model_pos_order +msgid "Point of Sale Orders" +msgstr "" + +#. module: pos_customer_required +#: model:ir.model,name:pos_customer_required.model_pos_make_payment +msgid "Point of Sale Payment" +msgstr "" + +#. module: pos_customer_required +#: model:ir.model.fields,field_description:pos_customer_required.field_pos_config__require_customer +#: model:ir.model.fields,field_description:pos_customer_required.field_pos_order__require_customer +#: model_terms:ir.ui.view,arch_db:pos_customer_required.view_pos_config_form +msgid "Require Customer" +msgstr "" + +#. module: pos_customer_required +#: model:ir.model.fields,help:pos_customer_required.field_pos_config__require_customer +#: model:ir.model.fields,help:pos_customer_required.field_pos_order__require_customer +msgid "Require customer for orders in this point of sale:\n" +"* 'Optional' (customer is optional);\n" +"* 'Required before paying';\n" +"* 'Required before starting the order';" +msgstr "" + +#. module: pos_customer_required +#: model:ir.model.fields.selection,name:pos_customer_required.selection__pos_config__require_customer__payment +msgid "Required before paying" +msgstr "" + +#. module: pos_customer_required +#: model:ir.model.fields.selection,name:pos_customer_required.selection__pos_config__require_customer__order +msgid "Required before starting the order" +msgstr "" + diff --git a/pos_customer_required/models/__init__.py b/pos_customer_required/models/__init__.py new file mode 100644 index 0000000..51311ba --- /dev/null +++ b/pos_customer_required/models/__init__.py @@ -0,0 +1,4 @@ +from . import pos_config +from . import pos_order +from . import pos_make_payment +from . import res_config_setting diff --git a/pos_customer_required/models/pos_config.py b/pos_customer_required/models/pos_config.py new file mode 100644 index 0000000..5f917e5 --- /dev/null +++ b/pos_customer_required/models/pos_config.py @@ -0,0 +1,24 @@ +# Copyright 2004 apertoso NV - Jos DE GRAEVE +# Copyright 2016 La Louve - Sylvain LE GAL +# Copyright 2019 Druidoo - (https://www.druidoo.io) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from odoo import fields, models + + +class PosConfig(models.Model): + _inherit = "pos.config" + + require_customer = fields.Selection( + [ + ("no", "Optional"), + ("payment", "Required before paying"), + ("order", "Required before starting the order"), + ], + string="Require Customer", + default="no", + help="Require customer for orders in this point of sale:\n" + "* 'Optional' (customer is optional);\n" + "* 'Required before paying';\n" + "* 'Required before starting the order';", + ) diff --git a/pos_customer_required/models/pos_make_payment.py b/pos_customer_required/models/pos_make_payment.py new file mode 100644 index 0000000..6fb24d6 --- /dev/null +++ b/pos_customer_required/models/pos_make_payment.py @@ -0,0 +1,29 @@ +# Copyright 2016 La Louve - Sylvain LE GAL +# Copyright 2019 Druidoo - (https://www.druidoo.io) +# Copyright 2022 NuoBiT - Eric Antones +# Copyright 2022 NuoBiT - Kilian Niubo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + + +from odoo import _, models +from odoo.exceptions import UserError + + +class PosMakePayment(models.TransientModel): + _inherit = "pos.make.payment" + + def check(self): + # Load current order + order_obj = self.env["pos.order"] + order = order_obj.browse(self.env.context.get("active_id", False)) + + # Check if control is required + if not order.partner_id and order.session_id.config_id.require_customer != "no": + raise UserError( + _( + "An anonymous order cannot be confirmed.\n" + "Please select a customer for this order." + ) + ) + + return super(PosMakePayment, self).check() diff --git a/pos_customer_required/models/pos_order.py b/pos_customer_required/models/pos_order.py new file mode 100644 index 0000000..52bcaa7 --- /dev/null +++ b/pos_customer_required/models/pos_order.py @@ -0,0 +1,22 @@ +# Copyright 2004 apertoso NV - Jos DE GRAEVE +# Copyright 2016 La Louve - Sylvain LE GAL +# Copyright 2019 Druidoo - (https://www.druidoo.io) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from odoo import _, api, exceptions, fields, models + + +class PosOrder(models.Model): + _inherit = "pos.order" + + require_customer = fields.Selection( + related="session_id.config_id.require_customer", + ) + + @api.constrains("partner_id", "session_id") + def _check_partner(self): + for rec in self: + if rec.require_customer != "no" and not rec.partner_id: + raise exceptions.ValidationError( + _("Customer is required for this order and is missing.") + ) diff --git a/pos_customer_required/models/res_config_setting.py b/pos_customer_required/models/res_config_setting.py new file mode 100644 index 0000000..eb065b4 --- /dev/null +++ b/pos_customer_required/models/res_config_setting.py @@ -0,0 +1,11 @@ +from odoo import api, fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + require_customer = fields.Selection( + related="pos_config_id.require_customer", + readonly=False, + help="Require customer in Point of Sale", + ) diff --git a/pos_customer_required/readme/CONFIGURE.rst b/pos_customer_required/readme/CONFIGURE.rst new file mode 100644 index 0000000..3754a78 --- /dev/null +++ b/pos_customer_required/readme/CONFIGURE.rst @@ -0,0 +1,8 @@ +To configure this module, you need to: + +* go to point of sale -> configuration -> point of sales +* select the point of sales you want configure +* search for the "Require Customer" and choose between the following values: + * 'Optional'; (this module has no effect on this PoS config) + * 'Required before paying'; + * 'Required before starting the order'; diff --git a/pos_customer_required/readme/CONTRIBUTORS.rst b/pos_customer_required/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..535d9bc --- /dev/null +++ b/pos_customer_required/readme/CONTRIBUTORS.rst @@ -0,0 +1,6 @@ +* Jos De Graeve +* Sylvain LE GAL +* Pedro M. Baeza ( reviews & feedback ) +* Druidoo +* Eric Antones +* Kilian Niubo diff --git a/pos_customer_required/readme/DESCRIPTION.rst b/pos_customer_required/readme/DESCRIPTION.rst new file mode 100644 index 0000000..4f28974 --- /dev/null +++ b/pos_customer_required/readme/DESCRIPTION.rst @@ -0,0 +1,28 @@ +This module was written to extend the functionality of odoo pos +and allows you to require a customer for each pos order. In the +pos session configuration, you can choose to require the customer for pos +orders. + +If a customer is not selected, the pos ui will display an error message. +In the backend the customer field is required when needed. + +Two new options are available: + +* Customer 'Required before starting the order'; +* Customer 'Required before paying'; + +'Required before starting the order' Option +------------------------------------------- +In the frontend PoS, the default screen is the screen to select customers. + +* Users are not allowed to start selling before having selected a customer; +* Users can not 'deselect a customer', only select an other one; + +'Required before paying' Option +------------------------------- +In the frontend PoS, the user can start selling, but if the user tries to +make payment and if a customer is not selected, the pos ui will display an +error message. + + +.. image:: /pos_customer_required/static/description/frontend_pos_error_message.png diff --git a/pos_customer_required/readme/USAGE.rst b/pos_customer_required/readme/USAGE.rst new file mode 100644 index 0000000..8471f7f --- /dev/null +++ b/pos_customer_required/readme/USAGE.rst @@ -0,0 +1,3 @@ +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/184/9.0 diff --git a/pos_customer_required/static/description/frontend_pos_error_message.png b/pos_customer_required/static/description/frontend_pos_error_message.png new file mode 100644 index 0000000000000000000000000000000000000000..823bb997e3f34a3c706e0524ce35975503247f56 GIT binary patch literal 6994 zcmc(kcT^MI*Y5)eNS7iYRZ*HCO_Ul?L5eg5>4HEg57L{28c?b>p_F>jW_QC&1s|$rto)k`4giLFj5eehJRoTXOa0a4Fcr9Hi%z5XAU( zo?N{Zb?v61z09PVV~Y=RImc6QX?kjDzaS}RDS!FY5N@ci-`9yyXlLcEBRJoFE9ww@ zdvhCOIHBKOw6u;z06Uqusn+Bbu0}E&-tyPmE*~BZyG22*Q*Ko9}-i&&A`dj_t z+>tET@KX4=@B%#%nn=-w3mfR* zZIrC6sgF*0{*L;F`!D}YTZ+rRn|bq6Df|sQuDY2WbS~5uZP{>rgc634lzbgOUr%w| z&rIBQpA$KX_?-ocIB$*BxZ2=3hQN2={JzD8xU_$%DLxNk7!e;>cy+~pJ*=6**UW)y z&Ov%XqcOlAE!!d`9`Yx?V7zC!kv`o?W6N?863&GiJ|wMg*7SwH;We8P(x;zXiXvdV ze0YP|1*J1mPS4(=nM||w8MN9C4fo+oK35=!6!r0@mzAgsP@WvuL4F|{a8}`A^{0f> z_ZJZ+vhQ$#kjIT4QwYTlT5o9%J77KI`pJ42mUI9733{ur%PNB@RSF7(3AdF7pmo@5 zI*CQ9 zUbB6`{sdWie@3i03#5L*gwAD?(KvJYe9M30EyHz(8DK)kSGII#yA_^ga*7YGB{{!p zz*?&^gW4hhSvQxG@&L?#a45A1+!`=6bXL|*lS?tKvpttJG?ke z-OM0RdEvl(J)ML)b+FV*CysePIMw8YdDf#NnipM=hIzg-ZY(yM6 zZ*aAf1l=HnT6hys{VK9jLITEm3RE;UI_f zHVQ}t4vhCMv@xff#C)1d3H&WXPI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8S_|Mue?bsVuR@!?p-;@F$&AMI2 z*JX9ue#6yiqoa!fg8_CrHmwY+&k{IT3(^F3_=e$uLs%rE^Lz7)7$X0=fPPv@CVGmRMo#70k`Z$(W14*Jb z;~jHR_TJhSG<|ugHr&x2{$_QT{*^NJk~4~!Ub%U${YIakjBGRR^JniHE>L{!>mnB}EKkm7v=DS)(@2VQF=H0&v%;p7^qG|Cm V4Qb`yOZ^L=`_xdg`ib4U{{>yqjrsrp literal 0 HcmV?d00001 diff --git a/pos_customer_required/static/description/icon.png b/pos_customer_required/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..637d357b57b6bafdafc8798535a088a8371a35e1 GIT binary patch literal 4602 zcmZ`-cQ736x5kGkS#|Z!B3LD>MhFpYWmjKpbk?#W(KbqS(SyVyx+DluvU(RKdT(Ep zs7scpt0jnt>o@nWd+*$5&Uv3XXXdnQ_Hnr; zGKieq9qDViEpL8XK^3B+stA#igQ&{M*(g^P{f~ero+u1D@c$2xcBkPaBV$&DYTq{x z$lc2g#M%%8W8Vh3&Vsq2BA7bTk+8Mh>uMy6+XD*qct(&{E~OTQqxY>?5b)bXA0hXR zXq2eoc6h4hO(;}r%GhmYjj5B zA~Kr_`IbCn+9bsop}P(pIf5xW-{Z$1IP`Iv2=nJHt?}Bz703`7bSg#{2>k+jSX8$= z8d(8!aFZ1NGN>S7E0POyRLrT$LV?gNnTbpTxTxZ?n}D0|Fx>W++tj;;;`Q~4X}}9+ z7JV&2axEHNCvTHAAG9s|!10q#S_%TDx-v|^ZSkwfbFI`O1-91S#8D3laxS=d;Z_d| zZDe8LpI_&job=Rz8(SsuhI$9zHy{dXBfs)KeQb%DplZp?qRj%uN0p5>z6`?!j)o7q z!4hF`*4$(t2M3z+(U@sM=hJ#YC`%dB$Fdlv$Sto-Lf8H0$ygjzY|GuVpMagL@?wr< z5Lo-d7#yDem)!30Qm>v&GiBp2trHsjT6Ex}YFB_M@Gc)Ro$44z{#nF%jqwJsAZYcnchunl&$-zK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4U@p*W_49tBYPh@a`X9!^fwi%AT6I6MSRo`yb8?$n}>9~~i_VF4+`e~dl{Q{0_`18%GGZlVceB69A-RM=l z@VlWPO&1L8GBuCg)HZnXdhk&KTwdT7j*>2hj343K8|!R(w!aEE&Eh%8RZbT>K71e+_j?^bw)SvKnj52e+fe zb4Vdk`Tqa@hBXC0O{?ZF5dW(W;^awokR4HfqI~-6LM0?nWt+5qaTOTl`d0l*?YQ5; zdcXZDp~L>gKbjDsJjbowQKXmBBaQ3vnm-o8cRZ)nx0{GYH-_C~Bm zkHfiE0%xneu&l4H_Q_J?p}!kK@}&1%g3oZeV{Mwk>*|}-Z<0b%M?03gt*|)4Y{&3t z``-_p%)!XoL5WmP((>mo?&_DFr~^YtR!Ci4UG8CMxJg2$>rL{F zEHgSmD7#>*oma*lP0AhqM)}P&iY6PXkM0^VG_DDe#eh{Gwvp|!X$E#%+Xuqz^g>Z4 xs32v~VB#>*xhrxvRBrKqZz%rTcGy3+_v(wY_g7EFUawuqpgM-ycrAy>{{oe&p(6kQ literal 0 HcmV?d00001 diff --git a/pos_customer_required/static/description/index.html b/pos_customer_required/static/description/index.html new file mode 100644 index 0000000..aa3257a --- /dev/null +++ b/pos_customer_required/static/description/index.html @@ -0,0 +1,475 @@ + + + + + + +Point of Sale Require Customer + + + +
+

Point of Sale Require Customer

+ + +

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

+

This module was written to extend the functionality of odoo pos +and allows you to require a customer for each pos order. In the +pos session configuration, you can choose to require the customer for pos +orders.

+

If a customer is not selected, the pos ui will display an error message. +In the backend the customer field is required when needed.

+

Two new options are available:

+
    +
  • Customer ‘Required before starting the order’;
  • +
  • Customer ‘Required before paying’;
  • +
+
+

‘Required before starting the order’ Option

+

In the frontend PoS, the default screen is the screen to select customers.

+
    +
  • Users are not allowed to start selling before having selected a customer;
  • +
  • Users can not ‘deselect a customer’, only select an other one;
  • +
+
+
+

‘Required before paying’ Option

+

In the frontend PoS, the user can start selling, but if the user tries to +make payment and if a customer is not selected, the pos ui will display an +error message.

+https://raw.githubusercontent.com/pos_customer_required/static/description/frontend_pos_error_message.png +

Table of contents

+ +
+

Configuration

+

To configure this module, you need to:

+
    +
  • go to point of sale -> configuration -> point of sales
  • +
  • select the point of sales you want configure
  • +
  • +
    search for the “Require Customer” and choose between the following values:
    +
      +
    • ‘Optional’; (this module has no effect on this PoS config)
    • +
    • ‘Required before paying’;
    • +
    • ‘Required before starting the order’;
    • +
    +
    +
    +
  • +
+
+
+

Usage

+Try me on Runbot +
+
+

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 smashing it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Apertoso NV
  • +
  • La Louve
  • +
  • NuoBiT
  • +
+
+
+

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_customer_required/static/src/js/PaymentScreen.js b/pos_customer_required/static/src/js/PaymentScreen.js new file mode 100644 index 0000000..b0ebb12 --- /dev/null +++ b/pos_customer_required/static/src/js/PaymentScreen.js @@ -0,0 +1,37 @@ +/* Copyright apertoso NV- Jos DE GRAEVE + Copyright La Louve - Sylvain LE GAL + Copyright NuoBiT - Eric Antones + Copyright NuoBiT - Kilian Niubo + License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) */ +odoo.define("pos_customer_required.PaymentScreen", function (require) { + "use strict"; + + const PaymentScreen = require("point_of_sale.PaymentScreen"); + const Registries = require("point_of_sale.Registries"); + const core = require("web.core"); + const _t = core._t; + + const PosRequiredCustomerPaymentScreen = (PaymentScreen) => + class extends PaymentScreen { + async _isOrderValid(isForceValidate) { + if ( + this.env.pos.config.require_customer === "payment" && + !this.env.pos.get_order().get_partner() + ) { + const result = await this.showPopup("ConfirmPopup", { + title: _t("An anonymous order cannot be confirmed"), + body: _t("Please select a customer for this order."), + }); + if (result.confirmed) { + this.selectClient(); + } + return false; + } + return super._isOrderValid(isForceValidate); + } + }; + + Registries.Component.extend(PaymentScreen, PosRequiredCustomerPaymentScreen); + + return PosRequiredCustomerPaymentScreen; +}); diff --git a/pos_customer_required/static/src/js/ProductScreen.js b/pos_customer_required/static/src/js/ProductScreen.js new file mode 100644 index 0000000..899e844 --- /dev/null +++ b/pos_customer_required/static/src/js/ProductScreen.js @@ -0,0 +1,38 @@ +/** @odoo-module **/ + +import {Component} from "point_of_sale.Registries"; +import ProductScreen from "point_of_sale.ProductScreen"; +const { onMounted } = owl; + +const PosRequiredCustomerProductScreen = (ProductScreen) => + class extends ProductScreen { + + setup() { + super.setup(); + onMounted(async () => { + if ( + this.env.pos.config.require_customer === "order" && + !this.env.pos.get_order().get_partner() + ) { + this.onClickPartner(); + } + }); + } + + async _onClickPay() { + if ( + (this.env.pos.config.require_customer === "order" || + this.env.pos.config.require_customer === "payment") && + !this.env.pos.get_order().get_partner() + ) { + this.onClickPartner(); + } + else { + return super._onClickPay(...arguments); + } + } + + }; + +Component.extend(ProductScreen, PosRequiredCustomerProductScreen); +export default ProductScreen; \ No newline at end of file diff --git a/pos_customer_required/tests/__init__.py b/pos_customer_required/tests/__init__.py new file mode 100644 index 0000000..23b45ed --- /dev/null +++ b/pos_customer_required/tests/__init__.py @@ -0,0 +1 @@ +from . import test_pos_customer_required diff --git a/pos_customer_required/tests/test_pos_customer_required.py b/pos_customer_required/tests/test_pos_customer_required.py new file mode 100644 index 0000000..189e198 --- /dev/null +++ b/pos_customer_required/tests/test_pos_customer_required.py @@ -0,0 +1,49 @@ +import odoo.tests.common as common +from odoo import exceptions + + +class TestPosCustomerRequired(common.TransactionCase): + def setUp(self): + super().setUp() + self.pos_config = self.env.ref("point_of_sale.pos_config_main").copy() + + def test_customer_not_required(self): + self.pos_config.require_customer = "no" + + # Now Create new session and create a + # pos order in this session + pos_session = self.env["pos.session"].create( + {"user_id": 1, "config_id": self.pos_config.id} + ) + # should not raise any exception + self.env["pos.order"].create( + { + "session_id": pos_session.id, + "partner_id": False, + "amount_tax": 0.0, + "amount_total": 0.0, + "amount_paid": 0.0, + "amount_return": 0.0, + } + ) + + def test_customer_is_required(self): + self.pos_config.require_customer = "order" + + # Now Create new session and create a + # pos order in this session + pos_session = self.env["pos.session"].create( + {"user_id": 1, "config_id": self.pos_config.id} + ) + # should raise exceptions.ValidationError + with self.assertRaises(exceptions.ValidationError): + self.env["pos.order"].create( + { + "session_id": pos_session.id, + "partner_id": False, + "amount_tax": 0.0, + "amount_total": 0.0, + "amount_paid": 0.0, + "amount_return": 0.0, + } + ) diff --git a/pos_customer_required/views/assets.xml b/pos_customer_required/views/assets.xml new file mode 100644 index 0000000..415fbcf --- /dev/null +++ b/pos_customer_required/views/assets.xml @@ -0,0 +1,16 @@ + + + +