diff --git a/issue5118.diff b/issue5118.diff new file mode 100644 index 0000000..faa4c46 --- /dev/null +++ b/issue5118.diff @@ -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) diff --git a/series b/series index cbcffd3..092c45f 100644 --- a/series +++ b/series @@ -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