[MERGE] orm: add _sql_contraints only when _auto.

bzr revid: vmt@openerp.com-20130604115402-4cf07eq53o6ocs39
This commit is contained in:
Vo Minh Thu 2013-06-04 13:54:02 +02:00
commit 0019a86ecf
1 changed files with 3 additions and 2 deletions

View File

@ -2974,7 +2974,7 @@ class BaseModel(object):
update_custom_fields = context.get('update_custom_fields', False)
self._field_create(cr, context=context)
create = not self._table_exist(cr)
if getattr(self, '_auto', True):
if self._auto:
if create:
self._create_table(cr)
@ -3208,7 +3208,8 @@ class BaseModel(object):
cr.commit() # start a new transaction
self._add_sql_constraints(cr)
if self._auto:
self._add_sql_constraints(cr)
if create:
self._execute_sql(cr)