From 0493013ec6ef18be9f99637620b5f99bd6e0e9d6 Mon Sep 17 00:00:00 2001 From: FrankC013 Date: Wed, 27 Mar 2024 08:54:26 +0100 Subject: [PATCH] [ADD] pos_close_draft_order: new module --- pos_close_draft_order/README.rst | 62 +++ pos_close_draft_order/__init__.py | 1 + pos_close_draft_order/__manifest__.py | 12 + pos_close_draft_order/models/__init__.py | 1 + pos_close_draft_order/models/pos_session.py | 30 ++ pos_close_draft_order/readme/CONTRIBUTORS.rst | 3 + pos_close_draft_order/readme/DESCRIPTION.rst | 1 + .../static/description/icon.png | Bin 0 -> 4894 bytes .../static/description/index.html | 419 ++++++++++++++++++ .../odoo/addons/pos_close_draft_order | 1 + setup/pos_close_draft_order/setup.py | 6 + 11 files changed, 536 insertions(+) create mode 100644 pos_close_draft_order/README.rst create mode 100644 pos_close_draft_order/__init__.py create mode 100644 pos_close_draft_order/__manifest__.py create mode 100644 pos_close_draft_order/models/__init__.py create mode 100644 pos_close_draft_order/models/pos_session.py create mode 100644 pos_close_draft_order/readme/CONTRIBUTORS.rst create mode 100644 pos_close_draft_order/readme/DESCRIPTION.rst create mode 100644 pos_close_draft_order/static/description/icon.png create mode 100644 pos_close_draft_order/static/description/index.html create mode 120000 setup/pos_close_draft_order/odoo/addons/pos_close_draft_order create mode 100644 setup/pos_close_draft_order/setup.py 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 0000000000000000000000000000000000000000..6035861aa996f07f4f83a31acf3dec4ca4511ed4 GIT binary patch literal 4894 zcmd^DXIm3U7u9UQ&=V;xH6ef?g1A%*C4taXdhenjy$K3PGc*H=Gyw&X7JBbs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BYI7_Nlq4+=T++=u^WgYfZ#Q>&m zXrm=#W3JTnvl3j=%06AIXbZ|uWl9}Unu~4zYkbyzM@^ryR`D2pM=B}H^mFs9FPbjb zpCD9?p7b>-4G@<0D`x2>n-7mw!<8TA#41F`9Q_?dX=WpR=^d&1?3G5f9K|k)qz6AR zE(SirN5q9q&_G-|NLC9NU?sa!h(NBHTU{aoFIWHb;u^aHd`Ofy!HVYFVjWaRvZ$^) zehbtc{S|Dyuiw4J{^gUaD*O;9bXORR-PfP)G|PN_$evh07bXaOgz`ucGUGU0qq<}x zfCLlcj=D>aEQqPvZEXcFd;uh0t`zCY9ERXwJVm_GLXJQ2GT4P;3D)IHM37otgs)r! z|48@IJQImLlI4VKm=d%86A1(W0Y^;1+7I=lOkfYC3D3~`?L18mK3bh99-^)ZljB6B z>#EV^burtyDcU+rZgfeOLdAeI$D4*DxgJDAxk_ee)7~R|){~ZKSR(Y_C-NQ`HB8Wz zpX-9i&$+R9e(9eM_3U1jyj)`7i*DJ@zmtOj5PZrjq4x#nk5e62Pmm4YcRG>BkUS1X zueP)(SEg31*MyA#YAB<%1{W#e5aM&cFxN$I(5eE#EDxdbY6zn5(QzjOm}ws8_98fr=Ns>-A(UBUrkl!`XTuvt>7o9f*{GTc=l8QkY1)^7@WwTTnru&d zEBZA=N7nHREqm7HCMeZ0Y;Na|-|dNAhbR>|-KKE$3cgc%_HkJEU<56A)3m-wkWj-w zsEs(wPcm6_p`bY5tbN*G@tn;>XJls#_`BkhmIkQ7@B?K zpWTCBQJz6^y%eq@2 + + + + + +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, +)