-
-
Notifications
You must be signed in to change notification settings - Fork 619
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2f0b7e
commit 5f093cf
Showing
20 changed files
with
1,122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
========================== | ||
PoS disable rescue session | ||
========================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:ee4862c9264327ff32020cd53ebcc443c7fca21b7ce59d09be0c018596e6b840 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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/14.0/pos_disable_rescue_session | ||
:alt: OCA/pos | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/pos-14-0/pos-14-0-pos_disable_rescue_session | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/pos&target_branch=14.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module adds an option to disable the PoS rescue session creation. | ||
|
||
When activated it forbids to synchronize orders on a closed session but allows | ||
to synchronize them in the next session. | ||
|
||
It adds a popup to warn the user that the session is closed and allows to | ||
continue creating orders. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
To disable the rescue session for a PoS config, go to its Settings and check | ||
the box "Disable Rescue Session". This will prevent the rescue session from | ||
being created for this PoS config. | ||
|
||
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 to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/pos/issues/new?body=module:%20pos_disable_rescue_session%0Aversion:%2014.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 | ||
~~~~~~~ | ||
|
||
* Akretion | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* `Akretion <https://www.akretion.com>`_: | ||
|
||
* Florian Mounier | ||
|
||
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. | ||
|
||
This module is part of the `OCA/pos <https://github.com/OCA/pos/tree/14.0/pos_disable_rescue_session>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2023 Akretion (http://www.akretion.com). | ||
# @author Florian Mounier <florian.mounier@akretion.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "PoS disable rescue session", | ||
"summary": "Add an option to disable the rescue session per pos config", | ||
"version": "14.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "Akretion,Odoo Community Association (OCA)", | ||
"category": "Point of Sale", | ||
"website": "https://github.com/OCA/pos", | ||
"depends": [ | ||
"point_of_sale", | ||
], | ||
"data": [ | ||
"views/assets.xml", | ||
"views/pos_config_view.xml", | ||
], | ||
"qweb": [ | ||
"static/src/xml/RescueSessionUnavailableErrorPopup.xml", | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * pos_disable_rescue_session | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2023-11-22 12:11+0000\n" | ||
"PO-Revision-Date: 2023-11-22 12:11+0000\n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: pos_disable_rescue_session | ||
#: model_terms:ir.ui.view,arch_db:pos_disable_rescue_session.pos_config_view_form | ||
msgid "Disable Rescue Session" | ||
msgstr "Désactiver la session de sauvetage" | ||
|
||
#. module: pos_disable_rescue_session | ||
#: model:ir.model.fields,field_description:pos_disable_rescue_session.field_pos_config__disable_rescue_session | ||
msgid "Disable rescue session" | ||
msgstr "Désactiver la session de sauvetage" | ||
|
||
#. module: pos_disable_rescue_session | ||
#: model:ir.model.fields,field_description:pos_disable_rescue_session.field_pos_config__display_name | ||
#: model:ir.model.fields,field_description:pos_disable_rescue_session.field_pos_order__display_name | ||
msgid "Display Name" | ||
msgstr "Nom affiché" | ||
|
||
#. module: pos_disable_rescue_session | ||
#. openerp-web | ||
#: code:addons/pos_disable_rescue_session/static/src/xml/RescueSessionUnavailableErrorPopup.xml:0 | ||
#, python-format | ||
msgid "Don't show again" | ||
msgstr "Ne plus afficher" | ||
|
||
#. module: pos_disable_rescue_session | ||
#: model:ir.model.fields,field_description:pos_disable_rescue_session.field_pos_config__id | ||
#: model:ir.model.fields,field_description:pos_disable_rescue_session.field_pos_order__id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: pos_disable_rescue_session | ||
#: model:ir.model.fields,field_description:pos_disable_rescue_session.field_pos_config____last_update | ||
#: model:ir.model.fields,field_description:pos_disable_rescue_session.field_pos_order____last_update | ||
msgid "Last Modified on" | ||
msgstr "Dernière modification le" | ||
|
||
#. module: pos_disable_rescue_session | ||
#. openerp-web | ||
#: code:addons/pos_disable_rescue_session/static/src/xml/RescueSessionUnavailableErrorPopup.xml:0 | ||
#, python-format | ||
msgid "Ok" | ||
msgstr "" | ||
|
||
#. module: pos_disable_rescue_session | ||
#: model:ir.model,name:pos_disable_rescue_session.model_pos_config | ||
msgid "Point of Sale Configuration" | ||
msgstr "Paramétrage du point de vente" | ||
|
||
#. module: pos_disable_rescue_session | ||
#: model:ir.model,name:pos_disable_rescue_session.model_pos_order | ||
msgid "Point of Sale Orders" | ||
msgstr "Commandes du point de vente" | ||
|
||
#. module: pos_disable_rescue_session | ||
#: model_terms:ir.ui.view,arch_db:pos_disable_rescue_session.pos_config_view_form | ||
msgid "" | ||
"Prevent the creation of a rescue session for remaining orders when the POS " | ||
"is closed." | ||
msgstr "" | ||
"Désactive la création d'une session de sauvetage pour les commandes restantes " | ||
"lorsque le point de vente est fermé." | ||
|
||
#. module: pos_disable_rescue_session | ||
#: model:ir.model.fields,help:pos_disable_rescue_session.field_pos_config__disable_rescue_session | ||
msgid "" | ||
"Prevent the creation of a rescue session for remaining orders when the POS is closed.\n" | ||
"These orders will be recovered on the next session." | ||
msgstr "" | ||
"Désactive la création d'une session de sauvetage pour les commandes restantes " | ||
"lorsque le point de vente est fermé.\n" | ||
"Ces commandes seront récupérées lors de la prochaine session." | ||
|
||
#. module: pos_disable_rescue_session | ||
#. openerp-web | ||
#: code:addons/pos_disable_rescue_session/static/src/js/PaymentScreen.js:0 | ||
#, python-format | ||
msgid "Session Is Closed" | ||
msgstr "Session fermée" | ||
|
||
#. module: pos_disable_rescue_session | ||
#: code:addons/pos_disable_rescue_session/models/pos_order.py:0 | ||
#, python-format | ||
msgid "" | ||
"This PoS session has been closed and the rescue session is disabled for this" | ||
" PoS." | ||
msgstr "" | ||
"Cette session de point de vente a été fermée et la session de sauvetage est " | ||
"désactivée pour ce point de vente." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import pos_config | ||
from . import pos_order |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright 2023 Akretion (http://www.akretion.com). | ||
# @author Florian Mounier <florian.mounier@akretion.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class PosConfig(models.Model): | ||
_inherit = "pos.config" | ||
|
||
disable_rescue_session = fields.Boolean( | ||
string="Disable rescue session", | ||
help="Prevent the creation of a rescue session for remaining orders when the POS is closed.\n" | ||
"These orders will be recovered on the next session.", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright 2023 Akretion (http://www.akretion.com). | ||
# @author Florian Mounier <florian.mounier@akretion.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import _, models | ||
from odoo.exceptions import UserError | ||
|
||
|
||
class RescueSessionUnavailableError(UserError): | ||
pass | ||
|
||
|
||
class PosOrder(models.Model): | ||
_inherit = "pos.order" | ||
|
||
def _get_valid_session(self, order): | ||
closed_session = self.env["pos.session"].browse(order["pos_session_id"]) | ||
|
||
# Do nothing if the option is not enabled | ||
if not closed_session.config_id.disable_rescue_session: | ||
return super()._get_valid_session(order) | ||
|
||
# Look for an open session with the same config | ||
open_session = self.env["pos.session"].search( | ||
[ | ||
("state", "=", "opened"), | ||
("config_id", "=", closed_session.config_id.id), | ||
], | ||
limit=1, | ||
) | ||
# If there is an open session, we use it | ||
if open_session: | ||
return open_session | ||
|
||
# If there is no open session, we raise an error | ||
# That will be handled by the POS in the same way as a connectivity issue | ||
# to allow the user to continue working. | ||
raise RescueSessionUnavailableError( | ||
_( | ||
"This PoS session has been closed and the rescue session is disabled for this PoS." | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* `Akretion <https://www.akretion.com>`_: | ||
|
||
* Florian Mounier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
This module adds an option to disable the PoS rescue session creation. | ||
|
||
When activated it forbids to synchronize orders on a closed session but allows | ||
to synchronize them in the next session. | ||
|
||
It adds a popup to warn the user that the session is closed and allows to | ||
continue creating orders. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
To disable the rescue session for a PoS config, go to its Settings and check | ||
the box "Disable Rescue Session". This will prevent the rescue session from | ||
being created for this PoS config. |
Oops, something went wrong.