Iván Todorovich
5 years ago
committed by
Iván Todorovich
21 changed files with 122 additions and 178 deletions
-
92pos_customer_required/README.rst
-
1pos_customer_required/__init__.py
-
7pos_customer_required/__manifest__.py
-
14pos_customer_required/demo/pos_config.xml
-
7pos_customer_required/demo/pos_config.yml
-
19pos_customer_required/migrations/9.0.1.0.0/post-migration.py
-
18pos_customer_required/migrations/9.0.1.0.0/pre-migration.py
-
1pos_customer_required/models/__init__.py
-
4pos_customer_required/models/pos_config.py
-
6pos_customer_required/models/pos_make_payment.py
-
17pos_customer_required/models/pos_order.py
-
8pos_customer_required/readme/CONFIGURE.rst
-
4pos_customer_required/readme/CONTRIBUTORS.rst
-
28pos_customer_required/readme/DESCRIPTION.rst
-
3pos_customer_required/readme/USAGE.rst
-
6pos_customer_required/static/src/js/pos_customer_required.js
-
6pos_customer_required/static/src/xml/templates.xml
-
1pos_customer_required/tests/__init__.py
-
32pos_customer_required/tests/test_pos.py
-
23pos_customer_required/views/pos_config_view.xml
-
3pos_customer_required/views/pos_order_view.xml
@ -1,92 +0,0 @@ |
|||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
|||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
|
|||
================================= |
|||
Point Of Sale - Customer Required |
|||
================================= |
|||
|
|||
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 |
|||
|
|||
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. |
|||
|
|||
|
|||
Credits |
|||
======= |
|||
|
|||
Contributors |
|||
------------ |
|||
|
|||
* Jos De Graeve <Jos.DeGraeve@apertoso.be> |
|||
* Sylvain LE GAL <https://twitter.com/legalsylvain> |
|||
* Pedro M. Baeza <pedro.baeza@gmail.com> ( reviews & feedback ) |
|||
|
|||
|
|||
Maintainer |
|||
---------- |
|||
|
|||
.. image:: https://odoo-community.org/logo.png |
|||
:alt: Odoo Community Association |
|||
:target: https://odoo-community.org |
|||
|
|||
This module is maintained by the OCA. |
|||
|
|||
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. |
|||
|
|||
To contribute to this module, please visit http://odoo-community.org. |
@ -1,2 +1 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from . import models |
@ -0,0 +1,14 @@ |
|||
<?xml version="1.0"?> |
|||
<!-- |
|||
Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>) |
|||
Copyright (C) 2019-Today: Druidoo (<https://www.druidoo.io>) |
|||
@author: Sylvain LE GAL (https://twitter.com/legalsylvain) |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
--> |
|||
|
|||
<odoo> |
|||
<!-- POS Config: Require Customer(Required before starting the order) --> |
|||
<record id="point_of_sale.pos_config_main" model="pos.config"> |
|||
<field name="require_customer">order</field> |
|||
</record> |
|||
</odoo> |
@ -1,7 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>) |
|||
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
- !record {model: pos.config, id: point_of_sale.pos_config_main}: |
|||
require_customer: order |
@ -1,19 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>) |
|||
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from openupgradelib import openupgrade |
|||
|
|||
|
|||
BOOLEAN_TO_SELECTION = [ |
|||
('false', 'no'), |
|||
('true', 'order'), |
|||
] |
|||
|
|||
|
|||
@openupgrade.migrate() |
|||
def migrate(cr, installed_version): |
|||
openupgrade.map_values( |
|||
cr, openupgrade.get_legacy_name('require_customer'), |
|||
'require_customer', BOOLEAN_TO_SELECTION, table='pos_config') |
@ -1,18 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>) |
|||
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from openupgradelib import openupgrade |
|||
|
|||
|
|||
column_renames = { |
|||
'pos_config': [ |
|||
('require_customer', None), |
|||
] |
|||
} |
|||
|
|||
|
|||
@openupgrade.migrate() |
|||
def migrate(cr, version): |
|||
openupgrade.rename_columns(cr, column_renames) |
@ -1,4 +1,3 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from . import pos_config |
|||
from . import pos_order |
|||
from . import pos_make_payment |
@ -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'; |
@ -0,0 +1,4 @@ |
|||
* 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> |
@ -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 |
@ -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 |
@ -1,2 +1 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from . import test_pos |
@ -1,38 +1,48 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
import openerp.tests.common as common |
|||
from openerp import exceptions |
|||
import odoo.tests.common as common |
|||
from odoo import exceptions |
|||
|
|||
|
|||
class TestPosRequireCustomer(common.TransactionCase): |
|||
def setUp(self): |
|||
super(TestPosRequireCustomer, self).setUp() |
|||
self.pos_config = self.env.ref('point_of_sale.pos_config_main') |
|||
|
|||
def test_customer_not_required(self): |
|||
posconfig = self.env.ref('point_of_sale.pos_config_main') |
|||
posconfig.require_customer = 'no' |
|||
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( |
|||
{'config_id': posconfig.id}) |
|||
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): |
|||
posconfig = self.env.ref('point_of_sale.pos_config_main') |
|||
posconfig.require_customer = 'order' |
|||
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( |
|||
{'config_id': posconfig.id}) |
|||
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 |
|||
}) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue