[FIX] remove useless cr.commit in fields creation
authorMartin Trigaux <mat@openerp.com>
Thu, 13 Feb 2014 12:03:49 +0000 (13:03 +0100)
committerMartin Trigaux <mat@openerp.com>
Thu, 13 Feb 2014 12:03:49 +0000 (13:03 +0100)
This is require to be able to create revertable tests adding new fields

bzr revid: mat@openerp.com-20140213120349-a0p3bist5l5uyg6b

openerp/osv/orm.py

index fde94ff..e95c6ed 100644 (file)
@@ -765,8 +765,6 @@ class BaseModel(object):
                     (name_id, context['module'], 'ir.model', model_id)
                 )
 
-        cr.commit()
-
         cr.execute("SELECT * FROM ir_model_fields WHERE model=%s", (self._name,))
         cols = {}
         for rec in cr.dictfetchall():
@@ -834,7 +832,6 @@ class BaseModel(object):
                 for key, val in vals.items():
                     if cols[k][key] != vals[key]:
                         cr.execute('update ir_model_fields set field_description=%s where model=%s and name=%s', (vals['field_description'], vals['model'], vals['name']))
-                        cr.commit()
                         cr.execute("""UPDATE ir_model_fields SET
                             model_id=%s, field_description=%s, ttype=%s, relation=%s,
                             view_load=%s, select_level=%s, readonly=%s ,required=%s, selectable=%s, relation_field=%s, translate=%s, serialization_field_id=%s
@@ -845,7 +842,6 @@ class BaseModel(object):
                                 vals['select_level'], bool(vals['readonly']), bool(vals['required']), bool(vals['selectable']), vals['relation_field'], bool(vals['translate']), vals['serialization_field_id'], vals['model'], vals['name']
                             ))
                         break
-        cr.commit()
 
     #
     # Goal: try to apply inheritance at the instanciation level and