diff --git a/pos_close_draft_order/README.rst b/pos_close_draft_order/README.rst new file mode 100644 index 000000000..94a80b422 --- /dev/null +++ b/pos_close_draft_order/README.rst @@ -0,0 +1,62 @@ +===================== +POS Close Draft Order +===================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:cc5a8acabeea0c6e46d230f54335d30125a810ec05fee02ebb5d623b78fd142a + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-nuobit%2Fodoo--addons-lightgray.png?logo=github + :target: https://github.com/nuobit/odoo-addons/tree/16.0/pos_close_draft_order + :alt: nuobit/odoo-addons + +|badge1| |badge2| |badge3| + +This module allows you to close session in POS when you have orders still open + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* NuoBiT Solutions SL + +Contributors +~~~~~~~~~~~~ + +* `NuoBiT `__: + + * Frank Cespedes + +Maintainers +~~~~~~~~~~~ + +This module is part of the `nuobit/odoo-addons `_ project on GitHub. + +You are welcome to contribute. diff --git a/pos_close_draft_order/__init__.py b/pos_close_draft_order/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/pos_close_draft_order/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/pos_close_draft_order/__manifest__.py b/pos_close_draft_order/__manifest__.py new file mode 100644 index 000000000..821f9b3e0 --- /dev/null +++ b/pos_close_draft_order/__manifest__.py @@ -0,0 +1,12 @@ +# Copyright NuoBiT Solutions - Frank Cespedes +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +{ + "name": "POS Close Draft Order", + "version": "16.0.1.0.0", + "summary": "This module allows you to close session in POS when you have orders still open", + "category": "Sales/Point of Sale", + "author": "NuoBiT Solutions SL", + "website": "https://github.com/nuobit/odoo-addons", + "license": "AGPL-3", + "depends": ["point_of_sale"], +} diff --git a/pos_close_draft_order/models/__init__.py b/pos_close_draft_order/models/__init__.py new file mode 100644 index 000000000..f7116e3d4 --- /dev/null +++ b/pos_close_draft_order/models/__init__.py @@ -0,0 +1 @@ +from . import pos_session diff --git a/pos_close_draft_order/models/pos_session.py b/pos_close_draft_order/models/pos_session.py new file mode 100644 index 000000000..20f631eb8 --- /dev/null +++ b/pos_close_draft_order/models/pos_session.py @@ -0,0 +1,30 @@ +# Copyright NuoBiT Solutions - Frank Cespedes +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from odoo import api, models + + +class PosSession(models.Model): + _inherit = "pos.session" + + def post_closing_cash_details(self, counted_cash): + orders = self.order_ids.filtered(lambda x: x.state == "draft") + if orders: + session = ( + self.env["pos.session"] + .with_context(allow_multiple_session=True) + .create( + { + "user_id": self.env.uid, + "config_id": self.config_id.id, + "state": "opened", + } + ) + ) + orders.write({"session_id": session.id}) + return super(PosSession, self).post_closing_cash_details(counted_cash) + + @api.constrains("config_id") + def _check_pos_config(self): + if not self.env.context.get("allow_multiple_session", False): + return super(PosSession, self)._check_pos_config() diff --git a/pos_close_draft_order/readme/CONTRIBUTORS.rst b/pos_close_draft_order/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..277078c8e --- /dev/null +++ b/pos_close_draft_order/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `NuoBiT `__: + + * Frank Cespedes diff --git a/pos_close_draft_order/readme/DESCRIPTION.rst b/pos_close_draft_order/readme/DESCRIPTION.rst new file mode 100644 index 000000000..5177dd2e7 --- /dev/null +++ b/pos_close_draft_order/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module allows you to close session in POS when you have orders still open diff --git a/pos_close_draft_order/static/description/icon.png b/pos_close_draft_order/static/description/icon.png new file mode 100644 index 000000000..6035861aa Binary files /dev/null and b/pos_close_draft_order/static/description/icon.png differ diff --git a/pos_close_draft_order/static/description/index.html b/pos_close_draft_order/static/description/index.html new file mode 100644 index 000000000..a200bbeac --- /dev/null +++ b/pos_close_draft_order/static/description/index.html @@ -0,0 +1,419 @@ + + + + + + +POS Close Draft Order + + + +
+

POS Close Draft Order

+ + +

Beta License: AGPL-3 nuobit/odoo-addons

+

This module allows you to close session in POS when you have orders still open

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • NuoBiT Solutions SL
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is part of the nuobit/odoo-addons project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/setup/pos_close_draft_order/odoo/addons/pos_close_draft_order b/setup/pos_close_draft_order/odoo/addons/pos_close_draft_order new file mode 120000 index 000000000..cbc56ca33 --- /dev/null +++ b/setup/pos_close_draft_order/odoo/addons/pos_close_draft_order @@ -0,0 +1 @@ +../../../../pos_close_draft_order \ No newline at end of file diff --git a/setup/pos_close_draft_order/setup.py b/setup/pos_close_draft_order/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/pos_close_draft_order/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)