Skip to content

Commit

Permalink
🚑 pos_multi_session_restaurant - error on starting a multisession wit…
Browse files Browse the repository at this point in the history
…hout floors; pos_multi_session_sync - the orders were lost for multiple multisessions working at the same time (#1035)

* 🚑 plenty same pos_ID poses caused cross multi-session messaging

* 🚑 order loss for multiple multisessions working at the same time

* 🚑 error on starting a multisession without floors

* 📖 pos ms restaurant readme
  • Loading branch information
KolushovAlexandr authored and ilmir-k committed Jun 27, 2019
1 parent 79895a4 commit e024746
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 20 deletions.
47 changes: 34 additions & 13 deletions pos_multi_session_restaurant/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
:target: https://www.gnu.org/licenses/lgpl
:alt: License: LGPL-3

Sync POS orders across multiple sessions (restaurant extension)
===============================================================
=================================================================
Sync POS orders across multiple sessions (restaurant extension)
=================================================================

Syncs additional restaurant data:

Expand All @@ -14,22 +15,42 @@ Syncs additional restaurant data:

Each multi-session and each unsynchronized POS may have its own floor set. POSes in multi-session have same floors.

FIXME: there is issue with floor real-time synchronization, to synchronize tables after modifying them it is mandatory to refresh all POSes pages, also deleting a table with open order on it leads to constant error messages. See https://github.com/it-projects-llc/pos-addons/issues/375.
Credits
=======

Local run
---------
Contributors
------------
* `Ivan Yelizariev <https://it-projects.info/team/yelizariev>`__
* `Dinar Gabbasov <https://it-projects.info/team/GabbasovDinar>`__
* `Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>`__

If you use dbfilter, don't forget to specify correct proxy on printers
Sponsors
--------
* `IT-Projects LLC <https://it-projects.info>`__

Maintainers
-----------
* `IT-Projects LLC <https://it-projects.info>`__

To get a guaranteed support
you are kindly requested to purchase the module
at `odoo apps store <https://apps.odoo.com/apps/modules/10.0/pos_multi_session_restaurant/>`__.

Thank you for understanding!

`IT-Projects Team <https://www.it-projects.info/team>`__

Further information
-------------------
===================

Demo: http://runbot.it-projects.info/demo/pos-addons/10.0

HTML Description: https://apps.odoo.com/apps/modules/10.0/pos_multi_session_restaurant/

Tested on Odoo 9 4f7d0da94204dc6685c87cbfc675a7c38039aee5
Usage instructions: `<doc/index.rst>`_

Need our service?
-----------------
Changelog: `<doc/changelog.rst>`_

Contact us by `email <mailto:it@it-projects.info>`__ or fill out `request form <https://www.it-projects.info/page/website.contactus>`__:
Notifications on updates: `via Atom <https://github.com/it-projects-llc/pos-addons/commits/10.0/pos_multi_session_restaurant.atom>`_, `by Email <https://blogtrottr.com/?subscribe=https://github.com/it-projects-llc/pos-addons/commits/10.0/pos_multi_session_restaurant.atom>`_

* it@it-projects.info
* https://www.it-projects.info/page/website.contactus
Tested on Odoo 10.0 49ca43d75cb9a97642c820c2466d454f1ce604cb
2 changes: 1 addition & 1 deletion pos_multi_session_restaurant/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"category": "Point of Sale",
# "live_test_url": 'http://apps.it-projects.info/shop/product/pos-multi-session?version=10.0',
"images": ['images/s2.png'],
"version": "10.0.3.3.0",
"version": "10.0.3.3.1",
"application": False,

"author": "IT-Projects LLC, Ivan Yelizariev",
Expand Down
4 changes: 4 additions & 0 deletions pos_multi_session_restaurant/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
`3.3.1`
-------
**Fix:** Error on starting a multisession without any floors

`3.3.0`
-------
**New:** Allows to block a table for waiters if it's already served by another one
Expand Down
5 changes: 5 additions & 0 deletions pos_multi_session_restaurant/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ A floor can be added to a multi-session by two ways:

* Default method: Add floor to POS belonging to necessary multi-session via ``[[ Point of Sale ]] >> Configuration >> Point of sale``

Local run
---------

If you use dbfilter, don't forget to specify correct proxy on printers

Usage
=====

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ odoo.define('pos_multi_session_restaurant', function(require){
var floor_table = false;
var order = false;

// Multi session without floors
if (!this.config.ms_floor_ids.length) {
return PosModelSuper.prototype.ms_create_order.call(this, options);
}

if (data.table_id) {
table = this.tables_by_id[data.table_id];
}
Expand Down
2 changes: 1 addition & 1 deletion pos_multi_session_sync/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"category": "Point of Sale",
# "live_test_URL": "",
"images": ['images/pos_multi_session_sync.jpg'],
"version": "10.0.1.0.4",
"version": "10.0.1.0.5",
"application": False,

"author": "IT-Projects LLC, Kolushov Alexandr",
Expand Down
5 changes: 5 additions & 0 deletions pos_multi_session_sync/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
`1.0.5`
-------
- **Fix:** Cross multi-sesion messaging in case the same pos was assigned to a different multi-session
- **Fix:** Possible loss of orders for multiple multi-sessions working simultaneously when another new one starts

`1.0.4`
-------
- **Fix:** Random sync problems
Expand Down
17 changes: 12 additions & 5 deletions pos_multi_session_sync/models/pos_multi_session_sync_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def prepare_new_session(self, message):
self.write({
'run_ID': run_ID,
})
old_orders = self.env['pos_multi_session_sync.order'].search([('state', '=', 'draft'),
old_orders = self.env['pos_multi_session_sync.order'].search([('multi_session_ID', '=', self.multi_session_ID),
('state', '=', 'draft'),
('run_ID', '<', run_ID)])
if old_orders:
old_orders.write({'state': 'unpaid'})
Expand Down Expand Up @@ -165,7 +166,7 @@ def set_order(self, message):
order = order.create({
'order': json.dumps(message),
'order_uid': order_uid,
'multi_session_ID': self.id,
'multi_session_ID': self.multi_session_ID,
'run_ID': run_ID,
'nonce': message['data']['nonce']
})
Expand All @@ -180,9 +181,15 @@ def get_sync_all(self, message):
self.ensure_one()
pos_ID = message['data']['pos_id']
user_ID = self.env.context.get("user_ID")
pos = self.env['pos_multi_session_sync.pos'] \
.search([('multi_session_ID', '=', self.multi_session_ID), ("pos_ID", "=", pos_ID)])
pos = self.env['pos_multi_session_sync.pos'].search([("pos_ID", "=", pos_ID)])
run_ID = message['data']['run_ID']
if len(pos) == 1:
# pos.config was assigned to a different multi session
pos.multi_session_ID = self.multi_session_ID
elif len(pos) > 1:
# in case there were already created plenty same_id_poses (before the fix)
pos.unlink()
pos = None
if not pos:
pos = self.env['pos_multi_session_sync.pos'] \
.create({'multi_session_ID': self.multi_session_ID, 'pos_ID': pos_ID, 'user_ID': user_ID})
Expand All @@ -205,7 +212,7 @@ def get_sync_all(self, message):
orders.append(msg)
else:
for order in self.env['pos_multi_session_sync.order'] \
.search([('multi_session_ID', '=', self.id), ('state', '=', 'draft'),
.search([('multi_session_ID', '=', self.multi_session_ID), ('state', '=', 'draft'),
('run_ID', '=', run_ID)]):
msg = json.loads(order.order)
msg['data']['message_ID'] = pos.multi_session_message_ID
Expand Down

0 comments on commit e024746

Please sign in to comment.