Skip to content
Snippets Groups Projects
user avatar
Nans Lefebvre authored
When testing the import of records, a flush should be done to check
all databases constraints and fields computations.
Moreover, in case an exception is raised within a savepoint,
the environment should be cleaned up, to avoid tricky bugs (see below).
We replace the manual handling of savepoints with the savepoint
context manager, which already handles all of this.
This code predates the context manager, so in a way it was archaic.

When testing the import of records, the following could happen:
"An unknown issue occurred during import (possibly lost connection,
 data limit exceeded or memory limits exceeded)."
This would happen on project tasks; the fields 'working_hours_open',
'working_hours_close', 'working_days_open', 'working_days_close',
all depend on the computation of _compute_elapsed.
Because this is a test import, the records would raise a MissingError,
and fields_to_compute would always contain 3 of the fields.
The resulting is an infinite loop giving this error.

opw 2092134

closes odoo/odoo#39627

Signed-off-by: default avatarNans Lefebvre (len) <len@odoo.com>
Co-authored-by: default avatarRaphael Collet <rco@odoo.com>
1a315e87
History
Name Last commit Last update