Add patch for issue5118

This commit is contained in:
Sergi Almacellas Abellana 2015-11-11 09:58:49 +01:00
parent b8155454a8
commit 4722be2f42
2 changed files with 28 additions and 0 deletions

27
issue5118.diff Normal file
View File

@ -0,0 +1,27 @@
diff -r 8dec33688c06 trytond/trytond/model/modelsql.py
--- a/trytond/trytond/model/modelsql.py Tue Nov 03 12:20:49 2015 +0100
+++ b/trytond/trytond/model/modelsql.py Wed Nov 11 09:57:58 2015 +0100
@@ -128,6 +128,8 @@
def __register__(cls, module_name):
TableHandler = backend.get('TableHandler')
super(ModelSQL, cls).__register__(module_name)
+ pool = Pool()
+ ModelField = pool.get('ir.model.field')
if cls.table_query():
return
@@ -205,7 +207,13 @@
if isinstance(field, fields.Many2One) \
and field.model_name == cls.__name__ \
and field.left and field.right:
- cls._rebuild_tree(field_name, None, 0)
+ irfields = ModelField.search([
+ ('model.model', '=', field.model_name),
+ ('module', '=', module_name),
+ ('name', 'in', [field.left, field.right]),
+ ])
+ if irfields:
+ cls._rebuild_tree(field_name, None, 0)
for ident, constraint, _ in cls._sql_constraints:
table.add_constraint(ident, constraint)

1
series
View File

@ -70,6 +70,7 @@ issue19491002_1.diff
issue20451002_1.diff
issue7961002_40001.diff
issue4115.diff
issue5118.diff
# Uncomment in calfruitos and basidelta
#account_chart_speedup.diff
# Uncomment in calfruitos