Repository navigation
[ADD] base_exception_compat: keep the pre-3590 exception flow for every model - #455
Closed
fw-bot-adhoc wants to merge 1 commit into
Closed
fw-bot-adhoc wants to merge 1 commit into
fw-bot-adhoc wants to merge 1 commit into
Conversation
…ry model The replacement of base.exception.method.detect_exceptions() used to live in sale_exception_compat. The method is defined on the abstract model every exception module inherits from, so stock_exception was covered only while a sale module happened to be installed, with nothing declaring that dependency. Move it to its own module that auto installs with base_exception, so the flow is restored for stock.picking, stock.move and anything else that inherits base.exception without depending on sales. The override delegates to super() when the context carries test_base_exception, the key upstream sets to exercise the second cursor on purpose in its own tests. Nothing sets it outside tests, so the behaviour is unchanged elsewhere and those tests keep meaning something once this module is loaded. Without this module, on a database with stock_exception and no sale_exception, confirming a transfer that matches an exception rule raises BaseExceptionError from detect_exceptions(). The web client swallows it and asks the record for its popup, but stock.picking does not override _must_popup_exception(), so the default False turns it into a soft reload: the transfer stays in draft and the user is told nothing. stock_exception's own test suite errors on 2 of its 4 tests for the same reason. X-original-commit: dcab508
Contributor
Contributor
Author
|
@lef-adhoc @maq-adhoc while this was properly forward-ported, at least one co-dependent PR (ingadhoc/sale#1878) did not succeed. You will need to fix it before this can be merged. Both this PR and the others will need to be approved via More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port |
Contributor
|
No va a ir a 19 esto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What changes
sale_exception_compatreplacesbase.exception.method.detect_exceptions(), the method every exception module inherits from. Keeping that replacement inside a sale module leftstock_exceptioncovered only while a sale module happened to be installed, and nothing declared that dependency.This moves the replacement to its own module, auto installed with
base_exception.sale_exception_compatkeeps only what is specific to sales (companion PR iningadhoc/sale, same branch name).Why it matters
On a database with
stock_exceptionand nosale_exception, confirming a transfer that matches an exception rule raisesBaseExceptionErrorfromdetect_exceptions(). The web client catches it and asks the record for its popup, butstock.pickingdoes not override_must_popup_exception(), so the defaultFalseturns it into a soft reload: the transfer stays in draft and the user is told nothing.About the test_base_exception guard
The override delegates to
super()when the context carriestest_base_exception, the key upstream sets to exercise the second cursor on purpose in its own tests. Nothing sets it outside tests.It is needed because this module loads right after
base_exception, whilesale_exception_compatloaded after the tests ofsale_exceptionhad already run. Those tests were green only because the compat was not in the registry yet.How it was checked
Odoo 18,
base_exception18.0.1.3.0,stock_exceptionon the branch deployed to customers.stock_exceptionsuite, no saleBaseExceptionError)sale_exceptionsuitestock.exception.confirmpopupsale.exception.confirmpopupsale.exception.confirmpopupUpgrading a database that already had
sale_exception_compat18.0.1.1.0 installs this module as the new dependency with no manual step.Forward-Port-Of: #453