From 5cf2bb6ec93e820b8db8549ccdb925e91fff3ce8 Mon Sep 17 00:00:00 2001 From: "Yenthe V.G" Date: Mon, 29 May 2017 16:10:20 +0200 Subject: [PATCH] [FIX] pos_mercury: missing translation ability Made the error message more understandable Closes #17276 --- addons/pos_mercury/i18n/pos_mercury.pot | 12 ++++++++++++ addons/pos_mercury/models/pos_mercury_transaction.py | 5 +++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/addons/pos_mercury/i18n/pos_mercury.pot b/addons/pos_mercury/i18n/pos_mercury.pot index 1c70c16acc2..ea16b742442 100644 --- a/addons/pos_mercury/i18n/pos_mercury.pot +++ b/addons/pos_mercury/i18n/pos_mercury.pot @@ -603,6 +603,18 @@ msgstr "" msgid "Name of this Mercury configuration" msgstr "" +#. module: pos_mercury +#: code:addons/pos_mercury/models/pos_mercury_transaction.py:35 +#, python-format +msgid "No Mercury configuration associated with the journal." +msgstr "" + +#. module: pos_mercury +#: code:addons/pos_mercury/models/pos_mercury_transaction.py:23 +#, python-format +msgid "No opened point of sale session for user %s found" +msgstr "" + #. module: pos_mercury #. openerp-web #: code:addons/pos_mercury/static/src/js/pos_mercury.js:334 diff --git a/addons/pos_mercury/models/pos_mercury_transaction.py b/addons/pos_mercury/models/pos_mercury_transaction.py index ca392c4d895..cca78872ac5 100644 --- a/addons/pos_mercury/models/pos_mercury_transaction.py +++ b/addons/pos_mercury/models/pos_mercury_transaction.py @@ -9,6 +9,7 @@ import ssl import werkzeug from odoo import models, api, service +from odoo.tools.translate import _ from odoo.exceptions import UserError from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT @@ -19,7 +20,7 @@ class MercuryTransaction(models.Model): def _get_pos_session(self): 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") + raise UserError(_("No opened point of sale session for user %s found") % self.env.user.name) pos_session.login() @@ -31,7 +32,7 @@ class MercuryTransaction(models.Model): if journal and journal.pos_mercury_config_id: return journal.pos_mercury_config_id else: - raise UserError("No Mercury configuration associated with the journal.") + 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