Skip to content

Commit

Permalink
[ADD] point_of_sale_rescue_orders: new module
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankC013 committed Mar 27, 2024
1 parent 3f1b28c commit 876b44f
Show file tree
Hide file tree
Showing 11 changed files with 539 additions and 0 deletions.
62 changes: 62 additions & 0 deletions point_of_sale_rescue_orders/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
===========================
Point of Sale Rescue Orders
===========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a0b790e009809dfd1160e6d0b7b9e05b88ed746a80750f7c54a4dd2e7ff12aab
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/point_of_sale_rescue_orders
: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 <https://github.com/nuobit/odoo-addons/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 <https://github.com/nuobit/odoo-addons/issues/new?body=module:%20point_of_sale_rescue_orders%0Aversion:%2016.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
~~~~~~~

* NuoBiT Solutions SL

Contributors
~~~~~~~~~~~~

* `NuoBiT <https://www.nuobit.com>`__:

* Frank Cespedes <[email protected]>

Maintainers
~~~~~~~~~~~

This module is part of the `nuobit/odoo-addons <https://github.com/nuobit/odoo-addons/tree/16.0/point_of_sale_rescue_orders>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions point_of_sale_rescue_orders/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
12 changes: 12 additions & 0 deletions point_of_sale_rescue_orders/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright NuoBiT Solutions - Frank Cespedes <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Point of Sale Rescue Orders",
"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"],
}
1 change: 1 addition & 0 deletions point_of_sale_rescue_orders/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import pos_session
33 changes: 33 additions & 0 deletions point_of_sale_rescue_orders/models/pos_session.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright NuoBiT Solutions - Frank Cespedes <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

from odoo import 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"].create(

Check warning on line 13 in point_of_sale_rescue_orders/models/pos_session.py

View check run for this annotation

Codecov / codecov/patch

point_of_sale_rescue_orders/models/pos_session.py#L13

Added line #L13 was not covered by tests
{
"user_id": self.env.uid,
"config_id": self.config_id.id,
"rescue": True,
}
)
orders.write({"session_id": session.id})
return super(PosSession, self).post_closing_cash_details(counted_cash)

Check warning on line 21 in point_of_sale_rescue_orders/models/pos_session.py

View check run for this annotation

Codecov / codecov/patch

point_of_sale_rescue_orders/models/pos_session.py#L20-L21

Added lines #L20 - L21 were not covered by tests

def _validate_session(
self,
balancing_account=False,
amount_to_balance=0,
bank_payment_method_diffs=None,
):
res = super(PosSession, self)._validate_session()

Check warning on line 29 in point_of_sale_rescue_orders/models/pos_session.py

View check run for this annotation

Codecov / codecov/patch

point_of_sale_rescue_orders/models/pos_session.py#L29

Added line #L29 was not covered by tests
self.config_id.session_ids.filtered(
lambda x: x.state != "closed"
).rescue = False
return res

Check warning on line 33 in point_of_sale_rescue_orders/models/pos_session.py

View check run for this annotation

Codecov / codecov/patch

point_of_sale_rescue_orders/models/pos_session.py#L33

Added line #L33 was not covered by tests
3 changes: 3 additions & 0 deletions point_of_sale_rescue_orders/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `NuoBiT <https://www.nuobit.com>`__:

* Frank Cespedes <[email protected]>
1 change: 1 addition & 0 deletions point_of_sale_rescue_orders/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module allows you to close session in POS when you have orders still open
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 876b44f

Please sign in to comment.