diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index 65fcd68c7c3..ea52c6cc7a0 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -5217,7 +5217,7 @@ def convert_pgerror_23502(model, fields, info, e): m = re.match(r'^null value in column "(?P\w+)" violates ' r'not-null constraint\n', str(e)) - field_name = m.group('field') + field_name = m and m.group('field') if not m or field_name not in fields: return {'message': unicode(e)} message = _(u"Missing required value for the field '%s'.") % field_name @@ -5232,7 +5232,7 @@ def convert_pgerror_23502(model, fields, info, e): def convert_pgerror_23505(model, fields, info, e): m = re.match(r'^duplicate key (?P\w+) violates unique constraint', str(e)) - field_name = m.group('field') + field_name = m and m.group('field') if not m or field_name not in fields: return {'message': unicode(e)} message = _(u"The value for the field '%s' already exists.") % field_name