Repository navigation
Conversation
…lled by constraint methods 'detect_exception' can be called on an empty recordset.
- Show menu only to Exception Rule Managers - Use sequence and active widgets on tree view - Updated form to use sheet
… the _popup_exceptions mehtod
[IMP] Computed exception descriptions field, to display better help messages [IMP] Exceptions shouldn't be copied
By default exceptions can be ignored by the click of a button. Users begin human they will just click that button what ever the internal rules. So this PR adds the option to set specific exceptions as blocking. When exceptions are detected if one of them is blocking, the user will not be able to ignore them.
use odoo-test-helper split test so one test do one thing
This method is used by other modules that depend on 'base_exception'.
|
@matiasperalta1 yes, thanks you! I included #3734 in this migration. It cannot be ported alone: it changes code added by #3590, and #3723 and #3725 fix that same code. None of these were ever ported to 19.0. So I included those commits as well. Also done the following:
I left #3741 out because it is not merged in 18.0 yet. |
Closing the exception dialog with one of its buttons (Cancel, or Confirm, which returns an act_window_close action) showed "Oops! Something went wrong" (Component is destroyed). In 20.0, the action plugin waits for onClose before it clears the dialog. The soft_reload done in onClose closes all the dialogs, and this dialog is still open, so onClose runs a second time. The second reload restores the same form view while the first one is still loading it. Closing the dialog with its X button is not affected: the dialog plugin ignores the second close. Reload only once. Reported in OCA/sale-workflow#4681 (comment) Co-authored-by: Franco Leyes <[email protected]>
|
The following commit authors need to sign the Contributor License Agreement: |
7974b3c to
2879860
Compare
Add _must_rollback_on_exception(), true by default: it is false for the
main records listed in the base_exception_no_rollback context
({model: ids}), and then the exceptions are stored in the ongoing
transaction and detect_exceptions() does not raise.
Callers that already wrote on those records in the transaction cannot
use the second cursor: it waits forever on the row lock held by the
ongoing transaction.
|
@matiasperalta1 I also included #3741 now that it is merged in 18.0. Thanks! |
Expert-Odoo
left a comment
There was a problem hiding this comment.
Code review and tested on 20.0, 17 tests pass. The _must_rollback_on_exception opt-out reads well and is covered by the new tests. LGTM.
|
Thanks for the migration. We found a hang with it on 20.0 (this PR at cf187a4, with Steps
Result Cause Any flow that writes the record and confirms it in the same transaction can hit this; it is the runtime counterpart of #3723. The tests cannot catch it, since with |
…he rows Exceptions are written through an independent connection so they survive a rollback of the ongoing transaction. When the ongoing transaction has already written the same rows (e.g. a confirmed sale order line edited and flushed earlier in the request), the independent connection waits for its lock while the ongoing transaction waits in Python for the independent one to finish. PostgreSQL cannot detect that deadlock, so the request hung until the worker was killed, and every other request touching the same records piled up behind it. The independent transaction now waits for row locks at most `_get_exception_lock_timeout()` milliseconds. When that expires, the exceptions are written in the ongoing transaction, and written again in a new transaction if the ongoing one is rolled back (as it is when the exception is raised to the user), once its locks are released, so the exception popup still finds them. The logic lives in `_write_exceptions_independently()` so modules writing exceptions through their own independent connection, like sale_exception for order lines, can reuse it. (cherry picked from commit 0619316)
…oing transaction The independent connection cannot see records created by the ongoing transaction, e.g. a line added to a confirmed sale order, so writing their exceptions through it raises `MissingError` and the user got that error instead of the exception popup. `_write_exceptions_independently()` now handles `MissingError` like a lock timeout: the exceptions are written in the ongoing transaction, so they are detected and raised, and written again after a rollback, skipping the records that no longer exist. (cherry picked from commit 398df8e)
The postrollback hook must not raise, as an error there would break closing the rolled back cursor: the broad except is on purpose. Mark it for BLE001, which the 20.0 ruff configuration enables.
|
@baselogica-ar you are right, thank you! Those are issues affecting version 18.0 as well. |
|
Tested on a 20.0 instance with the Argentinian localization (l10n_ar + ADHOC modules), both on a database with our production modules installed and on a fresh database with demo data (as in CI). Installs and tests pass. It includes some fixes that are not in 19.0; maybe worth a separate PR to 19.0 too. |
No description provided.