diff --git a/pos_payment_restriction/README.rst b/pos_payment_restriction/README.rst new file mode 100644 index 00000000..645d69bd --- /dev/null +++ b/pos_payment_restriction/README.rst @@ -0,0 +1,104 @@ +======================== +Pos Payment Restrictions +======================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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/9.0/pos_payment_restrictions + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-9-0/pos-9-0-pos_payment_restrictions + :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/9.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +In some situations, one would have user restrictions on payment lines level. + +This includes : + +* An option to make payment amount readonly +* An option that adds a helper to disable the 'Validate' button (e.g.: + waiting for an automatic payment transaction to be completed) + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +* Go to Point of Sale +* Go to your point of sale configuration (More > Settings) +* Check 'Prefill Cash Payment' and 'Payment amount readonly' + +On POS payment screen, the tendered amount cannot be modified + +Changelog +========= + +9.0.1.0.0 (2019-11-06) +~~~~~~~~~~~~~~~~~~~~~~ + +* [9.0][ADD] pos_payment_restrictions + +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 +~~~~~~~ + +* ACSONE SA/NV + +Contributors +~~~~~~~~~~~~ + +Denis Roussel + +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. + +.. |maintainer-rousseldenis| image:: https://github.com/rousseldenis.png?size=40px + :target: https://github.com/rousseldenis + :alt: rousseldenis + +Current `maintainer `__: + +|maintainer-rousseldenis| + +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_payment_restriction/__init__.py b/pos_payment_restriction/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/pos_payment_restriction/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/pos_payment_restriction/__openerp__.py b/pos_payment_restriction/__openerp__.py new file mode 100644 index 00000000..348977cd --- /dev/null +++ b/pos_payment_restriction/__openerp__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'Pos Payment Restriction', + 'summary': """ + Adds restrictions options on POS payment level""", + 'version': '9.0.1.0.0', + 'license': 'AGPL-3', + 'development_status': 'Beta', + 'maintainers': ['rousseldenis'], + 'category': 'Point of Sale', + 'author': 'ACSONE SA/NV,Odoo Community Association (OCA)', + 'website': 'https://github.com/OCA/pos', + 'depends': [ + 'point_of_sale', + ], + 'data': [ + 'views/pos_config.xml', + 'views/pos_payment_restriction.xml', + ], +} diff --git a/pos_payment_restriction/models/__init__.py b/pos_payment_restriction/models/__init__.py new file mode 100644 index 00000000..db8634ad --- /dev/null +++ b/pos_payment_restriction/models/__init__.py @@ -0,0 +1 @@ +from . import pos_config diff --git a/pos_payment_restriction/models/pos_config.py b/pos_payment_restriction/models/pos_config.py new file mode 100644 index 00000000..6cd3df64 --- /dev/null +++ b/pos_payment_restriction/models/pos_config.py @@ -0,0 +1,14 @@ +# Copyright 2019 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +from openerp import models, fields + + +class PosConfig(models.Model): + + _inherit = 'pos.config' + + payment_amount_readonly = fields.Boolean( + help="Payment lines amount would be readonly. This should be used" + "with the 'Prefill Cash Payment' option") diff --git a/pos_payment_restriction/readme/CONTRIBUTORS.rst b/pos_payment_restriction/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..ce70da75 --- /dev/null +++ b/pos_payment_restriction/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +Denis Roussel diff --git a/pos_payment_restriction/readme/DESCRIPTION.rst b/pos_payment_restriction/readme/DESCRIPTION.rst new file mode 100644 index 00000000..93f7f651 --- /dev/null +++ b/pos_payment_restriction/readme/DESCRIPTION.rst @@ -0,0 +1,7 @@ +In some situations, one would have user restrictions on payment lines level. + +This includes : + +* An option to make payment amount readonly +* An option that adds a helper to disable the 'Validate' button (e.g.: + waiting for an automatic payment transaction to be completed) diff --git a/pos_payment_restriction/readme/HISTORY.rst b/pos_payment_restriction/readme/HISTORY.rst new file mode 100644 index 00000000..14d31776 --- /dev/null +++ b/pos_payment_restriction/readme/HISTORY.rst @@ -0,0 +1,4 @@ +9.0.1.0.0 (2019-11-06) +~~~~~~~~~~~~~~~~~~~~~~ + +* [9.0][ADD] pos_payment_restriction diff --git a/pos_payment_restriction/readme/USAGE.rst b/pos_payment_restriction/readme/USAGE.rst new file mode 100644 index 00000000..42d99ffe --- /dev/null +++ b/pos_payment_restriction/readme/USAGE.rst @@ -0,0 +1,5 @@ +* Go to Point of Sale +* Go to your point of sale configuration (More > Settings) +* Check 'Prefill Cash Payment' and 'Payment amount readonly' + +On POS payment screen, the tendered amount cannot be modified diff --git a/pos_payment_restriction/static/description/icon.png b/pos_payment_restriction/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/pos_payment_restriction/static/description/icon.png differ diff --git a/pos_payment_restriction/static/description/index.html b/pos_payment_restriction/static/description/index.html new file mode 100644 index 00000000..d0b2c637 --- /dev/null +++ b/pos_payment_restriction/static/description/index.html @@ -0,0 +1,448 @@ + + + + + + +Pos Payment Restrictions + + + +
+

Pos Payment Restrictions

+ + +

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

+

In some situations, one would have user restrictions on payment lines level.

+

This includes :

+
    +
  • An option to make payment amount readonly
  • +
  • An option that adds a helper to disable the ‘Validate’ button (e.g.: +waiting for an automatic payment transaction to be completed)
  • +
+

Table of contents

+ +
+

Usage

+
    +
  • Go to Point of Sale
  • +
  • Go to your point of sale configuration (More > Settings)
  • +
  • Check ‘Prefill Cash Payment’ and ‘Payment amount readonly’
  • +
+

On POS payment screen, the tendered amount cannot be modified

+
+
+

Changelog

+
+

9.0.1.0.0 (2019-11-06)

+
    +
  • [9.0][ADD] pos_payment_restrictions
  • +
+
+
+
+

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

+
    +
  • ACSONE SA/NV
  • +
+
+ +
+

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.

+

Current maintainer:

+

rousseldenis

+

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_payment_restriction/static/src/js/screens.js b/pos_payment_restriction/static/src/js/screens.js new file mode 100644 index 00000000..5eb00fce --- /dev/null +++ b/pos_payment_restriction/static/src/js/screens.js @@ -0,0 +1,21 @@ +/* + Copyright 2019 ACSONE SA/NV + License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +*/ + +odoo.define('pos_payment_restriction.screens', function (require) { + "use strict"; + + var screens = require('point_of_sale.screens'); + var devices = require('point_of_sale.devices'); + + screens.PaymentScreenWidget.include({ + payment_input: function(){ + if (this.pos.config.payment_amount_readonly){ + return; + } + this._super.apply(this, arguments); + }, + }); +}); diff --git a/pos_payment_restriction/views/pos_config.xml b/pos_payment_restriction/views/pos_config.xml new file mode 100644 index 00000000..5240cb91 --- /dev/null +++ b/pos_payment_restriction/views/pos_config.xml @@ -0,0 +1,15 @@ + + + + + pos.payment.terminal.config.form (in pos_payment_restriction) + pos.config + + + + + + + + + diff --git a/pos_payment_restriction/views/pos_payment_restriction.xml b/pos_payment_restriction/views/pos_payment_restriction.xml new file mode 100644 index 00000000..e65e0782 --- /dev/null +++ b/pos_payment_restriction/views/pos_payment_restriction.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/setup/pos_payment_restriction/odoo_addons/__init__.py b/setup/pos_payment_restriction/odoo_addons/__init__.py new file mode 100644 index 00000000..de40ea7c --- /dev/null +++ b/setup/pos_payment_restriction/odoo_addons/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/pos_payment_restriction/odoo_addons/pos_payment_restriction b/setup/pos_payment_restriction/odoo_addons/pos_payment_restriction new file mode 120000 index 00000000..2fb11caa --- /dev/null +++ b/setup/pos_payment_restriction/odoo_addons/pos_payment_restriction @@ -0,0 +1 @@ +../../../pos_payment_restriction \ No newline at end of file diff --git a/setup/pos_payment_restriction/setup.py b/setup/pos_payment_restriction/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/pos_payment_restriction/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/pos_payment_restrictions/odoo_addons/__init__.py b/setup/pos_payment_restrictions/odoo_addons/__init__.py new file mode 100644 index 00000000..de40ea7c --- /dev/null +++ b/setup/pos_payment_restrictions/odoo_addons/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/pos_payment_restrictions/odoo_addons/pos_payment_restrictions b/setup/pos_payment_restrictions/odoo_addons/pos_payment_restrictions new file mode 120000 index 00000000..afa30db1 --- /dev/null +++ b/setup/pos_payment_restrictions/odoo_addons/pos_payment_restrictions @@ -0,0 +1 @@ +../../../pos_payment_restrictions \ No newline at end of file diff --git a/setup/pos_payment_restrictions/setup.py b/setup/pos_payment_restrictions/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/pos_payment_restrictions/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)