From 5f6fc4735a9a09c350dbbb789f3d39000ca3601c Mon Sep 17 00:00:00 2001 From: Samus CTO Date: Tue, 5 Aug 2014 11:34:19 +0200 Subject: [PATCH] [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. --- openerp/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/models.py b/openerp/models.py index af55db1f1cb..c28a231d116 100644 --- a/openerp/models.py +++ b/openerp/models.py @@ -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.