mirror of
https://github.com/NaN-tic/trytond-patches.git
synced 2023-12-14 06:03:03 +01:00
Remove babi_ column in case read model and is not current available
#162247
This commit is contained in:
parent
1c4262d4d4
commit
db5eedd831
|
@ -19,11 +19,35 @@ index 407ff358..0be2a41a 100644
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def add(self, cls, type='model'):
|
def add(self, cls, type='model'):
|
||||||
diff --git a/tryton/trytond/trytond/model/modelsql.py b/trytond/trytond/model/modelsql.py
|
diff --git a/tryton/trytond/trytond/model/modelsql.py b/tryton/trytond/trytond/model/modelsql.py
|
||||||
index d762a27a..5ca47c34 100644
|
index d4abf5dfe6..29da9fa56b 100644
|
||||||
--- a/tryton/trytond/trytond/model/modelsql.py
|
--- a/tryton/trytond/trytond/model/modelsql.py
|
||||||
+++ b/tryton/trytond/trytond/model/modelsql.py
|
+++ b/tryton/trytond/trytond/model/modelsql.py
|
||||||
@@ -1429,8 +1429,14 @@ class ModelSQL(ModelStorage):
|
@@ -957,6 +957,7 @@ class ModelSQL(ModelStorage):
|
||||||
|
extra_fields = set()
|
||||||
|
if 'write_date' not in fields_names:
|
||||||
|
extra_fields.add('write_date')
|
||||||
|
+ fields_names = fields_names[:]
|
||||||
|
for field_name in fields_names:
|
||||||
|
if field_name in {'_timestamp', '_write', '_delete'}:
|
||||||
|
continue
|
||||||
|
@@ -966,7 +967,14 @@ class ModelSQL(ModelStorage):
|
||||||
|
if field_name.endswith(':string'):
|
||||||
|
field_name = field_name[:-len(':string')]
|
||||||
|
fields_related[field_name]
|
||||||
|
- field = cls._fields[field_name]
|
||||||
|
+ try:
|
||||||
|
+ field = cls._fields[field_name]
|
||||||
|
+ except KeyError as err:
|
||||||
|
+ if 'babi_' in str(err):
|
||||||
|
+ fields_names.remove(field_name)
|
||||||
|
+ continue
|
||||||
|
+ else:
|
||||||
|
+ raise
|
||||||
|
if hasattr(field, 'datetime_field') and field.datetime_field:
|
||||||
|
extra_fields.add(field.datetime_field)
|
||||||
|
if field.context:
|
||||||
|
@@ -1435,8 +1443,14 @@ class ModelSQL(ModelStorage):
|
||||||
foreign_table = Model.__table__()
|
foreign_table = Model.__table__()
|
||||||
foreign_red_sql = reduce_ids(
|
foreign_red_sql = reduce_ids(
|
||||||
Column(foreign_table, field_name), sub_ids)
|
Column(foreign_table, field_name), sub_ids)
|
||||||
|
|
Loading…
Reference in a new issue