[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:
Samus CTO 2014-08-05 11:34:19 +02:00 committed by Martin Trigaux
parent 56c54a52df
commit 5f6fc4735a
1 changed files with 1 additions and 1 deletions

View File

@ -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.