diff --git a/openerp/models.py b/openerp/models.py index e7e803f2608..9529c3e1e5e 100644 --- a/openerp/models.py +++ b/openerp/models.py @@ -190,7 +190,7 @@ def get_pg_type(f, type_override=None): elif issubclass(field_type, (fields.char, fields.reference)): pg_type = ('varchar', pg_varchar(f.size)) elif issubclass(field_type, fields.selection): - if (isinstance(f.selection, list) and isinstance(f.selection[0][0], int))\ + if (f.selection and isinstance(f.selection, list) and isinstance(f.selection[0][0], int))\ or getattr(f, 'size', None) == -1: pg_type = ('int4', 'INTEGER') else: