@@ -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:
|
||||
|
||||
@@ -13,8 +13,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
<label name="ttype"/>
|
||||
<field name="ttype"/>
|
||||
<label name="relation"/>
|
||||
<field name="relation"/>
|
||||
<label name="relation_ref"/>
|
||||
<field name="relation_ref"/>
|
||||
|
||||
<label name="help" yfill="1"/>
|
||||
<field name="help" colspan="3"/>
|
||||
<label name="access"/>
|
||||
|
||||
@@ -6,7 +6,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name" expand="1" optional="1"/>
|
||||
<field name="model_ref" expand="1"/>
|
||||
<field name="ttype" optional="0"/>
|
||||
<field name="relation" expand="1" optional="1"/>
|
||||
<field name="relation_ref" expand="1" optional="1"/>
|
||||
<field name="access" optional="1"/>
|
||||
<field name="module_ref" optional="1"/>
|
||||
</tree>
|
||||
|
||||
Reference in New Issue
Block a user