[FIX] increase size of field "name" of ir.model.data
authorChristophe Simonis <christophe@tinyerp.com>
Fri, 7 Aug 2009 13:52:08 +0000 (15:52 +0200)
committerChristophe Simonis <christophe@tinyerp.com>
Fri, 7 Aug 2009 13:52:08 +0000 (15:52 +0200)
bzr revid: christophe@tinyerp.com-20090807135208-hr5pokupqh14dpao

bin/addons/base/base.sql
bin/addons/base/ir/ir_model.py
bin/osv/orm.py

index 91d5cc4..58b30a8 100644 (file)
@@ -328,7 +328,7 @@ CREATE TABLE ir_model_data (
     write_date timestamp without time zone,
     write_uid integer,
     noupdate boolean,
-    name character varying(64) NOT NULL,
+    name character varying(128) NOT NULL,
     date_init timestamp without time zone,
     date_update timestamp without time zone,
     module character varying(64) NOT NULL,
index 1e71814..3d0c294 100644 (file)
@@ -404,7 +404,7 @@ ir_model_access()
 class ir_model_data(osv.osv):
     _name = 'ir.model.data'
     _columns = {
-        'name': fields.char('XML Identifier', required=True, size=64),
+        'name': fields.char('XML Identifier', required=True, size=128),
         'model': fields.char('Object', required=True, size=64),
         'module': fields.char('Module', required=True, size=64),
         'res_id': fields.integer('Resource ID'),
index 834b38e..b221a4a 100644 (file)
@@ -382,11 +382,11 @@ class orm_template(object):
                 ))
                 if 'module' in context:
                     name1 = 'field_' + self._table + '_' + k
-                    cr.execute("select name from ir_model_data where name='%s'"%(name1))
+                    cr.execute("select name from ir_model_data where name=%s", (name1,))
                     if cr.fetchone():
                         name1 = name1 + "_" + str(id)
                     cr.execute("INSERT INTO ir_model_data (name,date_init,date_update,module,model,res_id) VALUES (%s, now(), now(), %s, %s, %s)", \
-                        (name1[:64], context['module'], 'ir.model.fields', id)
+                        (name1, context['module'], 'ir.model.fields', id)
                     )
             else:
                 for key, val in vals.items():