diff --git a/trytond/trytond/ir/model.py b/trytond/trytond/ir/model.py
index 512c752123..5725d1f59b 100644
--- a/trytond/trytond/ir/model.py
+++ b/trytond/trytond/ir/model.py
@@ -249,6 +249,9 @@ class ModelField(
'module_ref', 'module', 'ir.module,name', "Module",
readonly=True, ondelete='CASCADE',
help="Module in which this field is defined."),
+ fields.fmany2one(
+ 'relation_ref', 'relation', 'ir.model,name', "Relation",
+ ondelete='CASCADE'),
ModelSQL, ModelView):
__name__ = 'ir.model.field'
_rec_name = 'string'
@@ -334,6 +337,7 @@ class ModelField(
@classmethod
def register(cls, model, module_name, model_id):
+ pool = Pool()
cursor = Transaction().connection.cursor()
ir_model_field = cls.__table__()
@@ -358,6 +362,11 @@ class ModelField(
relation = field.relation_name
else:
relation = None
+
+ if relation:
+ Relation = pool.get(relation)
+ Model.register(Relation, module_name)
+
access = field_name in model.__access__
if field_name not in model_fields:
diff --git a/trytond/trytond/ir/view/model_field_form.xml b/trytond/trytond/ir/view/model_field_form.xml
index 397d6ccac2..0a3ab8fbf2 100644
--- a/trytond/trytond/ir/view/model_field_form.xml
+++ b/trytond/trytond/ir/view/model_field_form.xml
@@ -13,8 +13,9 @@ this repository contains the full copyright notices and license terms. -->
-
-
+
+
+
diff --git a/trytond/trytond/ir/view/model_field_list.xml b/trytond/trytond/ir/view/model_field_list.xml
index db50578c04..061b0cd887 100644
--- a/trytond/trytond/ir/view/model_field_list.xml
+++ b/trytond/trytond/ir/view/model_field_list.xml
@@ -6,7 +6,7 @@ this repository contains the full copyright notices and license terms. -->
-
+