[FIX]: Minor fix for null value in fetchall

bzr revid: atp@tinyerp.com-20120312070445-t9u9dowz5j2mhzmd
This commit is contained in:
Atul Patel (OpenERP) 2012-03-12 12:34:45 +05:30
parent 180a23c7cc
commit 4d3849b108
1 changed files with 2 additions and 2 deletions

View File

@ -282,10 +282,10 @@ class ir_model_fields(osv.osv):
field = self.browse(cr, uid, ids, context)
model = self.pool.get(field.model)
cr.execute("select relkind from pg_class where relname=%s", (model._table,))
result = cr.fetchone()[0]
result = cr.fetchone()
cr.execute("SELECT column_name FROM information_schema.columns WHERE table_name ='%s'and column_name='%s'"%(model._table, field.name))
column_name = cr.fetchone()
if column_name and result == 'r':
if column_name and (result and result[0] == 'r'):
cr.execute("ALTER table %s DROP column %s cascade" % (model._table, field.name))
model._columns.pop(field.name, None)
return True