diff --git a/trytond/report/report.py b/trytond/report/report.py index 0220c0f6ba..0ebce05cfd 100644 --- a/trytond/report/report.py +++ b/trytond/report/report.py @@ -24,7 +24,6 @@ from genshi.filters import Translator import traceback from trytond.config import CONFIG from trytond.sql_db import IntegrityError -from trytond.tools import find_language_context MODULE_LIST = [] MODULE_CLASS_LIST = {} @@ -59,15 +58,17 @@ class ReportService(Service): pool = pooler.get_pool(cursor.dbname) for key in pool._sql_errors.keys(): if key in exception[0]: - msg = self._sql_errors[key] + msg = pool._sql_errors[key] cursor2 = pooler.get_db(cursor.dbname).cursor() + if context is None: + context = {} try: cursor2.execute('SELECT value ' \ 'FROM ir_translation ' \ 'WHERE lang=%s ' \ 'AND type=%s ' \ 'AND src=%s', - (find_language_context(args), 'error', + (context.get('language', 'en_US'), 'error', msg)) if cursor2.rowcount: res = cursor2.fetchone()[0] diff --git a/trytond/wizard/wizard.py b/trytond/wizard/wizard.py index d91a41fd3d..6488fcfd24 100644 --- a/trytond/wizard/wizard.py +++ b/trytond/wizard/wizard.py @@ -9,7 +9,6 @@ from trytond.config import CONFIG import sys from trytond.sql_db import IntegrityError import traceback -from trytond.tools import find_language_context MODULE_LIST = [] MODULE_CLASS_LIST = {} @@ -44,15 +43,17 @@ class WizardService(Service): pool = pooler.get_pool(cursor.dbname) for key in pool._sql_errors.keys(): if key in exception[0]: - msg = self._sql_errors[key] + msg = pool._sql_errors[key] cursor2 = pooler.get_db(cursor.dbname).cursor() + if context is None: + context = {} try: cursor2.execute('SELECT value ' \ 'FROM ir_translation ' \ 'WHERE lang=%s ' \ 'AND type=%s ' \ 'AND src=%s', - (find_language_context(args), 'error', + (context.get('language', 'en_US'), 'error', msg)) if cursor2.rowcount: res = cursor2.fetchone()[0]