From 0fedbb3215081590d6d7fc52bb29f56dedd271e1 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Mon, 20 Dec 2010 17:25:01 +0100 Subject: [PATCH] [FIX] fields.reference: don't accept half-defined references - second part of fix, in create() lp bug: https://launchpad.net/bugs/604604 fixed bzr revid: odo@openerp.com-20101220162501-v0xag7nwdhfij14f --- bin/osv/orm.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 44219344519..dfd1376d4a5 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -3739,21 +3739,7 @@ class orm(orm_template): if field in self._columns \ and hasattr(self._columns[field], 'selection') \ and vals[field]: - if self._columns[field]._type == 'reference': - val = vals[field].split(',')[0] - else: - val = vals[field] - if isinstance(self._columns[field].selection, (tuple, list)): - if val not in dict(self._columns[field].selection): - raise except_orm(_('ValidateError'), - _('The value "%s" for the field "%s" is not in the selection') \ - % (vals[field], field)) - else: - if val not in dict(self._columns[field].selection( - self, cr, user, context=context)): - raise except_orm(_('ValidateError'), - _('The value "%s" for the field "%s" is not in the selection') \ - % (vals[field], field)) + self._check_selection_field_value(cr, user, field, vals[field], context=context) if self._log_access: upd0 += ',create_uid,create_date' upd1 += ',%s,now()'