[IMP] Do not create FK when destination model is _auto=False
It is not useful to try to create foreign keys when the destination model is a PostgreSQL view for example. We already do this kind of verifications but ir.actions and transient models but did not for _auto.
This commit is contained in:
parent
56c54a52df
commit
5f6fc4735a
|
@ -2621,7 +2621,7 @@ class BaseModel(object):
|
|||
|
||||
if isinstance(f, fields.many2one) or (isinstance(f, fields.function) and f._type == 'many2one' and f.store):
|
||||
dest_model = self.pool[f._obj]
|
||||
if dest_model._table != 'ir_actions':
|
||||
if dest_model._auto and dest_model._table != 'ir_actions':
|
||||
self._m2o_fix_foreign_key(cr, self._table, k, dest_model, f.ondelete)
|
||||
|
||||
# The field doesn't exist in database. Create it if necessary.
|
||||
|
|
Loading…
Reference in New Issue