[FIX] add SQL constraints only for models stored in database (not on AbstractModel)
authorGuewen Baconnier <guewen.baconnier@camptocamp.com>
Thu, 7 Mar 2013 08:58:26 +0000 (09:58 +0100)
committerGuewen Baconnier <guewen.baconnier@camptocamp.com>
Thu, 7 Mar 2013 08:58:26 +0000 (09:58 +0100)
lp bug: https://launchpad.net/bugs/1151703 fixed

bzr revid: guewen.baconnier@camptocamp.com-20130307085826-omhoc3clix41zydl

openerp/osv/orm.py

index 96f56ee..7f8f671 100644 (file)
@@ -3204,7 +3204,8 @@ class BaseModel(object):
 
         cr.commit()     # start a new transaction
 
-        self._add_sql_constraints(cr)
+        if getattr(self, '_auto', True):
+            self._add_sql_constraints(cr)
 
         if create:
             self._execute_sql(cr)