diff options
| author | Yannick Tivisse <yti@odoo.com> | 2019-09-05 10:20:49 +0000 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2019-09-11 09:27:42 +0000 |
| commit | a581656b00200439660792ed674e257c8c233b3f (patch) | |
| tree | acbf2cbfd80f8ab48ac1a887a47650cac2e67e17 /addons/web/static/src/js/fields/special_fields.js | |
| parent | 9759b5607055695f6b2063913f052c8176e8be39 (diff) | |
[FIX] models.py: Raise user friendly error message on sql constraints
Purpose
=======
On a record creation, a valid and user friendly error message is raised
when a sql constraint is violated. (Eg: 'The start date must be anterior
to the end date').
On a record modification, this is not always the case anymore, since the
latest ORM modifications.
Eg: Write on a leave with a date_from > date_to, you got the postgreSQL
error, which is not understable by a classic human.
This is due to the fact that the error is correctly catched and logged,
but the result is set into the cache, triggering the execution of computation
methods, and calling _validate_fields. It is highly probable that a flush
is done in the constraint method (search, read, ...). In that case the
postgreSQL error is converted into a ValidationError, with a stringified
version of the IntegrityError, and thus is not catched by the check wrapper.
Diffstat (limited to 'addons/web/static/src/js/fields/special_fields.js')
0 files changed, 0 insertions, 0 deletions
