diff options
| author | Victor Feyens <vfe@odoo.com> | 2020-10-13 08:36:39 +0000 |
|---|---|---|
| committer | Victor Feyens <vfe@odoo.com> | 2020-10-13 16:58:31 +0000 |
| commit | 811cd40fe427c28f9eb244f78ae23c4d3fb42cc8 (patch) | |
| tree | ef288fe456cedcd74f36d88906532b182980ea2f /odoo/addons/base/tests/test_ir_sequence.py | |
| parent | 58ade8c0e17be14fb5bf9cef592c9b9225d21b6d (diff) | |
[REV] base: revert 9f7f1db5add5b8a940e53707091133c0bcadd350
Revert commit
"[FIX] base: clearer message in case of conflict for no_gap sequences"
This commit changed the error returned in case of SQL conflict for no_gap
sequences, wrongly disabling the automatic retry (service/model.py) in case
of such errors.
Also adds a comment in the dedicated test to ensure the behavior is explained
and the automatic retry isn't broken once again by the same kind of change.
closes odoo/odoo#59904
X-original-commit: f84d728520257262cf0cd86221114c53f8332258
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Diffstat (limited to 'odoo/addons/base/tests/test_ir_sequence.py')
| -rw-r--r-- | odoo/addons/base/tests/test_ir_sequence.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/odoo/addons/base/tests/test_ir_sequence.py b/odoo/addons/base/tests/test_ir_sequence.py index 8c27dc18d74..e9a3b97bbf7 100644 --- a/odoo/addons/base/tests/test_ir_sequence.py +++ b/odoo/addons/base/tests/test_ir_sequence.py @@ -7,7 +7,6 @@ import psycopg2 import psycopg2.errorcodes import odoo -from odoo.exceptions import UserError from odoo.tests import common from odoo.tests.common import BaseCase @@ -93,10 +92,13 @@ class TestIrSequenceNoGap(BaseCase): with environment() as env0: with environment() as env1: env1.cr._default_log_exceptions = False # Prevent logging a traceback - with self.assertRaises(UserError) as e: + # NOTE: The error has to be an OperationalError + # s.t. the automatic request retry (service/model.py) works. + with self.assertRaises(psycopg2.OperationalError) as e: n0 = env0['ir.sequence'].next_by_code('test_sequence_type_2') self.assertTrue(n0) n1 = env1['ir.sequence'].next_by_code('test_sequence_type_2') + self.assertEqual(e.exception.pgcode, psycopg2.errorcodes.LOCK_NOT_AVAILABLE, msg="postgresql returned an incorrect errcode") @classmethod def tearDownClass(cls): |
