[FIX] point_of_sale: resume session
- Create a new POS session with User A - Make an order - Logout and connect as User B - Resume the session The session cannot be resumed and the user is redirected to the POS Dashboard. When searching for a session to resume, the search restricts the user to the current user. Therefore, no session is found. If no session is found, we search on sessions corresponding to the given configuration. The configuration is mandatory to avoid being redirected to a random session. opw-2274973 X-original-commit: 2deb94aa9da821455374df5602e2d30c5befcdec
This commit is contained in:
@@ -33,6 +33,18 @@ class PosController(http.Controller):
|
||||
if config_id:
|
||||
domain = AND([domain,[('config_id', '=', int(config_id))]])
|
||||
pos_session = request.env['pos.session'].sudo().search(domain, limit=1)
|
||||
|
||||
# The same POS session can be opened by a different user => search without restricting to
|
||||
# current user. Note: the config must be explicitly given to avoid fallbacking on a random
|
||||
# session.
|
||||
if not pos_session and config_id:
|
||||
domain = [
|
||||
('state', '=', 'opened'),
|
||||
('rescue', '=', False),
|
||||
('config_id', '=', int(config_id)),
|
||||
]
|
||||
pos_session = request.env['pos.session'].sudo().search(domain, limit=1)
|
||||
|
||||
if not pos_session:
|
||||
return werkzeug.utils.redirect('/web#action=point_of_sale.action_client_pos_menu')
|
||||
# The POS only work in one company, so we enforce the one of the session in the context
|
||||
|
||||
Reference in New Issue
Block a user