From 3d3391da868382fcd55ebefe23fe9d1971426ef2 Mon Sep 17 00:00:00 2001 From: Joren Van Onder Date: Thu, 11 May 2017 15:31:41 -0700 Subject: [PATCH] [FIX] pos_mercury: take into account rescue sessions If there are open rescue sessions there will be multiple opened pos.session records with the same user. A better solution would be to make the POS client send back the pos.session id it belongs to and use that instead, but this would be unsuitable for a stable release. It will instead be done in master. opw-743318 --- addons/pos_mercury/models/pos_mercury_transaction.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/pos_mercury/models/pos_mercury_transaction.py b/addons/pos_mercury/models/pos_mercury_transaction.py index 05d7efdf265..ab0415ae9eb 100644 --- a/addons/pos_mercury/models/pos_mercury_transaction.py +++ b/addons/pos_mercury/models/pos_mercury_transaction.py @@ -15,7 +15,7 @@ class MercuryTransaction(models.Model): _name = 'pos_mercury.mercury_transaction' def _get_pos_session(self): - pos_session = self.env['pos.session'].search([('state', '=', 'opened'), ('user_id', '=', self.env.uid)]) + pos_session = self.env['pos.session'].search([('state', '=', 'opened'), ('user_id', '=', self.env.uid)], limit=1) if not pos_session: raise UserError("No POS session") @@ -32,6 +32,7 @@ class MercuryTransaction(models.Model): raise UserError("No Mercury configuration associated with the journal.") def _setup_request(self, data): + # todo: in master make the client include the pos.session id and use that pos_session = self._get_pos_session() config = pos_session.config_id