[FIX] models: do not introduce a one2many manual field if its inverse is not on its comodel
This commit is contained in:
parent
cf26f7ed80
commit
54c655cb71
|
@ -718,7 +718,11 @@ class BaseModel(object):
|
|||
attrs['ondelete'] = field['on_delete']
|
||||
attrs['domain'] = eval(field['domain']) if field['domain'] else None
|
||||
elif field['ttype'] == 'one2many':
|
||||
if partial and field['relation'] not in cls.pool:
|
||||
if partial and not (
|
||||
field['relation'] in cls.pool and (
|
||||
field['relation_field'] in cls.pool[field['relation']]._fields or
|
||||
field['relation_field'] in cls.pool.get_manual_fields(cr, field['relation'])
|
||||
)):
|
||||
continue
|
||||
attrs['comodel_name'] = field['relation']
|
||||
attrs['inverse_name'] = field['relation_field']
|
||||
|
|
Loading…
Reference in New Issue