[FIX] orm: _validate should not immediately rollback

For some obscure reason _validate used to immediately
rollback the current transaction as soon as a constraint
failed anywhere. This is completely incorrect and
violates the transaction abstraction: the responsibility
of creating and closing transactions belongs to the
RPC dispatch layer, or whatever takes its place (e.g. the
test setup/teardown for tests). Rolling back or committing
in the middle of a transaction precludes special
error treatment and can have very bad side effects.

bzr revid: odo@openerp.com-20121029180742-2gw08kobdh7w5njc
This commit is contained in:
Olivier Dony 2012-10-29 19:07:42 +01:00
parent 290baa5be7
commit 485e437440
1 changed files with 0 additions and 1 deletions

View File

@ -1548,7 +1548,6 @@ class BaseModel(object):
)
self._invalids.update(fields)
if error_msgs:
cr.rollback()
raise except_orm('ValidateError', '\n'.join(error_msgs))
else:
self._invalids.clear()