Skip to content

Conversation

@lef-adhoc
Copy link
Contributor

No description provided.

mourad-ehm and others added 30 commits October 14, 2025 16:14
…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
[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'.
@lef-adhoc lef-adhoc force-pushed the 19.0-mig-base_exception branch 4 times, most recently from 377345c to 39384d7 Compare October 16, 2025 15:28
@lef-adhoc
Copy link
Contributor Author

@etobella Done!
I based it on the migration of edi_core_oca and deleted odoo_test_helper.


@classmethod
def tearDownClass(cls):
cls.loader.restore_registry()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lef-adhoc You should keep this but using:

 cls.addClassCleanup(cls.registry.__delitem__, "base.exception.test.purchase.line")

etc...

@lef-adhoc lef-adhoc force-pushed the 19.0-mig-base_exception branch 8 times, most recently from 5d64547 to 9057175 Compare October 17, 2025 19:58
@lef-adhoc
Copy link
Contributor Author

@rousseldenis I removed the test_purchase_ids = fields.Many2many("base.exception.test.purchase") field from ExceptionRule. This field was creating a Many2many relationship from the exception.rule model to the test model base.exception.test.purchase. The problem occurred during teardown: when addClassCleanup deleted base.exception.test.purchase from the registry, the test_purchase_ids field became orphaned (referencing a non-existent model). This caused AssertionError: Field exception.rule.test_purchase_ids with unknown comodel_name 'base.exception.test.purchase' during reset_changes(). Since this field wasn't actually used in any test assertions, removing it was the cleanest solution.

Also added @mute_logger("odoo.registry") to suppress expected ERROR logs during test model registration. When add_to_registry registers models, Odoo's registry verification detects they don't have database tables yet and logs ERROR odoo.registry: Model X has no table. These errors are harmless (tables are created immediately after by init_models()), but the ERROR keyword in logs causes CI to fail. The decorator mutes these registry errors without affecting actual test failures.

@rousseldenis
Copy link
Contributor

@lef-adhoc @etobella So, the mechanism is not yet error prone safe.

@etobella
Copy link
Member

@rousseldenis no, it is safe.

He was missing this

cls.addClassCleanup(cls.registry["exception.rule"]._fields.__delitem__, "test_purchase_ids")

I have tested it in local and worked like a charm 😉

@lef-adhoc lef-adhoc force-pushed the 19.0-mig-base_exception branch from 9057175 to f9f02a7 Compare October 18, 2025 14:06
@lef-adhoc
Copy link
Contributor Author

@etobella I changed it as you said, but it's not working for me.
Is there something wrong?

@etobella
Copy link
Member

Myself... I didn't execute the full tests. Sorry.

However, there is a way for making it work

42e3025

Can you test? it worked for me.

@lef-adhoc lef-adhoc force-pushed the 19.0-mig-base_exception branch from f9f02a7 to 2327062 Compare October 20, 2025 14:08
@lef-adhoc lef-adhoc force-pushed the 19.0-mig-base_exception branch from 2327062 to 8a64493 Compare October 20, 2025 14:08
@lef-adhoc
Copy link
Contributor Author

@rousseldenis @etobella I think it's fine now

Copy link
Member

@etobella etobella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@lef-adhoc
Copy link
Contributor Author

@rousseldenis Could we merge?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.