37 lines
1.8 KiB
Diff
37 lines
1.8 KiB
Diff
diff -r 0bde16075654 trytond/tryton/trytond/pool.py
|
|
--- a/tryton/trytond/trytond/pool.py Sun Jul 28 16:05:45 2019 +0200
|
|
+++ b/tryton/trytond/trytond/pool.py Fri Aug 16 11:13:08 2019 +0000
|
|
@@ -183,6 +183,12 @@
|
|
cls.__setup__()
|
|
self.add(cls, type)
|
|
return cls
|
|
+ elif name[:15] == 'babi_execution_':
|
|
+ with Transaction(new=True).start(self.database_name, 0, readonly=False):
|
|
+ Execution = self.get('babi.report.execution')
|
|
+ execution = Execution(int(name[15:]))
|
|
+ execution.validate_model(avoid_registration=True)
|
|
+ return self._pool[self.database_name][type][name]
|
|
raise
|
|
|
|
def add(self, cls, type='model'):
|
|
diff --git a/tryton/trytond/trytond/model/modelsql.py b/tryton/trytond/trytond/model/modelsql.py
|
|
index ee4e855895..ffe84c9e15 100644
|
|
--- a/tryton/trytond/trytond/model/modelsql.py
|
|
+++ b/tryton/trytond/trytond/model/modelsql.py
|
|
@@ -1086,8 +1086,13 @@ class ModelSQL(ModelStorage):
|
|
foreign_table = Model.__table__()
|
|
foreign_red_sql = reduce_ids(
|
|
Column(foreign_table, field_name), sub_ids)
|
|
- cursor.execute(*foreign_table.select(foreign_table.id,
|
|
- where=foreign_red_sql))
|
|
+ import psycopg2
|
|
+ try:
|
|
+ cursor.execute(*foreign_table.select(foreign_table.id,
|
|
+ where=foreign_red_sql))
|
|
+ except psycopg2.errors.UndefinedTable as ex:
|
|
+ if ex.args and (len(ex.args) > 0) and 'babi_execution' in ex.args[0]:
|
|
+ return []
|
|
records = Model.browse([x[0] for x in cursor.fetchall()])
|
|
else:
|
|
with transaction.set_context(active_test=False):
|