Fix sql_error on wizard and report
This commit is contained in:
1 parent
a34240f6ff
commit
0988ecda1d
2 files changed
+8
-6
No files matched your search
@@ -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]
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in new issue
Block a user