LaOsaCoop/Odoo16#14 migration pos_customer_required

This commit is contained in:
Luis 2025-05-11 18:40:33 +02:00
parent b062c383d5
commit 08fca37c6d
27 changed files with 1438 additions and 0 deletions

View file

@ -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 <https://github.com/OCA/pos/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 <https://github.com/OCA/pos/issues/new?body=module:%20pos_customer_required%0Aversion:%2014.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
~~~~~~~
* Apertoso NV
* La Louve
* NuoBiT
Contributors
~~~~~~~~~~~~
* Jos De Graeve <Jos.DeGraeve@apertoso.be>
* Sylvain LE GAL <https://twitter.com/legalsylvain>
* Pedro M. Baeza <pedro.baeza@gmail.com> ( reviews & feedback )
* Druidoo <https://www.druidoo.io>
* Eric Antones <eantones@nuobit.com>
* Kilian Niubo <kniubo@nuobit.com>
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 <https://github.com/OCA/pos/tree/14.0/pos_customer_required>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View file

@ -0,0 +1 @@
from . import models

View file

@ -0,0 +1,26 @@
# Copyright 2004 apertoso NV - Jos DE GRAEVE <Jos.DeGraeve@apertoso.be>
# Copyright 2016 La Louve - Sylvain LE GAL <https://twitter.com/legalsylvain>
# Copyright 2019 Druidoo - (https://www.druidoo.io)
# Copyright 2022 NuoBiT - Eric Antones <eantones@nuobit.com>
# Copyright 2022 NuoBiT - Kilian Niubo <kniubo@nuobit.com>
# 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,
}

View file

@ -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 <mtbochaca@gmail.com>, 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 <carlesantoli@hotmail.com>\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"

View file

@ -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 <carlesantoli@hotmail.com>\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"

View file

@ -0,0 +1,103 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_customer_required
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
# leemannd <denis.leemann@camptocamp.com>, 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 <denis.leemann@camptocamp.com>, 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"

View file

@ -0,0 +1,100 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_customer_required
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 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 <transbot@odoo-community.org>, 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"

View file

@ -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 ""

View file

@ -0,0 +1,4 @@
from . import pos_config
from . import pos_order
from . import pos_make_payment
from . import res_config_setting

View file

@ -0,0 +1,24 @@
# Copyright 2004 apertoso NV - Jos DE GRAEVE <Jos.DeGraeve@apertoso.be>
# Copyright 2016 La Louve - Sylvain LE GAL <https://twitter.com/legalsylvain>
# 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';",
)

View file

@ -0,0 +1,29 @@
# Copyright 2016 La Louve - Sylvain LE GAL <https://twitter.com/legalsylvain>
# Copyright 2019 Druidoo - (https://www.druidoo.io)
# Copyright 2022 NuoBiT - Eric Antones <eantones@nuobit.com>
# Copyright 2022 NuoBiT - Kilian Niubo <kniubo@nuobit.com>
# 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()

View file

@ -0,0 +1,22 @@
# Copyright 2004 apertoso NV - Jos DE GRAEVE <Jos.DeGraeve@apertoso.be>
# Copyright 2016 La Louve - Sylvain LE GAL <https://twitter.com/legalsylvain>
# 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.")
)

View file

@ -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",
)

View file

@ -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';

View file

@ -0,0 +1,6 @@
* Jos De Graeve <Jos.DeGraeve@apertoso.be>
* Sylvain LE GAL <https://twitter.com/legalsylvain>
* Pedro M. Baeza <pedro.baeza@gmail.com> ( reviews & feedback )
* Druidoo <https://www.druidoo.io>
* Eric Antones <eantones@nuobit.com>
* Kilian Niubo <kniubo@nuobit.com>

View file

@ -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

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View file

@ -0,0 +1,475 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Point of Sale Require Customer</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="point-of-sale-require-customer">
<h1 class="title">Point of Sale Require Customer</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/pos/tree/14.0/pos_customer_required"><img alt="OCA/pos" src="https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/pos-14-0/pos-14-0-pos_customer_required"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/184/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>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.</p>
<p>If a customer is not selected, the pos ui will display an error message.
In the backend the customer field is required when needed.</p>
<p>Two new options are available:</p>
<ul class="simple">
<li>Customer Required before starting the order;</li>
<li>Customer Required before paying;</li>
</ul>
<div class="section" id="required-before-starting-the-order-option">
<h1>Required before starting the order Option</h1>
<p>In the frontend PoS, the default screen is the screen to select customers.</p>
<ul class="simple">
<li>Users are not allowed to start selling before having selected a customer;</li>
<li>Users can not deselect a customer, only select an other one;</li>
</ul>
</div>
<div class="section" id="required-before-paying-option">
<h1>Required before paying Option</h1>
<p>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.</p>
<img alt="https://raw.githubusercontent.com/pos_customer_required/static/description/frontend_pos_error_message.png" src="https://raw.githubusercontent.com/pos_customer_required/static/description/frontend_pos_error_message.png" />
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#configuration" id="id1">Configuration</a></li>
<li><a class="reference internal" href="#usage" id="id2">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="configuration">
<h2><a class="toc-backref" href="#id1">Configuration</a></h2>
<p>To configure this module, you need to:</p>
<ul class="simple">
<li>go to point of sale -&gt; configuration -&gt; point of sales</li>
<li>select the point of sales you want configure</li>
<li><dl class="first docutils">
<dt>search for the “Require Customer” and choose between the following values:</dt>
<dd><ul class="first last">
<li>Optional; (this module has no effect on this PoS config)</li>
<li>Required before paying;</li>
<li>Required before starting the order;</li>
</ul>
</dd>
</dl>
</li>
</ul>
</div>
<div class="section" id="usage">
<h2><a class="toc-backref" href="#id2">Usage</a></h2>
<a class="reference external image-reference" href="https://runbot.odoo-community.org/runbot/184/9.0"><img alt="Try me on Runbot" src="https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas" /></a>
</div>
<div class="section" id="bug-tracker">
<h2><a class="toc-backref" href="#id3">Bug Tracker</a></h2>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/pos/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/pos/issues/new?body=module:%20pos_customer_required%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h2><a class="toc-backref" href="#id4">Credits</a></h2>
<div class="section" id="authors">
<h3><a class="toc-backref" href="#id5">Authors</a></h3>
<ul class="simple">
<li>Apertoso NV</li>
<li>La Louve</li>
<li>NuoBiT</li>
</ul>
</div>
<div class="section" id="contributors">
<h3><a class="toc-backref" href="#id6">Contributors</a></h3>
<ul class="simple">
<li>Jos De Graeve &lt;<a class="reference external" href="mailto:Jos.DeGraeve&#64;apertoso.be">Jos.DeGraeve&#64;apertoso.be</a>&gt;</li>
<li>Sylvain LE GAL &lt;<a class="reference external" href="https://twitter.com/legalsylvain">https://twitter.com/legalsylvain</a>&gt;</li>
<li>Pedro M. Baeza &lt;<a class="reference external" href="mailto:pedro.baeza&#64;gmail.com">pedro.baeza&#64;gmail.com</a>&gt; ( reviews &amp; feedback )</li>
<li>Druidoo &lt;<a class="reference external" href="https://www.druidoo.io">https://www.druidoo.io</a>&gt;</li>
<li>Eric Antones &lt;<a class="reference external" href="mailto:eantones&#64;nuobit.com">eantones&#64;nuobit.com</a>&gt;</li>
<li>Kilian Niubo &lt;<a class="reference external" href="mailto:kniubo&#64;nuobit.com">kniubo&#64;nuobit.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#id7">Maintainers</a></h3>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/pos/tree/14.0/pos_customer_required">OCA/pos</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,37 @@
/* Copyright apertoso NV- Jos DE GRAEVE <Jos.DeGraeve@apertoso.be>
Copyright La Louve - Sylvain LE GAL <https://twitter.com/legalsylvain>
Copyright NuoBiT - Eric Antones <eantones@nuobit.com>
Copyright NuoBiT - Kilian Niubo <kniubo@nuobit.com>
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;
});

View file

@ -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;

View file

@ -0,0 +1 @@
from . import test_pos_customer_required

View file

@ -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,
}
)

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) -->
<odoo>
<template id="assets" inherit_id="point_of_sale.assets">
<xpath expr=".">
<script
type="text/javascript"
src="/pos_customer_required/static/src/js/PaymentScreen.js"
/>
<script
type="text/javascript"
src="/pos_customer_required/static/src/js/ProductScreen.js"
/>
</xpath>
</template>
</odoo>

View file

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2004 apertoso NV - Jos DE GRAEVE <Jos.DeGraeve@apertoso.be>
Copyright 2016 La Louve - Sylvain LE GAL <https://twitter.com/legalsylvain>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) -->
<odoo>
<record model="ir.ui.view" id="view_pos_config_form">
<field name="name">view.pos.config.form</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="point_of_sale.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[@id='pos_interface_section']" position="inside">
<div class="col-12 col-lg-6 o_setting_box" id="require_customer">
<div class="o_setting_right_pane">
<label for="require_customer" string="Require Customer" />
<div class="content-group mt16">
<field
name="require_customer"
class="o_light_label"
widget="radio"
/>
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2004 apertoso NV - Jos DE GRAEVE <Jos.DeGraeve@apertoso.be>
Copyright 2016 La Louve - Sylvain LE GAL <https://twitter.com/legalsylvain>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) -->
<odoo>
<record model="ir.ui.view" id="view_pos_order_form">
<field name="name">view.pos.order.form</field>
<field name="model">pos.order</field>
<field name="inherit_id" ref="point_of_sale.view_pos_pos_form" />
<field name="arch" type="xml">
<xpath expr="//sheet" position="inside">
<field name="require_customer" invisible="1" />
</xpath>
<xpath expr="//field[@name='partner_id']" position="attributes">
<attribute
name="attrs"
>{'readonly': [('state', '=', 'invoiced')], 'required': [('require_customer', '!=', 'no')]}</attribute>
</xpath>
</field>
</record>
</odoo>